Skip to content

Commit 0ff69be

Browse files
committed
a huge update, basically a new version of WakaTime#
1 parent 4cdcb52 commit 0ff69be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3096
-207
lines changed

WakaTime.sln

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27729.1
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29001.49
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WakaTime", "src\WakaTime.csproj", "{42ADD38C-D6B0-4304-9459-F0D003DD4FE7}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WakaTime", "src\WakaTime\WakaTime.csproj", "{42ADD38C-D6B0-4304-9459-F0D003DD4FE7}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{797C7B9D-CCA9-492B-9A97-AE35C068636B}"
99
ProjectSection(SolutionItems) = preProject
@@ -16,6 +16,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1616
README.md = README.md
1717
EndProjectSection
1818
EndProject
19+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WakaTime.GtkSharp", "src\WakaTime.GtkSharp\WakaTime.GtkSharp.csproj", "{73C80406-5D7C-4E2A-8332-755FA6CA5107}"
20+
EndProject
21+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WakaTime.WinForms", "src\WakaTime.WinForms\WakaTime.WinForms.csproj", "{5DE27A1B-F660-451D-AC81-C904C0ABB979}"
22+
EndProject
1923
Global
2024
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2125
Debug|Any CPU = Debug|Any CPU
@@ -26,6 +30,14 @@ Global
2630
{42ADD38C-D6B0-4304-9459-F0D003DD4FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
2731
{42ADD38C-D6B0-4304-9459-F0D003DD4FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
2832
{42ADD38C-D6B0-4304-9459-F0D003DD4FE7}.Release|Any CPU.Build.0 = Release|Any CPU
33+
{73C80406-5D7C-4E2A-8332-755FA6CA5107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34+
{73C80406-5D7C-4E2A-8332-755FA6CA5107}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{73C80406-5D7C-4E2A-8332-755FA6CA5107}.Release|Any CPU.ActiveCfg = Release|Any CPU
36+
{73C80406-5D7C-4E2A-8332-755FA6CA5107}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{5DE27A1B-F660-451D-AC81-C904C0ABB979}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{5DE27A1B-F660-451D-AC81-C904C0ABB979}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{5DE27A1B-F660-451D-AC81-C904C0ABB979}.Release|Any CPU.ActiveCfg = Release|Any CPU
40+
{5DE27A1B-F660-451D-AC81-C904C0ABB979}.Release|Any CPU.Build.0 = Release|Any CPU
2941
EndGlobalSection
3042
GlobalSection(SolutionProperties) = preSolution
3143
HideSolutionNode = FALSE

src/EditorInfo.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/IWakaTimeIdePlugin.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/NativeMethods.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/WakaTime.GtkSharp/ApiKeyForm.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using Gtk;
3+
using WakaTime;
4+
using System.Diagnostics;
5+
6+
public partial class ApiKeyForm: Window
7+
{
8+
public ApiKeyForm()
9+
: base(WindowType.Toplevel)
10+
{
11+
Build();
12+
ApiKeyForm_Load();
13+
}
14+
15+
void OnDeleteEvent(object sender, DeleteEventArgs a)
16+
{
17+
a.RetVal = true;
18+
Destroy();
19+
}
20+
21+
void ApiKeyForm_Load()
22+
{
23+
try
24+
{
25+
txtAPIKey.Text = WakaTimeConfigFile.ApiKey;
26+
}
27+
catch (Exception ex)
28+
{
29+
MessageBox.Show(ex.Message);
30+
}
31+
}
32+
33+
void btnOk_Click(object sender, EventArgs e)
34+
{
35+
try
36+
{
37+
Guid apiKey;
38+
var parse = Guid.TryParse(txtAPIKey.Text.Trim(), out apiKey);
39+
if (parse)
40+
{
41+
WakaTimeConfigFile.ApiKey = apiKey.ToString();
42+
WakaTimeConfigFile.Save();
43+
Destroy();
44+
}
45+
else
46+
{
47+
MessageBox.Show("Please enter valid API Key.");
48+
}
49+
}
50+
catch (Exception ex)
51+
{
52+
MessageBox.Show(ex.Message);
53+
}
54+
}
55+
56+
void btnWamaTime_Clicked(object sender, EventArgs e)
57+
{
58+
Process.Start("http://wakatime.com");
59+
}
60+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using Gtk;
2+
using WakaTime;
3+
using System.ComponentModel;
4+
using System.Net;
5+
using GLib;
6+
7+
public partial class DownloadProgressForm: Window, IDownloadProgressReporter
8+
{
9+
public DownloadProgressForm(Window parent)
10+
: base(WindowType.Toplevel)
11+
{
12+
Build();
13+
14+
TransientFor = parent;
15+
SetPosition(WindowPosition.CenterOnParent);
16+
}
17+
18+
void OnDeleteEvent(object sender, SignalArgs a)
19+
{
20+
a.RetVal = true;
21+
Destroy();
22+
}
23+
24+
public void Show(string message = "")
25+
{
26+
Gtk.Application.Invoke(delegate
27+
{
28+
progressbar1.Text = message;
29+
base.Show();
30+
});
31+
}
32+
33+
public void Close(AsyncCompletedEventArgs e)
34+
{
35+
if (e.Error != null)
36+
{
37+
MessageBox.Show(e.Error.Message);
38+
}
39+
40+
Destroy();
41+
}
42+
43+
public void Report(DownloadProgressChangedEventArgs e)
44+
{
45+
Gtk.Application.Invoke(delegate
46+
{
47+
progressbar1.Fraction = e.ProgressPercentage;
48+
progressbar1.Window.ProcessUpdates(true); // Request visual update
49+
while (Gtk.Application.EventsPending())
50+
Gtk.Application.RunIteration(true); // Process any messages waiting in the Application Message Loop
51+
});
52+
}
53+
}

src/WakaTime.GtkSharp/MessageBox.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Gtk;
2+
3+
/// <summary>
4+
/// Message box class.
5+
/// </summary>
6+
public static class MessageBox
7+
{
8+
/// <summary>
9+
/// Show the specified message.
10+
/// </summary>
11+
/// <param name="message">Message to show.</param>
12+
/// <param name="type">Type of the message to show.</param>
13+
public static void Show(string message, MessageType type = MessageType.Info)
14+
{
15+
var md = new MessageDialog (null, DialogFlags.Modal, type, ButtonsType.Ok, message);
16+
md.Run ();
17+
md.Destroy();
18+
}
19+
}
20+
21+

src/WakaTime.GtkSharp/SettingsForm.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using System;
2+
using Gtk;
3+
using WakaTime;
4+
5+
public partial class SettingsForm: Window
6+
{
7+
internal event EventHandler ConfigSaved;
8+
9+
public SettingsForm()
10+
: base(WindowType.Toplevel)
11+
{
12+
Build();
13+
SettingsForm_Load();
14+
}
15+
16+
void SettingsForm_Load()
17+
{
18+
try
19+
{
20+
txtAPIKey.Text = WakaTimeConfigFile.ApiKey;
21+
txtProxy.Text = WakaTimeConfigFile.Proxy;
22+
chkDebugMode.Active = WakaTimeConfigFile.Debug;
23+
}
24+
catch (Exception ex)
25+
{
26+
Logger.Error("Error when loading form SettingsForm:", ex);
27+
MessageBox.Show(ex.Message);
28+
}
29+
}
30+
31+
void OnDeleteEvent(object sender, DeleteEventArgs a)
32+
{
33+
a.RetVal = true;
34+
Destroy();
35+
}
36+
37+
void btnCancel_Clicked(object sender, EventArgs e)
38+
{
39+
Destroy();
40+
}
41+
42+
void btnOK_Clicked(object sender, EventArgs e)
43+
{
44+
try
45+
{
46+
if (Guid.TryParse(txtAPIKey.Text.Trim(), out Guid apiKey))
47+
{
48+
WakaTimeConfigFile.ApiKey = apiKey.ToString();
49+
WakaTimeConfigFile.Proxy = txtProxy.Text.Trim();
50+
WakaTimeConfigFile.Debug = chkDebugMode.Active;
51+
WakaTimeConfigFile.Save();
52+
OnConfigSaved();
53+
Destroy();
54+
}
55+
else
56+
{
57+
MessageBox.Show(@"Please enter valid Api Key."); // do not close dialog box
58+
}
59+
}
60+
catch (Exception ex)
61+
{
62+
Logger.Error("Error when saving data from SettingsForm:", ex);
63+
MessageBox.Show(ex.Message);
64+
}
65+
}
66+
67+
protected void OnConfigSaved()
68+
{
69+
var handler = ConfigSaved;
70+
if (handler != null)
71+
handler(this, EventArgs.Empty);
72+
}
73+
74+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="GtkSharp" Version="3.22.25.56" />
9+
</ItemGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\WakaTime\WakaTime.csproj" />
13+
</ItemGroup>
14+
15+
<PropertyGroup>
16+
<PackOnBuild>true</PackOnBuild>
17+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
18+
<IsPackable>true</IsPackable>
19+
<Version>0.1.0</Version>
20+
<FileVersion>0.1.0</FileVersion>
21+
<AssemblyVersion>0.1.0</AssemblyVersion>
22+
<Authors>Zhmayev Yaroslav aka Salaros</Authors>
23+
<Company>CodeCave LLC</Company>
24+
<Owners>salaros,CodeCave</Owners>
25+
<Product>WakaTime</Product>
26+
<NeutralLanguage>English</NeutralLanguage>
27+
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
28+
</PropertyGroup>
29+
30+
<PropertyGroup>
31+
<PackageProjectUrl>https://wakatime.com</PackageProjectUrl>
32+
<RepositoryUrl>https://github.com/CodeCavePro/wakatime-sharp.git</RepositoryUrl>
33+
<RepositoryType>git</RepositoryType>
34+
<Description>A core implementation of all WakaTime C#-driven plug-ins for IDE such as Visual Studio, Xamarin Studio, Monodevelop etc</Description>
35+
<Copyright>Copyright 2016 (c) CodeCave LLC</Copyright>
36+
</PropertyGroup>
37+
38+
</Project>

0 commit comments

Comments
 (0)