Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

Commit c972905

Browse files
committed
* Features
1 parent 261c13b commit c972905

File tree

9 files changed

+290
-1546
lines changed

9 files changed

+290
-1546
lines changed

Installer Project Files/Krypton Toolkit Suite for .NET 4.7/Krypton Toolkit Suite for .NET 4.7.aip

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<DOCUMENT Type="Advanced Installer" CreateVersion="15.8" version="16.3" Modules="professional" RootPath="." Language="en_GB" Id="{0D75B41B-038C-4CAB-8FAB-7F64BF05A46E}">
2+
<DOCUMENT Type="Advanced Installer" CreateVersion="15.8" version="16.4.1" Modules="professional" RootPath="." Language="en_GB" Id="{0D75B41B-038C-4CAB-8FAB-7F64BF05A46E}">
33
<COMPONENT cid="caphyon.advinst.msicomp.ProjectOptionsComponent">
44
<ROW Name="HiddenItems" Value="AppXProductDetailsComponent;AppXDependenciesComponent;AppXAppDetailsComponent;AppXVisualAssetsComponent;AppXCapabilitiesComponent;AppXAppDeclarationsComponent;AppXUriRulesComponent;MsiJavaComponent;MsiDriverPackagesComponent;UserAccountsComponent;ScheduledTasksComponent;SqlConnectionComponent;AutorunComponent;FirewallExceptionComponent;GameUxComponent;MsiDirectEditorComponent;SharePointSlnComponent;SilverlightSlnComponent;MultipleInstancesComponent;SccmComponent;ActSyncAppComponent;FixupComponent"/>
55
</COMPONENT>
@@ -813,12 +813,12 @@
813813
<ROW Registry="VersionMinor" Root="-1" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[ProductName] [ProductVersion]" Name="VersionMinor" Value="#0" Component_="AI_CustomARPName"/>
814814
</COMPONENT>
815815
<COMPONENT cid="caphyon.advinst.msicomp.MsiShortsComponent">
816-
<ROW Shortcut="KryptonExplorer.exe" Directory_="SHORTCUTDIR" Name="KRYPTO~1.EXE|Krypton Explorer.exe" Component_="KryptonExplorer.exe" Target="[#KryptonExplorer.exe]" Description="Krypton Explorer.exe" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Examples_Dir"/>
816+
<ROW Shortcut="KryptonExplorer.exe" Directory_="SHORTCUTDIR" Name="KRYPTO~2|Krypton Explorer" Component_="KryptonExplorer.exe" Target="[#KryptonExplorer.exe]" Description="Krypton Explorer.exe" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Examples_Dir"/>
817817
<ROW Shortcut="KryptonExplorer.exe_1" Directory_="DesktopFolder" Name="KRYPTO~1|Krypton Explorer" Component_="KryptonExplorer.exe" Target="[#KryptonExplorer.exe]" Description="Krypton Explorer.exe" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Examples_Dir"/>
818818
<ROW Shortcut="KryptonToolkitHelp" Directory_="SHORTCUTDIR" Name="KRYPTO~1|Krypton Toolkit Help" Component_="KryptonToolkitHelp.chm" Target="[#KryptonToolkitHelp.chm]" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Help_Dir"/>
819-
<ROW Shortcut="PaletteDesigner.exe" Directory_="SHORTCUTDIR" Name="PALETT~1.EXE|Palette Designer.exe" Component_="PaletteDesigner.exe" Target="[#PaletteDesigner.exe]" Description="Palette Designer.exe" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Examples_Dir"/>
819+
<ROW Shortcut="PaletteDesigner.exe" Directory_="SHORTCUTDIR" Name="PALETT~1|Palette Designer" Component_="PaletteDesigner.exe" Target="[#PaletteDesigner.exe]" Description="Palette Designer.exe" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Examples_Dir"/>
820820
<ROW Shortcut="PaletteDesigner.exe_1" Directory_="DesktopFolder" Name="PALETT~1|Palette Designer" Component_="PaletteDesigner.exe" Target="[#PaletteDesigner.exe]" Description="Palette Designer.exe" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Examples_Dir"/>
821-
<ROW Shortcut="PaletteUpgradeTool.exe" Directory_="SHORTCUTDIR" Name="PALETT~2.EXE|Palette Upgrade Tool.exe" Component_="PaletteUpgradeTool.exe" Target="[#PaletteUpgradeTool.exe]" Description="Palette Upgrade Tool.exe" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Examples_Dir"/>
821+
<ROW Shortcut="PaletteUpgradeTool.exe" Directory_="SHORTCUTDIR" Name="PALETT~2|Palette Upgrade Tool" Component_="PaletteUpgradeTool.exe" Target="[#PaletteUpgradeTool.exe]" Description="Palette Upgrade Tool.exe" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Examples_Dir"/>
822822
<ROW Shortcut="PaletteUpgradeTool.exe_1" Directory_="DesktopFolder" Name="PALETT~2|Palette Upgrade Tool" Component_="PaletteUpgradeTool.exe" Target="[#PaletteUpgradeTool.exe]" Description="Palette Upgrade Tool.exe" Hotkey="0" IconIndex="0" ShowCmd="1" WkDir="Examples_Dir"/>
823823
<ROW Shortcut="Uninstall" Directory_="SHORTCUTDIR" Name="UNINST~1|Uninstall" Component_="License.rtf" Target="[SystemFolder]msiexec.exe" Arguments="/x [ProductCode]" Hotkey="0" Icon_="SystemFoldermsiexec.exe" IconIndex="0" ShowCmd="1"/>
824824
</COMPONENT>

