mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-30 03:51:14 +12:00
run visual studio code Cleanup
This commit is contained in:
parent
0e38067e79
commit
4a294c7d76
|
@ -61,7 +61,7 @@ namespace SystemTrayMenu
|
||||||
if (Directory.Exists(dialog.FileName))
|
if (Directory.Exists(dialog.FileName))
|
||||||
{
|
{
|
||||||
pathOK = true;
|
pathOK = true;
|
||||||
Properties.Settings.Default.PathDirectory =
|
Properties.Settings.Default.PathDirectory =
|
||||||
dialog.FileName;
|
dialog.FileName;
|
||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace SystemTrayMenu.Controls
|
||||||
Name = "changeLanguage",
|
Name = "changeLanguage",
|
||||||
Text = Program.Translate("Language")
|
Text = Program.Translate("Language")
|
||||||
};
|
};
|
||||||
foreach (CultureInfo cultureInfo in
|
foreach (CultureInfo cultureInfo in
|
||||||
GetCultureList(CultureTypes.AllCultures))
|
GetCultureList(CultureTypes.AllCultures))
|
||||||
{
|
{
|
||||||
if (Program.Languages.Contains(cultureInfo.Name))
|
if (Program.Languages.Contains(cultureInfo.Name))
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace SystemTrayMenu.Controls
|
namespace SystemTrayMenu.Controls
|
||||||
{
|
{
|
||||||
public partial class DragDropHintForm : Form
|
public partial class DragDropHintForm : Form
|
||||||
{
|
{
|
||||||
public DragDropHintForm(string hintTitle, string hintText,
|
public DragDropHintForm(string hintTitle, string hintText,
|
||||||
string buttonOk)
|
string buttonOk)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
|
@ -156,9 +156,9 @@ namespace SystemTrayMenu
|
||||||
{
|
{
|
||||||
DataGridViewElementStates states = DataGridViewElementStates.None;
|
DataGridViewElementStates states = DataGridViewElementStates.None;
|
||||||
dgv.AutoResizeRows();
|
dgv.AutoResizeRows();
|
||||||
int height = (int)(dgv.Rows.GetRowsHeight(states));
|
int height = (int)(dgv.Rows.GetRowsHeight(states));
|
||||||
int heightMax = screen.Bounds.Height -
|
int heightMax = screen.Bounds.Height -
|
||||||
new Taskbar().Size.Height -
|
new Taskbar().Size.Height -
|
||||||
labelTitle.Height;
|
labelTitle.Height;
|
||||||
if (height > heightMax)
|
if (height > heightMax)
|
||||||
{
|
{
|
||||||
|
@ -185,8 +185,8 @@ namespace SystemTrayMenu
|
||||||
this.dgv.Height = height;
|
this.dgv.Height = height;
|
||||||
|
|
||||||
AdjustDataGridViewSize();
|
AdjustDataGridViewSize();
|
||||||
int x = menuPredecessor.Location.X - Width +
|
int x = menuPredecessor.Location.X - Width +
|
||||||
(int)Math.Round(Program.ScalingFactor, 0,
|
(int)Math.Round(Program.ScalingFactor, 0,
|
||||||
MidpointRounding.AwayFromZero);
|
MidpointRounding.AwayFromZero);
|
||||||
|
|
||||||
RowData trigger = (RowData)Tag;
|
RowData trigger = (RowData)Tag;
|
||||||
|
|
|
@ -1,31 +1,18 @@
|
||||||
using Clearcove.Logging;
|
using System.Collections.Generic;
|
||||||
using IWshRuntimeLibrary;
|
|
||||||
using System;
|
namespace SystemTrayMenu.Controls
|
||||||
using System.Collections.Generic;
|
{
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using SystemTrayMenu.Helper;
|
|
||||||
using TAFactory.IconPack;
|
|
||||||
|
|
||||||
namespace SystemTrayMenu.Controls
|
|
||||||
{
|
|
||||||
public enum MenuDataValidity
|
public enum MenuDataValidity
|
||||||
{
|
{
|
||||||
Valid,
|
Valid,
|
||||||
Invalid,
|
Invalid,
|
||||||
NoAccess
|
NoAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct MenuData
|
public struct MenuData
|
||||||
{
|
{
|
||||||
public List<RowData> RowDatas;
|
public List<RowData> RowDatas;
|
||||||
public MenuDataValidity Validity;
|
public MenuDataValidity Validity;
|
||||||
public int Level;
|
public int Level;
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -306,7 +306,7 @@ namespace SystemTrayMenu.Controls
|
||||||
// FlatAppearance.BorderColor = BackColor;
|
// FlatAppearance.BorderColor = BackColor;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ namespace SystemTrayMenu.Controls
|
||||||
waitMenuOpen.Click();
|
waitMenuOpen.Click();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e == null ||
|
if (e == null ||
|
||||||
e.Button == MouseButtons.Left &&
|
e.Button == MouseButtons.Left &&
|
||||||
!ContainsMenu)
|
!ContainsMenu)
|
||||||
{
|
{
|
||||||
|
@ -386,7 +386,7 @@ namespace SystemTrayMenu.Controls
|
||||||
ShellContextMenu ctxMnu = new ShellContextMenu();
|
ShellContextMenu ctxMnu = new ShellContextMenu();
|
||||||
Point location = dgv.FindForm().Location;
|
Point location = dgv.FindForm().Location;
|
||||||
Point point = new Point(
|
Point point = new Point(
|
||||||
e.X + location.X + dgv.Location.X,
|
e.X + location.X + dgv.Location.X,
|
||||||
e.Y + location.Y + dgv.Location.Y);
|
e.Y + location.Y + dgv.Location.Y);
|
||||||
if (ContainsMenu)
|
if (ContainsMenu)
|
||||||
{
|
{
|
||||||
|
@ -474,7 +474,7 @@ namespace SystemTrayMenu.Controls
|
||||||
cellIcon.Value = data.Icon;
|
cellIcon.Value = data.Icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataGridViewTextBoxCell cellName =
|
DataGridViewTextBoxCell cellName =
|
||||||
(DataGridViewTextBoxCell)row.Cells[1];
|
(DataGridViewTextBoxCell)row.Cells[1];
|
||||||
cellName.Value = data.Text;
|
cellName.Value = data.Text;
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ namespace SystemTrayMenu.Controls
|
||||||
var graphics = Graphics.FromImage(target);
|
var graphics = Graphics.FromImage(target);
|
||||||
graphics.DrawIcon(originalIcon, 0, 0);
|
graphics.DrawIcon(originalIcon, 0, 0);
|
||||||
graphics.DrawIcon(overlay, 0, 0);
|
graphics.DrawIcon(overlay, 0, 0);
|
||||||
target.MakeTransparent(target.GetPixel(1,1));
|
target.MakeTransparent(target.GetPixel(1, 1));
|
||||||
return Icon.FromHandle(target.GetHicon());
|
return Icon.FromHandle(target.GetHicon());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace SystemTrayMenu.Helper
|
namespace SystemTrayMenu.Helper
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace SystemTrayMenu.Helper
|
||||||
log.Info($"directoryPath:'{directoryPath}'");
|
log.Info($"directoryPath:'{directoryPath}'");
|
||||||
log.Error($"{ex.ToString()}");
|
log.Error($"{ex.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
User32.DestroyIcon(shfi.hIcon);
|
User32.DestroyIcon(shfi.hIcon);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Drawing;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace SystemTrayMenu.Helper
|
namespace SystemTrayMenu.Helper
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace SystemTrayMenu
|
||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("shell32.dll", SetLastError = true)]
|
[DllImport("shell32.dll", SetLastError = true)]
|
||||||
public static extern IntPtr SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData);
|
public static extern IntPtr SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace SystemTrayMenu
|
||||||
public const int MenuRowsHeight = 18;
|
public const int MenuRowsHeight = 18;
|
||||||
public const int LengthMax = 37;
|
public const int LengthMax = 37;
|
||||||
public const int ButtonTextPaddingLeft = 18;
|
public const int ButtonTextPaddingLeft = 18;
|
||||||
public const int ButtonTextPaddingRight= 12;
|
public const int ButtonTextPaddingRight = 12;
|
||||||
|
|
||||||
public const int Scrollspeed = 4;
|
public const int Scrollspeed = 4;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using Clearcove.Logging;
|
using Clearcove.Logging;
|
||||||
using Microsoft.Win32;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
@ -55,7 +54,7 @@ namespace SystemTrayMenu
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool cancelAppRun = false;
|
bool cancelAppRun = false;
|
||||||
using (SystemTrayMenuHandler stm =
|
using (SystemTrayMenuHandler stm =
|
||||||
new SystemTrayMenuHandler(ref cancelAppRun))
|
new SystemTrayMenuHandler(ref cancelAppRun))
|
||||||
{
|
{
|
||||||
if (!cancelAppRun)
|
if (!cancelAppRun)
|
||||||
|
|
|
@ -425,7 +425,7 @@ namespace SystemTrayMenu
|
||||||
// Using SHGetSetSettings would be much better in performance but the results are not accurate.
|
// Using SHGetSetSettings would be much better in performance but the results are not accurate.
|
||||||
// We have to go for the shell interface in order to receive the correct settings:
|
// We have to go for the shell interface in order to receive the correct settings:
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/shell/ishelldispatch4-getsetting
|
// https://docs.microsoft.com/en-us/windows/win32/shell/ishelldispatch4-getsetting
|
||||||
const int SSF_SHOWALLOBJECTS = 0x00000001;
|
const int SSF_SHOWALLOBJECTS = 0x00000001;
|
||||||
const int SSF_SHOWSUPERHIDDEN = 0x00040000;
|
const int SSF_SHOWSUPERHIDDEN = 0x00040000;
|
||||||
|
|
||||||
HideHiddenEntries = !iShellDispatch4.GetSetting(SSF_SHOWALLOBJECTS);
|
HideHiddenEntries = !iShellDispatch4.GetSetting(SSF_SHOWALLOBJECTS);
|
||||||
|
@ -487,9 +487,9 @@ namespace SystemTrayMenu
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
files = Directory.GetFiles(path). Where(p =>
|
files = Directory.GetFiles(path).Where(p =>
|
||||||
!Path.GetFileName(p).Equals("desktop.ini", StringComparison.OrdinalIgnoreCase) && // Windows folder settings, e.g. Win10 "desktop.ini", Win2003 "Desktop.ini"
|
!Path.GetFileName(p).Equals("desktop.ini", StringComparison.OrdinalIgnoreCase) && // Windows folder settings, e.g. Win10 "desktop.ini", Win2003 "Desktop.ini"
|
||||||
!Path.GetFileName(p).Equals("thumbs.db", StringComparison.OrdinalIgnoreCase) // Windows thumbnail cache
|
!Path.GetFileName(p).Equals("thumbs.db", StringComparison.OrdinalIgnoreCase) // Windows thumbnail cache
|
||||||
).ToArray();
|
).ToArray();
|
||||||
Array.Sort(files, new WindowsExplorerSort());
|
Array.Sort(files, new WindowsExplorerSort());
|
||||||
}
|
}
|
||||||
|
@ -649,7 +649,7 @@ namespace SystemTrayMenu
|
||||||
private void CheckMenuOpenerStop(int menuIndex, int rowIndex, DataGridView dgv = null)
|
private void CheckMenuOpenerStop(int menuIndex, int rowIndex, DataGridView dgv = null)
|
||||||
{
|
{
|
||||||
Menu menu = menus[menuIndex];
|
Menu menu = menus[menuIndex];
|
||||||
if (menu != null &&
|
if (menu != null &&
|
||||||
rowIndex > -1)
|
rowIndex > -1)
|
||||||
{
|
{
|
||||||
if (dgv == null)
|
if (dgv == null)
|
||||||
|
@ -698,13 +698,13 @@ namespace SystemTrayMenu
|
||||||
RowData rowData = (RowData)row.Tag;
|
RowData rowData = (RowData)row.Tag;
|
||||||
if (rowData.IsSelectedByKeyboard)
|
if (rowData.IsSelectedByKeyboard)
|
||||||
{
|
{
|
||||||
row.DefaultCellStyle.SelectionBackColor =
|
row.DefaultCellStyle.SelectionBackColor =
|
||||||
MenuDefines.KeyBoardSelection;
|
MenuDefines.KeyBoardSelection;
|
||||||
row.Selected = true;
|
row.Selected = true;
|
||||||
}
|
}
|
||||||
else if (rowData.IsSelected)
|
else if (rowData.IsSelected)
|
||||||
{
|
{
|
||||||
row.DefaultCellStyle.SelectionBackColor =
|
row.DefaultCellStyle.SelectionBackColor =
|
||||||
MenuDefines.FolderOpen;
|
MenuDefines.FolderOpen;
|
||||||
row.Selected = true;
|
row.Selected = true;
|
||||||
}
|
}
|
||||||
|
@ -829,7 +829,7 @@ namespace SystemTrayMenu
|
||||||
|
|
||||||
private bool IsAnyMenuSelectedByKey(
|
private bool IsAnyMenuSelectedByKey(
|
||||||
ref DataGridView dgv,
|
ref DataGridView dgv,
|
||||||
ref Menu menuFromSelected,
|
ref Menu menuFromSelected,
|
||||||
ref string textselected)
|
ref string textselected)
|
||||||
{
|
{
|
||||||
Menu menu = menus[iMenuKey];
|
Menu menu = menus[iMenuKey];
|
||||||
|
@ -933,7 +933,7 @@ namespace SystemTrayMenu
|
||||||
if (SelectMatched(dgv, iRowKey) ||
|
if (SelectMatched(dgv, iRowKey) ||
|
||||||
SelectMatched(dgv, 0))
|
SelectMatched(dgv, 0))
|
||||||
{
|
{
|
||||||
CheckMenuOpenerStop(iMenuBefore,
|
CheckMenuOpenerStop(iMenuBefore,
|
||||||
iRowBefore, dgvBefore);
|
iRowBefore, dgvBefore);
|
||||||
CheckMenuOpenerStart(dgv, iRowKey);
|
CheckMenuOpenerStart(dgv, iRowKey);
|
||||||
toClear = true;
|
toClear = true;
|
||||||
|
@ -1031,10 +1031,10 @@ namespace SystemTrayMenu
|
||||||
{
|
{
|
||||||
ClearIsSelectedByKey(iMenuBefore, iRowBefore);
|
ClearIsSelectedByKey(iMenuBefore, iRowBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectMatched(DataGridView dgv,
|
private bool SelectMatched(DataGridView dgv,
|
||||||
int indexStart, string keyInput = "")
|
int indexStart, string keyInput = "")
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -1049,7 +1049,7 @@ namespace SystemTrayMenu
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectMatchedReverse(DataGridView dgv,
|
private bool SelectMatchedReverse(DataGridView dgv,
|
||||||
int indexStart, string keyInput = "")
|
int indexStart, string keyInput = "")
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -1064,7 +1064,7 @@ namespace SystemTrayMenu
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool Select(DataGridView dgv, int i,
|
private bool Select(DataGridView dgv, int i,
|
||||||
string keyInput = "")
|
string keyInput = "")
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
@ -1085,14 +1085,14 @@ namespace SystemTrayMenu
|
||||||
{
|
{
|
||||||
dgv.FirstDisplayedScrollingRowIndex = row.Index;
|
dgv.FirstDisplayedScrollingRowIndex = row.Index;
|
||||||
}
|
}
|
||||||
else if(row.Index >=
|
else if (row.Index >=
|
||||||
dgv.FirstDisplayedScrollingRowIndex +
|
dgv.FirstDisplayedScrollingRowIndex +
|
||||||
dgv.DisplayedRowCount(false))
|
dgv.DisplayedRowCount(false))
|
||||||
{
|
{
|
||||||
dgv.FirstDisplayedScrollingRowIndex = row.Index -
|
dgv.FirstDisplayedScrollingRowIndex = row.Index -
|
||||||
dgv.DisplayedRowCount(false) + 1;
|
dgv.DisplayedRowCount(false) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue