@@ -35,6 +35,25 @@ public partial class Form1 : Form
3535 private AutoSplitterCoreInterface InterfaceASC ;
3636 #endregion
3737
38+ #region ToolBar
39+ private ContextMenuStrip trayMenu = new ContextMenuStrip ( ) ;
40+ private bool CloseOnTry = false ;
41+
42+ private void ShowMainForm ( )
43+ {
44+ Show ( ) ;
45+ WindowState = FormWindowState . Normal ;
46+ }
47+
48+ private void CloseHCM ( )
49+ {
50+ notifyIconToolBar . Visible = false ;
51+ CloseOnTry = true ;
52+ Application . Exit ( ) ;
53+ }
54+
55+ #endregion
56+
3857 public readonly Shortcuts sc ;
3958
4059 private bool SettingsDialogOpen = false ;
@@ -89,11 +108,67 @@ private void Form1_Load(object sender, EventArgs e)
89108
90109 #endregion
91110
111+ #region ToolBar
112+ trayMenu . Items . Add ( "Open HCM" , null , ( s , e ) => ShowMainForm ( ) ) ;
113+
114+ // Timer
115+ var timerMenu = new ToolStripMenuItem ( "Timer" ) ;
116+ timerMenu . DropDownItems . Add ( "StartTimer" , null , ( s , e ) => StartStopTimer ( true ) ) ;
117+ timerMenu . DropDownItems . Add ( "StopTimer" , null , ( s , e ) => StartStopTimer ( false ) ) ;
118+ trayMenu . Items . Add ( timerMenu ) ;
119+
120+ // Hit
121+ var hitMenu = new ToolStripMenuItem ( "Hit" ) ;
122+
123+ var wayMenu = new ToolStripMenuItem ( "Way" ) ;
124+ wayMenu . DropDownItems . Add ( "Increase" , null , ( s , e ) => btnWayHit_Click ( null , null ) ) ;
125+ wayMenu . DropDownItems . Add ( "Decrease" , null , ( s , e ) => btnWayHitUndo_Click ( null , null ) ) ;
126+ hitMenu . DropDownItems . Add ( wayMenu ) ;
127+
128+ var bossMenu = new ToolStripMenuItem ( "Boss" ) ;
129+ bossMenu . DropDownItems . Add ( "Increase" , null , ( s , e ) => btnHit_Click ( null , null ) ) ;
130+ bossMenu . DropDownItems . Add ( "Decrease" , null , ( s , e ) => btnHitUndo_Click ( null , null ) ) ;
131+ hitMenu . DropDownItems . Add ( bossMenu ) ;
132+
133+ trayMenu . Items . Add ( hitMenu ) ;
134+
135+ // Split
136+ var splitMenu = new ToolStripMenuItem ( "Split" ) ;
137+ splitMenu . DropDownItems . Add ( "Reset Run" , null , ( s , e ) => btnReset_Click ( null , null ) ) ;
138+ splitMenu . DropDownItems . Add ( "Next Split" , null , ( s , e ) => btnSplit_Click ( null , null ) ) ;
139+ splitMenu . DropDownItems . Add ( "Previous Split" , null , ( s , e ) => btnSplitPrev_Click ( null , null ) ) ;
140+ trayMenu . Items . Add ( splitMenu ) ;
141+
142+ // Close HCM
143+ trayMenu . Items . Add ( "Close HCM" , null , ( s , e ) => CloseHCM ( ) ) ;
144+
145+ // NotifyIcon
146+ notifyIconToolBar . ContextMenuStrip = trayMenu ;
147+ notifyIconToolBar . DoubleClick += ( s , e ) => ShowMainForm ( ) ;
148+ notifyIconToolBar . Visible = true ;
149+ #endregion
150+
92151 this . UpdateDarkMode ( ) ;
93152 }
94153
95154 private void Form1_FormClosing ( object sender , FormClosingEventArgs e )
96155 {
156+ if ( ! CloseOnTry )
157+ {
158+ var resultMinimize = MessageBox . Show (
159+ "Do you want to minimize to the taskbar or close the program?\n Yes = Minimize - No = Close" ,
160+ "Exit" ,
161+ MessageBoxButtons . YesNo ,
162+ MessageBoxIcon . Question ) ;
163+
164+ if ( resultMinimize == DialogResult . Yes )
165+ {
166+ Hide ( ) ;
167+ e . Cancel = true ;
168+ return ;
169+ }
170+ }
171+
97172 DialogResult result = MessageBox . Show ( "Do you want to save this session?" , this . Text , MessageBoxButtons . YesNoCancel , MessageBoxIcon . Question ) ;
98173 if ( result == DialogResult . Yes )
99174 {
0 commit comments