Skip to content

Commit b12866e

Browse files
committed
Updated EULA, Launch Kit
Added icons
1 parent 163d09a commit b12866e

14 files changed

+296
-108
lines changed

Installer/register.cmd

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"%Windir%\Microsoft.NET\Framework64\v4.0.30319\regasm" /codebase "%~dp0CodeStack.Sw.MyToolbar.dll"

Installer/unregister.cmd

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"%Windir%\Microsoft.NET\Framework64\v4.0.30319\regasm" /codebase "%~dp0CodeStack.Sw.MyToolbar.dll" /u

MyToolbarSwAddin.cs

+30-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using Xarial.Community.AppLaunchKit.Attributes;
1414
using Xarial.Community.AppLaunchKit;
1515
using System.Drawing;
16+
using Xarial.Community.AppLaunchKit.Exceptions;
1617

1718
namespace CodeStack.Community.Sw.MyToolbar
1819
{
@@ -47,7 +48,7 @@ internal static Icon Icon
4748
{
4849
get
4950
{
50-
return null;
51+
return Resources.custom_toolbars_icon;
5152
}
5253
}
5354
}
@@ -131,6 +132,8 @@ public bool ConnectToSW(object ThisSW, int cookie)
131132
m_LaunchKit = new LaunchKitController(this.GetType(),
132133
new IntPtr(m_App.IFrameObject().GetHWnd()));
133134

135+
m_LaunchKit.CheckForUpdatesService.CheckUpdateFailed += OnCheckUpdateFailed;
136+
134137
m_LaunchKit.StartServices();
135138

136139
m_AddinCookie = cookie;
@@ -145,18 +148,39 @@ public bool ConnectToSW(object ThisSW, int cookie)
145148

146149
return true;
147150
}
148-
catch(Exception ex)
151+
catch (UpdatesCheckException)
152+
{
153+
ShowCheckUpdatesFailedWarning();
154+
return true;
155+
}
156+
catch (EulaNotAgreedException)
157+
{
158+
return false;
159+
}
160+
catch (Exception ex)
149161
{
150-
m_App.SendMsgToUser2("Critical Error:"
162+
m_App.SendMsgToUser2($"{Resources.AppTitle}. Critical Error:"
151163
+ System.Environment.NewLine
152-
+ ex.Message,
164+
+ ex.Message,
153165
(int)swMessageBoxIcon_e.swMbStop,
154166
(int)swMessageBoxBtn_e.swMbOk);
155167

156168
return false;
157169
}
158170
}
159171

172+
private void ShowCheckUpdatesFailedWarning()
173+
{
174+
m_App.SendMsgToUser2($"{Resources.AppTitle}. Failed to check for updates",
175+
(int)swMessageBoxIcon_e.swMbWarning,
176+
(int)swMessageBoxBtn_e.swMbOk);
177+
}
178+
179+
private void OnCheckUpdateFailed(Exception err)
180+
{
181+
ShowCheckUpdatesFailedWarning();
182+
}
183+
160184
public bool DisconnectFromSW()
161185
{
162186
try
@@ -315,7 +339,7 @@ private static CustomToolbarInfo TryReadInfoFromCache()
315339
private static string TryCreateDefaultIcon()
316340
{
317341
var imgPath = Path.Combine(Locations.AppDirectoryPath,
318-
nameof(Resources.codestack_toolbar) + ".png");
342+
nameof(Resources.custom_toolbars_toolbar) + ".png");
319343

320344
try
321345
{
@@ -326,7 +350,7 @@ private static string TryCreateDefaultIcon()
326350
Directory.CreateDirectory(dir);
327351
}
328352

329-
Resources.codestack_toolbar.Save(imgPath);
353+
Resources.custom_toolbars_toolbar.Save(imgPath);
330354
}
331355
catch
332356
{

Properties/Resources.Designer.cs

+15-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Properties/Resources.resx

+5-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,11 @@
121121
<value>MyToolbar</value>
122122
</data>
123123
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
124-
<data name="codestack_toolbar" type="System.Resources.ResXFileRef, System.Windows.Forms">
125-
<value>..\Resources\codestack-toolbar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
124+
<data name="custom_toolbars_icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
125+
<value>..\Resources\custom_toolbars_icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
126+
</data>
127+
<data name="custom_toolbars_toolbar" type="System.Resources.ResXFileRef, System.Windows.Forms">
128+
<value>..\Resources\custom-toolbars-toolbar.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
126129
</data>
127130
<data name="eula" type="System.Resources.ResXFileRef, System.Windows.Forms">
128131
<value>..\Resources\eula.rtf;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>

Resources/custom-toolbars-toolbar.png

625 Bytes
Loading

Resources/custom_toolbars_icon.ico

83.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)