mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-28 19:10:26 +12:00
parent
039fd92e26
commit
3ead0424d2
|
@ -801,8 +801,8 @@ namespace SystemTrayMenu.Controls
|
|||
// </summary>
|
||||
private class ListViewItemComparer : System.Collections.IComparer
|
||||
{
|
||||
private int _intCol;
|
||||
private bool _IsAscending = true;
|
||||
private readonly int _intCol;
|
||||
private readonly bool _IsAscending = true;
|
||||
|
||||
public ListViewItemComparer()
|
||||
{
|
||||
|
|
|
@ -17,12 +17,13 @@ namespace SystemTrayMenu
|
|||
public event EventHandler Restart;
|
||||
public event EventHandler Exit;
|
||||
|
||||
private NotifyIcon notifyIcon = new NotifyIcon();
|
||||
private readonly NotifyIcon notifyIcon = new NotifyIcon();
|
||||
private DateTime timeLoadingStart;
|
||||
private int threadsLoading = 0;
|
||||
private Timer load = new Timer();
|
||||
private int loadCount = 0, indexLoad = 0;
|
||||
private List<Icon> bitmapsLoading = new List<Icon>() { R.L010, R.L020, R.L030,
|
||||
private readonly Timer load = new Timer();
|
||||
private int loadCount = 0;
|
||||
private readonly int indexLoad = 0;
|
||||
private readonly List<Icon> bitmapsLoading = new List<Icon>() { R.L010, R.L020, R.L030,
|
||||
R.L040, R.L050, R.L060, R.L070, R.L080, R.L090, R.L100, R.L110, R.L120,
|
||||
R.L130, R.L140, R.L150, R.L160, R.L170, R.L180};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace SystemTrayMenu
|
|||
}
|
||||
|
||||
public int Level = 0;
|
||||
private FadeForm FadeForm = null;
|
||||
private readonly FadeForm FadeForm = null;
|
||||
private bool autoResizeRowsDone = false;
|
||||
|
||||
public enum MenuType { Default, DisposedFake };
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace SystemTrayMenu.Controls
|
|||
public string TargetFilePathOrig;
|
||||
public string Text;
|
||||
public int RowIndex;
|
||||
private WaitMenuOpen waitMenuOpen = new WaitMenuOpen();
|
||||
private Icon icon = null;
|
||||
private readonly WaitMenuOpen waitMenuOpen = new WaitMenuOpen();
|
||||
private readonly Icon icon = null;
|
||||
private bool isDisposed = false;
|
||||
|
||||
public RowData()
|
||||
|
|
|
@ -14,9 +14,9 @@ namespace SystemTrayMenu.Handler
|
|||
public Action<int, int, DataGridView> RowDeselected;
|
||||
public event EventHandler Cleared;
|
||||
|
||||
private Menu[] menus;
|
||||
private KeyboardHook hook = new KeyboardHook();
|
||||
private Timer timerKeySearch = new Timer();
|
||||
private readonly Menu[] menus;
|
||||
private readonly KeyboardHook hook = new KeyboardHook();
|
||||
private readonly Timer timerKeySearch = new Timer();
|
||||
public int iRowKey = -1;
|
||||
public int iMenuKey = 0;
|
||||
private string KeySearchString = string.Empty;
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace SystemTrayMenu.Handler
|
|||
{
|
||||
public event EventHandler Leave;
|
||||
|
||||
private Timer timerSecondLeaveCheck = new Timer();
|
||||
private readonly Timer timerSecondLeaveCheck = new Timer();
|
||||
|
||||
public WaitFastLeave()
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace SystemTrayMenu.Handler
|
|||
{
|
||||
public event EventHandler DoOpen;
|
||||
|
||||
private Timer waitOpen = new Timer();
|
||||
private readonly Timer waitOpen = new Timer();
|
||||
private bool waitedDone = false;
|
||||
private bool clicked = false;
|
||||
private bool menuLoaded = false;
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace SystemTrayMenu
|
|||
}
|
||||
}
|
||||
|
||||
private Timer timerFadeIn = new Timer();
|
||||
private Timer timerFadeOut = new Timer();
|
||||
private Timer timerFadeHalf = new Timer();
|
||||
private Form form = null;
|
||||
private readonly Timer timerFadeIn = new Timer();
|
||||
private readonly Timer timerFadeOut = new Timer();
|
||||
private readonly Timer timerFadeHalf = new Timer();
|
||||
private readonly Form form = null;
|
||||
private bool stopFadeInByHalf = false;
|
||||
|
||||
public FadeForm(Form form)
|
||||
|
|
|
@ -7,11 +7,11 @@ namespace SystemTrayMenu.Helper
|
|||
{
|
||||
public class FileIni
|
||||
{
|
||||
private Dictionary<string, string> values;
|
||||
private readonly Dictionary<string, string> values;
|
||||
public FileIni(string path)
|
||||
{
|
||||
values = File.ReadLines(path)
|
||||
.Where(line => (!String.IsNullOrWhiteSpace(line) && !line.StartsWith("#")))
|
||||
.Where(line => (!string.IsNullOrWhiteSpace(line) && !line.StartsWith("#")))
|
||||
.Select(line => line.Split(new char[] { '=' }, 2, 0))
|
||||
.ToDictionary(parts => parts[0].Trim(), parts => parts.Length > 1 ? parts[1].Trim() : null);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace SystemTrayMenu.Helper
|
|||
/// </example>
|
||||
public class IconReader
|
||||
{
|
||||
private static ConcurrentDictionary<string, Icon> dictIconCache = new ConcurrentDictionary<string, Icon>();
|
||||
private static readonly ConcurrentDictionary<string, Icon> dictIconCache = new ConcurrentDictionary<string, Icon>();
|
||||
|
||||
/// <summary>
|
||||
/// Options to specify the size of icons to return.
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace SystemTrayMenu.Helper
|
|||
/// </summary>
|
||||
private class Window : NativeWindow, IDisposable
|
||||
{
|
||||
private static int WM_HOTKEY = 0x0312;
|
||||
private static readonly int WM_HOTKEY = 0x0312;
|
||||
|
||||
public Window()
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ namespace SystemTrayMenu.Helper
|
|||
#endregion
|
||||
}
|
||||
|
||||
private Window _window = new Window();
|
||||
private readonly Window _window = new Window();
|
||||
private int _currentId;
|
||||
|
||||
public KeyboardHook()
|
||||
|
@ -120,8 +120,8 @@ namespace SystemTrayMenu.Helper
|
|||
/// </summary>
|
||||
public class KeyPressedEventArgs : EventArgs
|
||||
{
|
||||
private KeyboardHookModifierKeys _modifier;
|
||||
private Keys _key;
|
||||
private readonly KeyboardHookModifierKeys _modifier;
|
||||
private readonly Keys _key;
|
||||
|
||||
internal KeyPressedEventArgs(KeyboardHookModifierKeys modifier, Keys key)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace SystemTrayMenu.Helper
|
|||
{
|
||||
internal static class Log
|
||||
{
|
||||
private static Logger log = new Logger("");
|
||||
private static readonly Logger log = new Logger("");
|
||||
internal static void Initialize()
|
||||
{
|
||||
Logger.Start(new FileInfo(GetLogFilePath()));
|
||||
|
|
|
@ -630,8 +630,8 @@ namespace SystemTrayMenu.Helper
|
|||
private const int S_OK = 0;
|
||||
private const int S_FALSE = 1;
|
||||
|
||||
private static int cbMenuItemInfo = Marshal.SizeOf(typeof(MENUITEMINFO));
|
||||
private static int cbInvokeCommand = Marshal.SizeOf(typeof(CMINVOKECOMMANDINFOEX));
|
||||
private static readonly int cbMenuItemInfo = Marshal.SizeOf(typeof(MENUITEMINFO));
|
||||
private static readonly int cbInvokeCommand = Marshal.SizeOf(typeof(CMINVOKECOMMANDINFOEX));
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -639,11 +639,11 @@ namespace SystemTrayMenu.Helper
|
|||
|
||||
// Retrieves the IShellFolder interface for the desktop folder, which is the root of the Shell's namespace.
|
||||
[DllImport("shell32.dll")]
|
||||
private static extern Int32 SHGetDesktopFolder(out IntPtr ppshf);
|
||||
private static extern int SHGetDesktopFolder(out IntPtr ppshf);
|
||||
|
||||
// Takes a STRRET structure returned by IShellFolder::GetDisplayNameOf, converts it to a string, and places the result in a buffer.
|
||||
[DllImport("shlwapi.dll", EntryPoint = "StrRetToBuf", ExactSpelling = false, CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern Int32 StrRetToBuf(IntPtr pstr, IntPtr pidl, StringBuilder pszBuf, int cchBuf);
|
||||
private static extern int StrRetToBuf(IntPtr pstr, IntPtr pidl, StringBuilder pszBuf, int cchBuf);
|
||||
|
||||
// The TrackPopupMenuEx function displays a shortcut menu at the specified location and tracks the selection of items on the shortcut menu. The shortcut menu can appear anywhere on the screen.
|
||||
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
|
||||
|
@ -1227,7 +1227,7 @@ namespace SystemTrayMenu.Helper
|
|||
// Translates a file object's or folder's display name into an item identifier list.
|
||||
// Return value: error code, if any
|
||||
[PreserveSig]
|
||||
Int32 ParseDisplayName(
|
||||
int ParseDisplayName(
|
||||
IntPtr hwnd,
|
||||
IntPtr pbc,
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
|
@ -1240,7 +1240,7 @@ namespace SystemTrayMenu.Helper
|
|||
// identifier enumeration object and returning its IEnumIDList interface.
|
||||
// Return value: error code, if any
|
||||
[PreserveSig]
|
||||
Int32 EnumObjects(
|
||||
int EnumObjects(
|
||||
IntPtr hwnd,
|
||||
SHCONTF grfFlags,
|
||||
out IntPtr enumIDList);
|
||||
|
@ -1248,7 +1248,7 @@ namespace SystemTrayMenu.Helper
|
|||
// Retrieves an IShellFolder object for a subfolder.
|
||||
// Return value: error code, if any
|
||||
[PreserveSig]
|
||||
Int32 BindToObject(
|
||||
int BindToObject(
|
||||
IntPtr pidl,
|
||||
IntPtr pbc,
|
||||
ref Guid riid,
|
||||
|
@ -1257,7 +1257,7 @@ namespace SystemTrayMenu.Helper
|
|||
// Requests a pointer to an object's storage interface.
|
||||
// Return value: error code, if any
|
||||
[PreserveSig]
|
||||
Int32 BindToStorage(
|
||||
int BindToStorage(
|
||||
IntPtr pidl,
|
||||
IntPtr pbc,
|
||||
ref Guid riid,
|
||||
|
@ -1274,7 +1274,7 @@ namespace SystemTrayMenu.Helper
|
|||
// follow the second (pidl1 > pidl2). Zero A return value of zero
|
||||
// indicates that the two items are the same (pidl1 = pidl2).
|
||||
[PreserveSig]
|
||||
Int32 CompareIDs(
|
||||
int CompareIDs(
|
||||
IntPtr lParam,
|
||||
IntPtr pidl1,
|
||||
IntPtr pidl2);
|
||||
|
@ -1283,7 +1283,7 @@ namespace SystemTrayMenu.Helper
|
|||
// with a folder object.
|
||||
// Return value: error code, if any
|
||||
[PreserveSig]
|
||||
Int32 CreateViewObject(
|
||||
int CreateViewObject(
|
||||
IntPtr hwndOwner,
|
||||
Guid riid,
|
||||
out IntPtr ppv);
|
||||
|
@ -1291,7 +1291,7 @@ namespace SystemTrayMenu.Helper
|
|||
// Retrieves the attributes of one or more file objects or subfolders.
|
||||
// Return value: error code, if any
|
||||
[PreserveSig]
|
||||
Int32 GetAttributesOf(
|
||||
int GetAttributesOf(
|
||||
uint cidl,
|
||||
[MarshalAs(UnmanagedType.LPArray)]
|
||||
IntPtr[] apidl,
|
||||
|
@ -1301,7 +1301,7 @@ namespace SystemTrayMenu.Helper
|
|||
// specified file objects or folders.
|
||||
// Return value: error code, if any
|
||||
[PreserveSig]
|
||||
Int32 GetUIObjectOf(
|
||||
int GetUIObjectOf(
|
||||
IntPtr hwndOwner,
|
||||
uint cidl,
|
||||
[MarshalAs(UnmanagedType.LPArray)]
|
||||
|
@ -1313,7 +1313,7 @@ namespace SystemTrayMenu.Helper
|
|||
// Retrieves the display name for the specified file object or subfolder.
|
||||
// Return value: error code, if any
|
||||
[PreserveSig()]
|
||||
Int32 GetDisplayNameOf(
|
||||
int GetDisplayNameOf(
|
||||
IntPtr pidl,
|
||||
SHGNO uFlags,
|
||||
IntPtr lpName);
|
||||
|
@ -1322,7 +1322,7 @@ namespace SystemTrayMenu.Helper
|
|||
// identifier in the process.
|
||||
// Return value: error code, if any
|
||||
[PreserveSig]
|
||||
Int32 SetNameOf(
|
||||
int SetNameOf(
|
||||
IntPtr hwnd,
|
||||
IntPtr pidl,
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
|
@ -1340,7 +1340,7 @@ namespace SystemTrayMenu.Helper
|
|||
{
|
||||
// Adds commands to a shortcut menu
|
||||
[PreserveSig()]
|
||||
Int32 QueryContextMenu(
|
||||
int QueryContextMenu(
|
||||
IntPtr hmenu,
|
||||
uint iMenu,
|
||||
uint idCmdFirst,
|
||||
|
@ -1349,14 +1349,14 @@ namespace SystemTrayMenu.Helper
|
|||
|
||||
// Carries out the command associated with a shortcut menu item
|
||||
[PreserveSig()]
|
||||
Int32 InvokeCommand(
|
||||
int InvokeCommand(
|
||||
ref CMINVOKECOMMANDINFOEX info);
|
||||
|
||||
// Retrieves information about a shortcut menu command,
|
||||
// including the help string and the language-independent,
|
||||
// or canonical, name for the command
|
||||
[PreserveSig()]
|
||||
Int32 GetCommandString(
|
||||
int GetCommandString(
|
||||
uint idcmd,
|
||||
GCS uflags,
|
||||
uint reserved,
|
||||
|
@ -1371,7 +1371,7 @@ namespace SystemTrayMenu.Helper
|
|||
{
|
||||
// Adds commands to a shortcut menu
|
||||
[PreserveSig()]
|
||||
Int32 QueryContextMenu(
|
||||
int QueryContextMenu(
|
||||
IntPtr hmenu,
|
||||
uint iMenu,
|
||||
uint idCmdFirst,
|
||||
|
@ -1380,14 +1380,14 @@ namespace SystemTrayMenu.Helper
|
|||
|
||||
// Carries out the command associated with a shortcut menu item
|
||||
[PreserveSig()]
|
||||
Int32 InvokeCommand(
|
||||
int InvokeCommand(
|
||||
ref CMINVOKECOMMANDINFOEX info);
|
||||
|
||||
// Retrieves information about a shortcut menu command,
|
||||
// including the help string and the language-independent,
|
||||
// or canonical, name for the command
|
||||
[PreserveSig()]
|
||||
Int32 GetCommandString(
|
||||
int GetCommandString(
|
||||
uint idcmd,
|
||||
GCS uflags,
|
||||
uint reserved,
|
||||
|
@ -1398,7 +1398,7 @@ namespace SystemTrayMenu.Helper
|
|||
// Allows client objects of the IContextMenu interface to
|
||||
// handle messages associated with owner-drawn menu items
|
||||
[PreserveSig]
|
||||
Int32 HandleMenuMsg(
|
||||
int HandleMenuMsg(
|
||||
uint uMsg,
|
||||
IntPtr wParam,
|
||||
IntPtr lParam);
|
||||
|
@ -1410,7 +1410,7 @@ namespace SystemTrayMenu.Helper
|
|||
{
|
||||
// Adds commands to a shortcut menu
|
||||
[PreserveSig()]
|
||||
Int32 QueryContextMenu(
|
||||
int QueryContextMenu(
|
||||
IntPtr hmenu,
|
||||
uint iMenu,
|
||||
uint idCmdFirst,
|
||||
|
@ -1419,14 +1419,14 @@ namespace SystemTrayMenu.Helper
|
|||
|
||||
// Carries out the command associated with a shortcut menu item
|
||||
[PreserveSig()]
|
||||
Int32 InvokeCommand(
|
||||
int InvokeCommand(
|
||||
ref CMINVOKECOMMANDINFOEX info);
|
||||
|
||||
// Retrieves information about a shortcut menu command,
|
||||
// including the help string and the language-independent,
|
||||
// or canonical, name for the command
|
||||
[PreserveSig()]
|
||||
Int32 GetCommandString(
|
||||
int GetCommandString(
|
||||
uint idcmd,
|
||||
GCS uflags,
|
||||
uint reserved,
|
||||
|
@ -1437,7 +1437,7 @@ namespace SystemTrayMenu.Helper
|
|||
// Allows client objects of the IContextMenu interface to
|
||||
// handle messages associated with owner-drawn menu items
|
||||
[PreserveSig]
|
||||
Int32 HandleMenuMsg(
|
||||
int HandleMenuMsg(
|
||||
uint uMsg,
|
||||
IntPtr wParam,
|
||||
IntPtr lParam);
|
||||
|
@ -1445,7 +1445,7 @@ namespace SystemTrayMenu.Helper
|
|||
// Allows client objects of the IContextMenu3 interface to
|
||||
// handle messages associated with owner-drawn menu items
|
||||
[PreserveSig]
|
||||
Int32 HandleMenuMsg2(
|
||||
int HandleMenuMsg2(
|
||||
uint uMsg,
|
||||
IntPtr wParam,
|
||||
IntPtr lParam,
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace SystemTrayMenu.Helper
|
|||
internal class WindowsExplorerSort : IComparer<string>
|
||||
{
|
||||
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
|
||||
private static extern int StrCmpLogicalW(String x, String y);
|
||||
private static extern int StrCmpLogicalW(string x, string y);
|
||||
|
||||
public int Compare(string x, string y)
|
||||
{
|
||||
|
|
|
@ -18,13 +18,13 @@ namespace SystemTrayMenu
|
|||
private enum OpenCloseState { Default, Opening, Closing };
|
||||
|
||||
private OpenCloseState openCloseState = OpenCloseState.Default;
|
||||
private MessageFilter messageFilter = new MessageFilter();
|
||||
private MenuNotifyIcon menuNotifyIcon = null;
|
||||
private Menu[] menus = new Menu[MenuDefines.MenusMax];
|
||||
private BackgroundWorker worker = new BackgroundWorker();
|
||||
private Screen screen = Screen.PrimaryScreen;
|
||||
private WaitFastLeave fastLeave = new WaitFastLeave();
|
||||
private KeyboardInput keyboardInput;
|
||||
private readonly MessageFilter messageFilter = new MessageFilter();
|
||||
private readonly MenuNotifyIcon menuNotifyIcon = null;
|
||||
private readonly Menu[] menus = new Menu[MenuDefines.MenusMax];
|
||||
private readonly BackgroundWorker worker = new BackgroundWorker();
|
||||
private readonly Screen screen = Screen.PrimaryScreen;
|
||||
private readonly WaitFastLeave fastLeave = new WaitFastLeave();
|
||||
private readonly KeyboardInput keyboardInput;
|
||||
private DataGridView dgvFromLastMouseEvent = null;
|
||||
private DataGridViewCellEventArgs cellEventArgsFromLastMouseEvent = null;
|
||||
private int clicksInQueue = 0;
|
||||
|
|
Loading…
Reference in a new issue