Installer Project Files/Krypton Toolkit Suite for .NET 4.7/Krypton Toolkit Suite for .NET 4.7.back (1).aip

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

Installer Project Files/Krypton Toolkit Suite for .NET 4.7/Krypton Toolkit Suite for .NET 4.7.back.aip

Lines changed: 0 additions & 702 deletions
This file was deleted.
Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
using ComponentFactory.Krypton.Toolkit;
2+
using Microsoft.Win32;
3+
using System;
4+
using System.Windows.Forms;
5+
6+
namespace PaletteDesigner.Classes
7+
{
8+
/// <summary>
9+
/// Deals with the back-end logic of a most recently used file <see cref="ToolStripMenuItem"/>.
10+
/// Adapted from (https://www.codeproject.com/Articles/407513/Add-Most-Recently-Used-Files-MRU-List-to-Windows).
11+
/// </summary>
12+
public class MostRecentlyUsedDocumentsManager
13+
{
14+
#region Private members
15+
private bool UseConfirmClearListDialogue;
16+
17+
private string NameOfProgram;
18+
19+
private string SubKeyName;
20+
21+
private string filePath;
22+
23+
private ToolStripMenuItem ParentMenuItem;
24+
25+
private ToolStripMenuItem ClearListItem;
26+
27+
private Action<object, EventArgs> OnRecentFileClick;
28+
29+
private Action<object, EventArgs> OnClearRecentFilesClick;
30+
31+
/// <summary>
32+
/// Gets or sets the file path.
33+
/// </summary>
34+
/// <value>
35+
/// The file path.
36+
/// </value>
37+
public string FilePath
38+
{
39+
get
40+
{
41+
return filePath;
42+
}
43+
44+
set
45+
{
46+
filePath = value;
47+
}
48+
}
49+
50+
/// <summary>
51+
/// Called when [clear recent files click].
52+
/// </summary>
53+
/// <param name="obj">The object.</param>
54+
/// <param name="evt">The <see cref="EventArgs"/> instance containing the event data.</param>
55+
private void OnClearRecentFiles_Click(object obj, EventArgs evt)
56+
{
57+
try
58+
{
59+
DialogResult result = KryptonMessageBox.Show("You are about to clear your recent files list. Do you want to continue?", "Clear Recent Files", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
60+
61+
if (result == DialogResult.Yes)
62+
{
63+
ClearRecentFiles();
64+
}
65+
}
66+
catch (Exception ex)
67+
{
68+
Console.WriteLine(ex.ToString());
69+
}
70+
71+
if (OnClearRecentFilesClick != null)
72+
{
73+
OnClearRecentFilesClick(obj, evt);
74+
}
75+
}
76+
77+
/// <summary>
78+
/// Clears the recent files.
79+
/// </summary>
80+
private void ClearRecentFiles()
81+
{
82+
try
83+
{
84+
RegistryKey rK = Registry.CurrentUser.OpenSubKey(SubKeyName, true);
85+
86+
if (rK == null)
87+
{
88+
return;
89+
}
90+
91+
string[] values = rK.GetValueNames();
92+
93+
foreach (string valueName in values)
94+
{
95+
rK.DeleteValue(valueName, true);
96+
}
97+
98+
rK.Close();
99+
100+
ParentMenuItem.DropDownItems.Clear();
101+
102+
ParentMenuItem.Enabled = false;
103+
}
104+
catch (Exception ex)
105+
{
106+
KryptonMessageBox.Show($"Error: { ex.Message }", "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
107+
}
108+
}
109+
110+
/// <summary>
111+
/// Refreshes the recent files menu.
112+
/// </summary>
113+
private void RefreshRecentFilesMenu()
114+
{
115+
RegistryKey rK;
116+
117+
string s;
118+
119+
ToolStripItem tSI;
120+
121+
try
122+
{
123+
rK = Registry.CurrentUser.OpenSubKey(this.SubKeyName, false);
124+
125+
if (rK == null)
126+
{
127+
ParentMenuItem.Enabled = false;
128+
129+
return;
130+
}
131+
}
132+
catch (Exception ex)
133+
{
134+
KryptonMessageBox.Show($"Error: { ex.Message }", "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
135+
136+
return;
137+
}
138+
139+
ParentMenuItem.DropDownItems.Clear();
140+
141+
string[] valueNames = rK.GetValueNames();
142+
143+
foreach (string valueName in valueNames)
144+
{
145+
s = rK.GetValue(valueName, null) as string;
146+
147+
if (s == null)
148+
{
149+
continue;
150+
}
151+
152+
tSI = ParentMenuItem.DropDownItems.Add(s);
153+
154+
tSI.Click += new EventHandler(OnRecentFileClick);
155+
}
156+
157+
if (ParentMenuItem.DropDownItems.Count == 0)
158+
{
159+
ParentMenuItem.Enabled = false;
160+
161+
return;
162+
}
163+
164+
ParentMenuItem.DropDownItems.Add("-");
165+
166+
tSI = ParentMenuItem.DropDownItems.Add("&Clear list");
167+
168+
tSI.Click += new EventHandler(OnClearRecentFiles_Click);
169+
170+
ParentMenuItem.Enabled = true;
171+
}
172+
#endregion
173+
174+
#region Public members
175+
/// <summary>
176+
/// Adds the recent file.
177+
/// </summary>
178+
/// <param name="fileNameWithFullPath">The file name with full path.</param>
179+
public void AddRecentFile(string fileNameWithFullPath)
180+
{
181+
string s;
182+
183+
try
184+
{
185+
RegistryKey rK = Registry.CurrentUser.CreateSubKey(SubKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree);
186+
187+
for (int i = 0; true; i++)
188+
{
189+
s = rK.GetValue(i.ToString(), null) as string;
190+
191+
if (s == null)
192+
{
193+
rK.SetValue(i.ToString(), fileNameWithFullPath);
194+
195+
rK.Close();
196+
197+
break;
198+
}
199+
else if (s == fileNameWithFullPath)
200+
{
201+
rK.Close();
202+
203+
break;
204+
}
205+
}
206+
}
207+
catch (Exception ex)
208+
{
209+
KryptonMessageBox.Show($"Error: { ex.Message }", "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
210+
}
211+
212+
RefreshRecentFilesMenu();
213+
}
214+
215+
216+
/// <summary>
217+
/// Removes the recent file.
218+
/// </summary>
219+
/// <param name="fileNameWithFullPath">The file name with full path.</param>
220+
public void RemoveRecentFile(string fileNameWithFullPath)
221+
{
222+
try
223+
{
224+
RegistryKey rK = Registry.CurrentUser.OpenSubKey(SubKeyName, true);
225+
226+
string[] valuesNames = rK.GetValueNames();
227+
228+
foreach (string valueName in valuesNames)
229+
{
230+
if ((rK.GetValue(valueName, null) as string) == fileNameWithFullPath)
231+
{
232+
rK.DeleteValue(valueName, true);
233+
234+
RefreshRecentFilesMenu();
235+
236+
break;
237+
}
238+
}
239+
}
240+
catch (Exception ex)
241+
{
242+
Console.WriteLine(ex.ToString());
243+
}
244+
245+
RefreshRecentFilesMenu();
246+
}
247+
#endregion
248+
249+
#region Constructor
250+
/// <summary>
251+
/// Initializes a new instance of the <see cref="MostRecentlyUsedDocumentsManager"/> class.
252+
/// </summary>
253+
/// <param name="parentMenuItem">The parent menu item.</param>
254+
/// <param name="nameOfProgram">The name of program.</param>
255+
/// <param name="onRecentFileClick">The on recent file click.</param>
256+
/// <param name="onClearRecentFilesClick">The on clear recent files click.</param>
257+
/// <param name="useConfirmClearListDialogue">if set to <c>true</c> [use confirm clear list dialogue].</param>
258+
/// <exception cref="ArgumentException">Bad argument.</exception>
259+
public MostRecentlyUsedDocumentsManager(ToolStripMenuItem parentMenuItem, string nameOfProgram, Action<object, EventArgs> onRecentFileClick, Action<object, EventArgs> onClearRecentFilesClick = null, bool useConfirmClearListDialogue = true)
260+
{
261+
if (parentMenuItem == null || onRecentFileClick == null || nameOfProgram == null || nameOfProgram.Length == 0 || nameOfProgram.Contains("\\")) throw new ArgumentException("Bad argument.");
262+
263+
ParentMenuItem = parentMenuItem;
264+
265+
NameOfProgram = nameOfProgram;
266+
267+
OnRecentFileClick = onRecentFileClick;
268+
269+
OnClearRecentFilesClick = onClearRecentFilesClick;
270+
271+
SubKeyName = string.Format($"Software\\{ NameOfProgram }\\MRU");
272+
273+
UseConfirmClearListDialogue = useConfirmClearListDialogue;
274+
275+
RefreshRecentFilesMenu();
276+
}
277+
#endregion
278+
}
279+
}

Source/Demos/NuGet Enabled/Palette Designer/MainForm.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Demos/NuGet Enabled/Palette Designer/Palette Designer 2019.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
<Reference Include="System.Xml" />
8787
</ItemGroup>
8888
<ItemGroup>
89+
<Compile Include="Classes\MostRecentlyUsedDocumentsManager.cs" />
8990
<Compile Include="Components\KryptonPropertyGrid.cs">
9091
<SubType>Component</SubType>
9192
</Compile>
@@ -198,6 +199,7 @@
198199
<Version>5.470.826</Version>
199200
</PackageReference>
200201
</ItemGroup>
202+
<ItemGroup />
201203
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
202204
<PropertyGroup>
203205
<PostBuildEvent>xcopy "$(TargetDir)*.*" "$(ProjectDir)..\..\Binaries\" /D /R /Y /S</PostBuildEvent>

Source/Palette Designer/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
using System.Runtime.InteropServices;
1919
using System.Security;
2020

21-
[assembly: AssemblyVersion("5.470.6013.0")]
22-
[assembly: AssemblyFileVersion("5.470.6013.0")]
23-
[assembly: AssemblyInformationalVersion("4.5.13.0")]
21+
[assembly: AssemblyVersion("5.470.6014.0")]
22+
[assembly: AssemblyFileVersion("5.470.6014.0")]
23+
[assembly: AssemblyInformationalVersion("4.5.14.0")]
2424
[assembly: AssemblyCopyright("© Component Factory Pty Ltd 2012 - 2019. All rights reserved.")]
2525
[assembly: AssemblyProduct("Palette Designer")]
2626
[assembly: AssemblyDefaultAlias("PaletteDesigner.dll")]

0 commit comments

Comments
 (0)