mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-27 02:21:01 +12:00
Upgrade to UWP / .NET Core 3.1 (#57)
This commit is contained in:
parent
598df8048a
commit
4ad35a8f33
|
@ -360,7 +360,8 @@ namespace SystemTrayMenu.DataClasses
|
||||||
FileName = TargetFilePathOrig,
|
FileName = TargetFilePathOrig,
|
||||||
Arguments = Arguments,
|
Arguments = Arguments,
|
||||||
WorkingDirectory = WorkingDirectory,
|
WorkingDirectory = WorkingDirectory,
|
||||||
CreateNoWindow = true
|
CreateNoWindow = true,
|
||||||
|
UseShellExecute = true
|
||||||
};
|
};
|
||||||
p.Start();
|
p.Start();
|
||||||
};
|
};
|
||||||
|
|
10
Properties/Settings.Designer.cs
generated
10
Properties/Settings.Designer.cs
generated
|
@ -1,10 +1,10 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Dieser Code wurde von einem Tool generiert.
|
// This code was generated by a tool.
|
||||||
// Laufzeitversion:4.0.30319.42000
|
// Runtime Version:4.0.30319.42000
|
||||||
//
|
//
|
||||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// der Code erneut generiert wird.
|
// the code is regenerated.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace SystemTrayMenu.Properties {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.6.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net472</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
@ -69,6 +70,11 @@
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Properties\Settings.Designer.cs">
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Update="UserInterface\AboutBox.Designer.cs">
|
<Compile Update="UserInterface\AboutBox.Designer.cs">
|
||||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -114,11 +120,10 @@
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
<Compile Update="Properties\Settings.Designer.cs">
|
<None Update="Properties\Settings.settings">
|
||||||
<AutoGen>True</AutoGen>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
</None>
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Resources\SystemTrayMenu.ico" />
|
<Content Include="Resources\SystemTrayMenu.ico" />
|
||||||
|
@ -183,12 +188,6 @@
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||||
<PackageReference Include="WindowsAPICodePack-Core">
|
|
||||||
<Version>1.1.2</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="WindowsAPICodePack-Shell">
|
|
||||||
<Version>1.1.1</Version>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent>taskkill /f /fi "imagename eq SystemTrayMenu"</PreBuildEvent>
|
<PreBuildEvent>taskkill /f /fi "imagename eq SystemTrayMenu"</PreBuildEvent>
|
||||||
|
|
|
@ -330,7 +330,10 @@ namespace SystemTrayMenu.UserInterface
|
||||||
// codebase
|
// codebase
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
nvc.Add("CodeBase", a.CodeBase.Replace("file:///", ""));
|
if (!a.IsDynamic)
|
||||||
|
{
|
||||||
|
nvc.Add("CodeBase", a.CodeBase.Replace("file:///", ""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (NotSupportedException)
|
catch (NotSupportedException)
|
||||||
{
|
{
|
||||||
|
@ -349,7 +352,10 @@ namespace SystemTrayMenu.UserInterface
|
||||||
// location
|
// location
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
nvc.Add("Location", a.Location);
|
if (!a.IsDynamic)
|
||||||
|
{
|
||||||
|
nvc.Add("Location", a.Location);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (NotSupportedException)
|
catch (NotSupportedException)
|
||||||
{
|
{
|
||||||
|
@ -361,11 +367,17 @@ namespace SystemTrayMenu.UserInterface
|
||||||
if (assemblyName.Version != null &&
|
if (assemblyName.Version != null &&
|
||||||
(assemblyName.Version.Major != 0 || assemblyName.Version.Minor != 0))
|
(assemblyName.Version.Major != 0 || assemblyName.Version.Minor != 0))
|
||||||
{
|
{
|
||||||
version = a.GetName().Version.ToString();
|
if (!a.IsDynamic)
|
||||||
|
{
|
||||||
|
version = a.GetName().Version.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
nvc.Add("Version", version);
|
nvc.Add("Version", version);
|
||||||
|
|
||||||
nvc.Add("FullName", a.FullName);
|
if (!a.IsDynamic)
|
||||||
|
{
|
||||||
|
nvc.Add("FullName", a.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
return nvc;
|
return nvc;
|
||||||
}
|
}
|
||||||
|
@ -444,15 +456,15 @@ namespace SystemTrayMenu.UserInterface
|
||||||
private void PopulateAppInfo()
|
private void PopulateAppInfo()
|
||||||
{
|
{
|
||||||
AppDomain d = AppDomain.CurrentDomain;
|
AppDomain d = AppDomain.CurrentDomain;
|
||||||
Populate(AppInfoListView, "Application Name", d.SetupInformation.ApplicationName);
|
Populate(AppInfoListView, "Application Name", Assembly.GetEntryAssembly().GetName().Name);
|
||||||
Populate(AppInfoListView, "Application Base", d.SetupInformation.ApplicationBase);
|
Populate(AppInfoListView, "Application Base", d.SetupInformation.ApplicationBase);
|
||||||
Populate(AppInfoListView, "Cache Path", d.SetupInformation.CachePath);
|
//Populate(AppInfoListView, "Cache Path", d.SetupInformation.CachePath);
|
||||||
Populate(AppInfoListView, "Configuration File", d.SetupInformation.ConfigurationFile);
|
//Populate(AppInfoListView, "Configuration File", d.SetupInformation.ConfigurationFile);
|
||||||
Populate(AppInfoListView, "Dynamic Base", d.SetupInformation.DynamicBase);
|
//Populate(AppInfoListView, "Dynamic Base", d.SetupInformation.DynamicBase);
|
||||||
Populate(AppInfoListView, "Friendly Name", d.FriendlyName);
|
Populate(AppInfoListView, "Friendly Name", d.FriendlyName);
|
||||||
Populate(AppInfoListView, "License File", d.SetupInformation.LicenseFile);
|
//Populate(AppInfoListView, "License File", d.SetupInformation.LicenseFile);
|
||||||
Populate(AppInfoListView, "private Bin Path", d.SetupInformation.PrivateBinPath);
|
//Populate(AppInfoListView, "private Bin Path", d.SetupInformation.PrivateBinPath);
|
||||||
Populate(AppInfoListView, "Shadow Copy Directories", d.SetupInformation.ShadowCopyDirectories);
|
//Populate(AppInfoListView, "Shadow Copy Directories", d.SetupInformation.ShadowCopyDirectories);
|
||||||
Populate(AppInfoListView, " ", " ");
|
Populate(AppInfoListView, " ", " ");
|
||||||
Populate(AppInfoListView, "Entry Assembly", _EntryAssemblyName);
|
Populate(AppInfoListView, "Entry Assembly", _EntryAssemblyName);
|
||||||
Populate(AppInfoListView, "Executing Assembly", _ExecutingAssemblyName);
|
Populate(AppInfoListView, "Executing Assembly", _ExecutingAssemblyName);
|
||||||
|
|
|
@ -70,15 +70,15 @@ namespace SystemTrayMenu.UserInterface.Controls
|
||||||
private readonly IList<int> _needNonShiftModifier = new List<int>();
|
private readonly IList<int> _needNonShiftModifier = new List<int>();
|
||||||
private readonly IList<int> _needNonAltGrModifier = new List<int>();
|
private readonly IList<int> _needNonAltGrModifier = new List<int>();
|
||||||
|
|
||||||
private readonly ContextMenu _dummy = new ContextMenu();
|
private readonly ContextMenuStrip _dummy = new ContextMenuStrip();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to make sure that there is no right-click menu available
|
/// Used to make sure that there is no right-click menu available
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override ContextMenu ContextMenu
|
public override ContextMenuStrip ContextMenuStrip
|
||||||
{
|
{
|
||||||
get => _dummy;
|
get => _dummy;
|
||||||
set => base.ContextMenu = _dummy;
|
set => base.ContextMenuStrip = _dummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -97,8 +97,8 @@ namespace SystemTrayMenu.UserInterface.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HotkeyControl()
|
public HotkeyControl()
|
||||||
{
|
{
|
||||||
ContextMenu = _dummy; // Disable right-clicking
|
ContextMenuStrip = _dummy; // Disable right-clicking
|
||||||
Text = "None";
|
Text = string.Empty;
|
||||||
|
|
||||||
// Handle events that occurs when keys are pressed
|
// Handle events that occurs when keys are pressed
|
||||||
KeyPress += HotkeyControl_KeyPress;
|
KeyPress += HotkeyControl_KeyPress;
|
||||||
|
|
328
UserInterface/FolderDialog/FolderDialog.cs
Normal file
328
UserInterface/FolderDialog/FolderDialog.cs
Normal file
|
@ -0,0 +1,328 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace SystemTrayMenu.UserInterface.FolderDialog
|
||||||
|
{
|
||||||
|
public class FolderDialog : IFolderDialog, IDisposable
|
||||||
|
{
|
||||||
|
private bool isDisposed;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets folder in which dialog will be open.
|
||||||
|
/// </summary>
|
||||||
|
public string InitialFolder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/sets directory in which dialog will be open
|
||||||
|
/// if there is no recent directory available.
|
||||||
|
/// </summary>
|
||||||
|
public string DefaultFolder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets selected folder.
|
||||||
|
/// </summary>
|
||||||
|
public string Folder { get; set; }
|
||||||
|
public DialogResult ShowDialog()
|
||||||
|
{
|
||||||
|
return ShowDialog(owner: new WindowWrapper(IntPtr.Zero));
|
||||||
|
}
|
||||||
|
public DialogResult ShowDialog(IWin32Window owner)
|
||||||
|
{
|
||||||
|
if (Environment.OSVersion.Version.Major >= 6)
|
||||||
|
{
|
||||||
|
return ShowVistaDialog(owner);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ShowLegacyDialog(owner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DialogResult ShowVistaDialog(IWin32Window owner)
|
||||||
|
{
|
||||||
|
var frm = (NativeMethods.IFileDialog)(new NativeMethods.FileOpenDialogRCW());
|
||||||
|
uint options;
|
||||||
|
frm.GetOptions(out options);
|
||||||
|
options |= NativeMethods.FOS_PICKFOLDERS |
|
||||||
|
NativeMethods.FOS_FORCEFILESYSTEM |
|
||||||
|
NativeMethods.FOS_NOVALIDATE |
|
||||||
|
NativeMethods.FOS_NOTESTFILECREATE |
|
||||||
|
NativeMethods.FOS_DONTADDTORECENT;
|
||||||
|
frm.SetOptions(options);
|
||||||
|
if (this.InitialFolder != null)
|
||||||
|
{
|
||||||
|
NativeMethods.IShellItem directoryShellItem;
|
||||||
|
var riid = new Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"); //IShellItem
|
||||||
|
if (NativeMethods.SHCreateItemFromParsingName
|
||||||
|
(this.InitialFolder, IntPtr.Zero, ref riid,
|
||||||
|
out directoryShellItem) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
frm.SetFolder(directoryShellItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.DefaultFolder != null)
|
||||||
|
{
|
||||||
|
NativeMethods.IShellItem directoryShellItem;
|
||||||
|
var riid = new Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"); //IShellItem
|
||||||
|
if (NativeMethods.SHCreateItemFromParsingName
|
||||||
|
(this.DefaultFolder, IntPtr.Zero, ref riid,
|
||||||
|
out directoryShellItem) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
frm.SetDefaultFolder(directoryShellItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (frm.Show(owner.Handle) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
NativeMethods.IShellItem shellItem;
|
||||||
|
if (frm.GetResult(out shellItem) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
IntPtr pszString;
|
||||||
|
if (shellItem.GetDisplayName(NativeMethods.SIGDN_FILESYSPATH,
|
||||||
|
out pszString) == NativeMethods.S_OK)
|
||||||
|
{
|
||||||
|
if (pszString != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.Folder = Marshal.PtrToStringAuto(pszString);
|
||||||
|
return DialogResult.OK;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Marshal.FreeCoTaskMem(pszString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DialogResult.Cancel;
|
||||||
|
}
|
||||||
|
public DialogResult ShowLegacyDialog(IWin32Window owner)
|
||||||
|
{
|
||||||
|
using (var frm = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
frm.CheckFileExists = false;
|
||||||
|
frm.CheckPathExists = true;
|
||||||
|
frm.CreatePrompt = false;
|
||||||
|
frm.Filter = "|" + Guid.Empty.ToString();
|
||||||
|
frm.FileName = "any";
|
||||||
|
if (this.InitialFolder != null) { frm.InitialDirectory = this.InitialFolder; }
|
||||||
|
frm.OverwritePrompt = false;
|
||||||
|
frm.Title = "Select Folder";
|
||||||
|
frm.ValidateNames = false;
|
||||||
|
if (frm.ShowDialog(owner) == DialogResult.OK)
|
||||||
|
{
|
||||||
|
this.Folder = Path.GetDirectoryName(frm.FileName);
|
||||||
|
return DialogResult.OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return DialogResult.Cancel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (!isDisposed)
|
||||||
|
{
|
||||||
|
//just to have possibility of Using statement.
|
||||||
|
}
|
||||||
|
isDisposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class WindowWrapper : System.Windows.Forms.IWin32Window
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="handle">Handle to wrap</param>
|
||||||
|
public WindowWrapper(IntPtr handle)
|
||||||
|
{
|
||||||
|
_hwnd = handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Original ptr
|
||||||
|
/// </summary>
|
||||||
|
public IntPtr Handle
|
||||||
|
{
|
||||||
|
get { return _hwnd; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private IntPtr _hwnd;
|
||||||
|
}
|
||||||
|
internal static class NativeMethods
|
||||||
|
{
|
||||||
|
#region Constants
|
||||||
|
|
||||||
|
public const uint FOS_PICKFOLDERS = 0x00000020;
|
||||||
|
public const uint FOS_FORCEFILESYSTEM = 0x00000040;
|
||||||
|
public const uint FOS_NOVALIDATE = 0x00000100;
|
||||||
|
public const uint FOS_NOTESTFILECREATE = 0x00010000;
|
||||||
|
public const uint FOS_DONTADDTORECENT = 0x02000000;
|
||||||
|
|
||||||
|
public const uint S_OK = 0x0000;
|
||||||
|
|
||||||
|
public const uint SIGDN_FILESYSPATH = 0x80058000;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region COM
|
||||||
|
|
||||||
|
[ComImport, ClassInterface(ClassInterfaceType.None),
|
||||||
|
TypeLibType(TypeLibTypeFlags.FCanCreate),
|
||||||
|
Guid("DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7")]
|
||||||
|
internal class FileOpenDialogRCW { }
|
||||||
|
|
||||||
|
[ComImport(), Guid("42F85136-DB7E-439C-85F1-E4075D135FC8"),
|
||||||
|
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
internal interface IFileDialog
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
[PreserveSig()]
|
||||||
|
uint Show([In, Optional] IntPtr hwndOwner); //IModalWindow
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFileTypes([In] uint cFileTypes,
|
||||||
|
[In, MarshalAs(UnmanagedType.LPArray)] IntPtr rgFilterSpec);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFileTypeIndex([In] uint iFileType);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetFileTypeIndex(out uint piFileType);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint Advise([In, MarshalAs(UnmanagedType.Interface)] IntPtr pfde,
|
||||||
|
out uint pdwCookie);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint Unadvise([In] uint dwCookie);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetOptions([In] uint fos);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetOptions(out uint fos);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetCurrentSelection
|
||||||
|
([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint AddPlace
|
||||||
|
([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, uint fdap);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)]
|
||||||
|
string pszDefaultExtension);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint Close([MarshalAs(UnmanagedType.Error)] uint hr);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetClientGuid([In] ref Guid guid);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint ClearClientData();
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
[ComImport, Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"),
|
||||||
|
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
||||||
|
internal interface IShellItem
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint BindToHandler([In] IntPtr pbc, [In] ref Guid rbhid,
|
||||||
|
[In] ref Guid riid, [Out, MarshalAs(UnmanagedType.Interface)] out IntPtr ppvOut);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetDisplayName([In] uint sigdnName, out IntPtr ppszName);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint GetAttributes([In] uint sfgaoMask, out uint psfgaoAttribs);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.InternalCall,
|
||||||
|
MethodCodeType = MethodCodeType.Runtime)]
|
||||||
|
uint Compare([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi,
|
||||||
|
[In] uint hint, out int piOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
[DllImport("shell32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
|
internal static extern int SHCreateItemFromParsingName
|
||||||
|
([MarshalAs(UnmanagedType.LPWStr)] string pszPath, IntPtr pbc,
|
||||||
|
ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
|
||||||
|
}
|
||||||
|
}
|
16
UserInterface/FolderDialog/IFolderDialog.cs
Normal file
16
UserInterface/FolderDialog/IFolderDialog.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace SystemTrayMenu.UserInterface.FolderDialog
|
||||||
|
{
|
||||||
|
public interface IFolderDialog
|
||||||
|
{
|
||||||
|
string InitialFolder { get; set; }
|
||||||
|
string DefaultFolder { get; set; }
|
||||||
|
string Folder { get; set; }
|
||||||
|
DialogResult ShowDialog();
|
||||||
|
DialogResult ShowDialog(IWin32Window owner);
|
||||||
|
DialogResult ShowVistaDialog(IWin32Window owner);
|
||||||
|
DialogResult ShowLegacyDialog(IWin32Window owner);
|
||||||
|
void Dispose();
|
||||||
|
}
|
||||||
|
}
|
|
@ -77,14 +77,15 @@ namespace SystemTrayMenu.Utilities
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//if (!string.IsNullOrEmpty(arguments))
|
using (Process p = new Process())
|
||||||
//{
|
{
|
||||||
Process.Start(fileName, arguments);
|
p.StartInfo = new ProcessStartInfo(fileName)
|
||||||
//}
|
{
|
||||||
//else
|
Arguments = arguments,
|
||||||
//{
|
UseShellExecute = true
|
||||||
// Process.Start(fileName);
|
};
|
||||||
//}
|
p.Start();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
19
app.config
19
app.config
|
@ -1,11 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" >
|
||||||
<section name="SystemTrayMenu.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="SystemTrayMenu.Properties.Settings" type="System.Configuration.ClientSettingsSection, System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup><userSettings>
|
<userSettings>
|
||||||
<SystemTrayMenu.Properties.Settings>
|
<SystemTrayMenu.Properties.Settings>
|
||||||
<setting name="CurrentCultureInfoName" serializeAs="String">
|
<setting name="CurrentCultureInfoName" serializeAs="String">
|
||||||
<value />
|
<value />
|
||||||
|
@ -24,7 +24,4 @@
|
||||||
</setting>
|
</setting>
|
||||||
</SystemTrayMenu.Properties.Settings>
|
</SystemTrayMenu.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
<System.Windows.Forms.ApplicationConfigurationSection>
|
</configuration>
|
||||||
<add key="DpiAwareness" value="PerMonitorV2" />
|
|
||||||
</System.Windows.Forms.ApplicationConfigurationSection>
|
|
||||||
</configuration>
|
|
Loading…
Reference in a new issue