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))
|
||||
{
|
||||
pathOK = true;
|
||||
Properties.Settings.Default.PathDirectory =
|
||||
Properties.Settings.Default.PathDirectory =
|
||||
dialog.FileName;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace SystemTrayMenu.Controls
|
|||
Name = "changeLanguage",
|
||||
Text = Program.Translate("Language")
|
||||
};
|
||||
foreach (CultureInfo cultureInfo in
|
||||
foreach (CultureInfo cultureInfo in
|
||||
GetCultureList(CultureTypes.AllCultures))
|
||||
{
|
||||
if (Program.Languages.Contains(cultureInfo.Name))
|
||||
|
|
|
@ -1,18 +1,11 @@
|
|||
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;
|
||||
|
||||
namespace SystemTrayMenu.Controls
|
||||
{
|
||||
public partial class DragDropHintForm : Form
|
||||
{
|
||||
public DragDropHintForm(string hintTitle, string hintText,
|
||||
public DragDropHintForm(string hintTitle, string hintText,
|
||||
string buttonOk)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
|
@ -156,9 +156,9 @@ namespace SystemTrayMenu
|
|||
{
|
||||
DataGridViewElementStates states = DataGridViewElementStates.None;
|
||||
dgv.AutoResizeRows();
|
||||
int height = (int)(dgv.Rows.GetRowsHeight(states));
|
||||
int heightMax = screen.Bounds.Height -
|
||||
new Taskbar().Size.Height -
|
||||
int height = (int)(dgv.Rows.GetRowsHeight(states));
|
||||
int heightMax = screen.Bounds.Height -
|
||||
new Taskbar().Size.Height -
|
||||
labelTitle.Height;
|
||||
if (height > heightMax)
|
||||
{
|
||||
|
@ -185,8 +185,8 @@ namespace SystemTrayMenu
|
|||
this.dgv.Height = height;
|
||||
|
||||
AdjustDataGridViewSize();
|
||||
int x = menuPredecessor.Location.X - Width +
|
||||
(int)Math.Round(Program.ScalingFactor, 0,
|
||||
int x = menuPredecessor.Location.X - Width +
|
||||
(int)Math.Round(Program.ScalingFactor, 0,
|
||||
MidpointRounding.AwayFromZero);
|
||||
|
||||
RowData trigger = (RowData)Tag;
|
||||
|
|
|
@ -1,31 +1,18 @@
|
|||
using Clearcove.Logging;
|
||||
using IWshRuntimeLibrary;
|
||||
using System;
|
||||
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
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SystemTrayMenu.Controls
|
||||
{
|
||||
public enum MenuDataValidity
|
||||
{
|
||||
Valid,
|
||||
Invalid,
|
||||
NoAccess
|
||||
}
|
||||
|
||||
public struct MenuData
|
||||
{
|
||||
public List<RowData> RowDatas;
|
||||
public MenuDataValidity Validity;
|
||||
public int Level;
|
||||
};
|
||||
}
|
||||
|
||||
public struct MenuData
|
||||
{
|
||||
public List<RowData> RowDatas;
|
||||
public MenuDataValidity Validity;
|
||||
public int Level;
|
||||
};
|
||||
}
|
|
@ -306,7 +306,7 @@ namespace SystemTrayMenu.Controls
|
|||
// FlatAppearance.BorderColor = BackColor;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ namespace SystemTrayMenu.Controls
|
|||
waitMenuOpen.Click();
|
||||
}
|
||||
|
||||
if (e == null ||
|
||||
if (e == null ||
|
||||
e.Button == MouseButtons.Left &&
|
||||
!ContainsMenu)
|
||||
{
|
||||
|
@ -386,7 +386,7 @@ namespace SystemTrayMenu.Controls
|
|||
ShellContextMenu ctxMnu = new ShellContextMenu();
|
||||
Point location = dgv.FindForm().Location;
|
||||
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);
|
||||
if (ContainsMenu)
|
||||
{
|
||||
|
@ -474,7 +474,7 @@ namespace SystemTrayMenu.Controls
|
|||
cellIcon.Value = data.Icon;
|
||||
}
|
||||
|
||||
DataGridViewTextBoxCell cellName =
|
||||
DataGridViewTextBoxCell cellName =
|
||||
(DataGridViewTextBoxCell)row.Cells[1];
|
||||
cellName.Value = data.Text;
|
||||
|
||||
|
@ -488,7 +488,7 @@ namespace SystemTrayMenu.Controls
|
|||
var graphics = Graphics.FromImage(target);
|
||||
graphics.DrawIcon(originalIcon, 0, 0);
|
||||
graphics.DrawIcon(overlay, 0, 0);
|
||||
target.MakeTransparent(target.GetPixel(1,1));
|
||||
target.MakeTransparent(target.GetPixel(1, 1));
|
||||
return Icon.FromHandle(target.GetHicon());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Microsoft.Win32;
|
||||
using System;
|
||||
|
||||
namespace SystemTrayMenu.Helper
|
||||
{
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace SystemTrayMenu.Helper
|
|||
log.Info($"directoryPath:'{directoryPath}'");
|
||||
log.Error($"{ex.ToString()}");
|
||||
}
|
||||
|
||||
|
||||
// Cleanup
|
||||
User32.DestroyIcon(shfi.hIcon);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SystemTrayMenu.Helper
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace SystemTrayMenu
|
|||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
|
||||
[DllImport("shell32.dll", SetLastError = true)]
|
||||
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 LengthMax = 37;
|
||||
public const int ButtonTextPaddingLeft = 18;
|
||||
public const int ButtonTextPaddingRight= 12;
|
||||
public const int ButtonTextPaddingRight = 12;
|
||||
|
||||
public const int Scrollspeed = 4;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Clearcove.Logging;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
@ -55,7 +54,7 @@ namespace SystemTrayMenu
|
|||
try
|
||||
{
|
||||
bool cancelAppRun = false;
|
||||
using (SystemTrayMenuHandler stm =
|
||||
using (SystemTrayMenuHandler stm =
|
||||
new SystemTrayMenuHandler(ref cancelAppRun))
|
||||
{
|
||||
if (!cancelAppRun)
|
||||
|
|
|
@ -425,7 +425,7 @@ namespace SystemTrayMenu
|
|||
// 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:
|
||||
// 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;
|
||||
|
||||
HideHiddenEntries = !iShellDispatch4.GetSetting(SSF_SHOWALLOBJECTS);
|
||||
|
@ -487,9 +487,9 @@ namespace SystemTrayMenu
|
|||
|
||||
try
|
||||
{
|
||||
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("thumbs.db", StringComparison.OrdinalIgnoreCase) // Windows thumbnail cache
|
||||
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("thumbs.db", StringComparison.OrdinalIgnoreCase) // Windows thumbnail cache
|
||||
).ToArray();
|
||||
Array.Sort(files, new WindowsExplorerSort());
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ namespace SystemTrayMenu
|
|||
private void CheckMenuOpenerStop(int menuIndex, int rowIndex, DataGridView dgv = null)
|
||||
{
|
||||
Menu menu = menus[menuIndex];
|
||||
if (menu != null &&
|
||||
if (menu != null &&
|
||||
rowIndex > -1)
|
||||
{
|
||||
if (dgv == null)
|
||||
|
@ -698,13 +698,13 @@ namespace SystemTrayMenu
|
|||
RowData rowData = (RowData)row.Tag;
|
||||
if (rowData.IsSelectedByKeyboard)
|
||||
{
|
||||
row.DefaultCellStyle.SelectionBackColor =
|
||||
row.DefaultCellStyle.SelectionBackColor =
|
||||
MenuDefines.KeyBoardSelection;
|
||||
row.Selected = true;
|
||||
}
|
||||
else if (rowData.IsSelected)
|
||||
{
|
||||
row.DefaultCellStyle.SelectionBackColor =
|
||||
row.DefaultCellStyle.SelectionBackColor =
|
||||
MenuDefines.FolderOpen;
|
||||
row.Selected = true;
|
||||
}
|
||||
|
@ -829,7 +829,7 @@ namespace SystemTrayMenu
|
|||
|
||||
private bool IsAnyMenuSelectedByKey(
|
||||
ref DataGridView dgv,
|
||||
ref Menu menuFromSelected,
|
||||
ref Menu menuFromSelected,
|
||||
ref string textselected)
|
||||
{
|
||||
Menu menu = menus[iMenuKey];
|
||||
|
@ -933,7 +933,7 @@ namespace SystemTrayMenu
|
|||
if (SelectMatched(dgv, iRowKey) ||
|
||||
SelectMatched(dgv, 0))
|
||||
{
|
||||
CheckMenuOpenerStop(iMenuBefore,
|
||||
CheckMenuOpenerStop(iMenuBefore,
|
||||
iRowBefore, dgvBefore);
|
||||
CheckMenuOpenerStart(dgv, iRowKey);
|
||||
toClear = true;
|
||||
|
@ -1031,10 +1031,10 @@ namespace SystemTrayMenu
|
|||
{
|
||||
ClearIsSelectedByKey(iMenuBefore, iRowBefore);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private bool SelectMatched(DataGridView dgv,
|
||||
private bool SelectMatched(DataGridView dgv,
|
||||
int indexStart, string keyInput = "")
|
||||
{
|
||||
bool found = false;
|
||||
|
@ -1049,7 +1049,7 @@ namespace SystemTrayMenu
|
|||
return found;
|
||||
}
|
||||
|
||||
private bool SelectMatchedReverse(DataGridView dgv,
|
||||
private bool SelectMatchedReverse(DataGridView dgv,
|
||||
int indexStart, string keyInput = "")
|
||||
{
|
||||
bool found = false;
|
||||
|
@ -1064,7 +1064,7 @@ namespace SystemTrayMenu
|
|||
return found;
|
||||
}
|
||||
|
||||
private bool Select(DataGridView dgv, int i,
|
||||
private bool Select(DataGridView dgv, int i,
|
||||
string keyInput = "")
|
||||
{
|
||||
bool found = false;
|
||||
|
@ -1085,14 +1085,14 @@ namespace SystemTrayMenu
|
|||
{
|
||||
dgv.FirstDisplayedScrollingRowIndex = row.Index;
|
||||
}
|
||||
else if(row.Index >=
|
||||
dgv.FirstDisplayedScrollingRowIndex +
|
||||
else if (row.Index >=
|
||||
dgv.FirstDisplayedScrollingRowIndex +
|
||||
dgv.DisplayedRowCount(false))
|
||||
{
|
||||
dgv.FirstDisplayedScrollingRowIndex = row.Index -
|
||||
dgv.DisplayedRowCount(false) + 1;
|
||||
}
|
||||
|
||||
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue