mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-02 10:34:42 +12:00
[Feature] CodeBuity&Refactor #49
This commit is contained in:
parent
d4362bbef4
commit
64c3653107
|
@ -231,7 +231,7 @@ namespace SystemTrayMenu.Controls
|
|||
}
|
||||
|
||||
|
||||
#warning CodeBuity&Refactor #49 - sort this class and check for duplicated
|
||||
#warning CodeBeauty&Refactor #49 - sort this class and check for duplicated
|
||||
|
||||
public event Action<object, EventArgs> OpenMenu;
|
||||
|
||||
|
@ -362,7 +362,7 @@ namespace SystemTrayMenu.Controls
|
|||
{
|
||||
IsContextMenuOpen = true;
|
||||
|
||||
#warning CodeBuity&Refactor #49 is there any other possiblity to raise selection changed event? dataGridView.ClearSelection(); seems to overwrite selected
|
||||
#warning CodeBeauty&Refactor #49 is there any other possiblity to raise selection changed event? dataGridView.ClearSelection(); seems to overwrite selected
|
||||
IsSelected = true;
|
||||
dgv.Rows[RowIndex].Selected = true;
|
||||
|
||||
|
@ -466,7 +466,7 @@ namespace SystemTrayMenu.Controls
|
|||
row.Tag = data;
|
||||
}
|
||||
|
||||
#warning CodeBuity&Refactor #49 either not public and as inline method or we want probably to move that code somewhere else
|
||||
#warning CodeBeauty&Refactor #49 either not public and as inline method or we want probably to move that code somewhere else
|
||||
public Icon AddIconOverlay(Icon originalIcon, Icon overlay)
|
||||
{
|
||||
var target = new Bitmap(originalIcon.Width, originalIcon.Height, PixelFormat.Format32bppArgb);
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace SystemTrayMenu.Handler
|
|||
{
|
||||
isStillSelected = true;
|
||||
menuFromSelected = rowData.SubMenu;
|
||||
#warning CodeBuity&Refactor #49 refactor datagridviewrow get
|
||||
#warning CodeBeauty&Refactor #49 refactor datagridviewrow get
|
||||
textselected = dgv.Rows[iRowKey].
|
||||
Cells[1].Value.ToString();
|
||||
}
|
||||
|
|
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.9.2.5")]
|
||||
[assembly: AssemblyFileVersion("0.9.2.5")]
|
||||
[assembly: AssemblyVersion("0.9.2.6")]
|
||||
[assembly: AssemblyFileVersion("0.9.2.6")]
|
||||
|
|
|
@ -15,20 +15,15 @@ namespace SystemTrayMenu
|
|||
{
|
||||
class SystemTrayMenu : IDisposable
|
||||
{
|
||||
MessageFilter messageFilter = new MessageFilter();
|
||||
bool messageFilterAdded = false;
|
||||
|
||||
MenuNotifyIcon menuNotifyIcon = null;
|
||||
WaitFastLeave fastLeave = new WaitFastLeave();
|
||||
Menu[] menus = new Menu[MenuDefines.MenusMax];
|
||||
KeyboardInput keyboardInput;
|
||||
|
||||
enum OpenCloseState { Default, Opening, Closing };
|
||||
OpenCloseState openCloseState = OpenCloseState.Default;
|
||||
|
||||
MessageFilter messageFilter = new MessageFilter();
|
||||
MenuNotifyIcon menuNotifyIcon = null;
|
||||
Menu[] menus = new Menu[MenuDefines.MenusMax];
|
||||
BackgroundWorker worker = new BackgroundWorker();
|
||||
Screen screen = Screen.PrimaryScreen;
|
||||
|
||||
WaitFastLeave fastLeave = new WaitFastLeave();
|
||||
KeyboardInput keyboardInput;
|
||||
DataGridView dgvFromLastMouseEvent = null;
|
||||
DataGridViewCellEventArgs cellEventArgsFromLastMouseEvent = null;
|
||||
|
||||
|
@ -40,7 +35,7 @@ namespace SystemTrayMenu
|
|||
|
||||
keyboardInput = new KeyboardInput(menus);
|
||||
keyboardInput.RegisterHotKey();
|
||||
keyboardInput.HotKeyPressed -= SwitchOpenClose;
|
||||
keyboardInput.HotKeyPressed += SwitchOpenClose;
|
||||
keyboardInput.ClosePressed += MenusFadeOut;
|
||||
keyboardInput.RowSelected += KeyboardInputRowSelected;
|
||||
void KeyboardInputRowSelected(DataGridView dgv, int rowIndex)
|
||||
|
@ -266,12 +261,12 @@ namespace SystemTrayMenu
|
|||
|
||||
foreach (Menu menu in Menus().Where(m=>m.Level > 0))
|
||||
{
|
||||
// -1*2 padding
|
||||
int newWith = (menu.Width - 2 + menuPredecessor.Width);
|
||||
int newWith = (menu.Width -
|
||||
menu.Padding.Horizontal + menuPredecessor.Width);
|
||||
if (directionToRight)
|
||||
{
|
||||
#warning CodeBuity&Refactor #49 is this still correct?
|
||||
if (widthPredecessors - menu.Width <= -2) // -1*2 padding
|
||||
if (widthPredecessors - menu.Width <=
|
||||
-menu.Padding.Horizontal)
|
||||
{
|
||||
directionToRight = false;
|
||||
}
|
||||
|
@ -289,7 +284,7 @@ namespace SystemTrayMenu
|
|||
|
||||
menu.AdjustLocationAndSize(heightMax,
|
||||
widthPredecessors, menuPredecessor);
|
||||
widthPredecessors += menu.Width - 1; // -1 padding
|
||||
widthPredecessors += menu.Width - menu.Padding.Left;
|
||||
menuPredecessor = menu;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue