@@ -25,6 +25,7 @@ public NetGraphForm() {
2525 sampler . SampleAdded += Sampler_SampleAdded ;
2626
2727 Options = new Options ( Settings . Default ) ;
28+ ApplyLoadTimeOptions ( ) ;
2829
2930 trayIconIllustrator = new TrayIconIllustrator ( ) ;
3031 trayIcon . Icon = Icon ;
@@ -73,6 +74,17 @@ private bool IsConnectionDormant
7374 get { return LastSample . Max < 1000 && AverageDownloadSpeed < 1000 && AverageUploadSpeed < 1000 ; }
7475 }
7576
77+ private void ApplyLoadTimeOptions ( ) {
78+ if ( ! Options . Bounds . Location . IsEmpty ) {
79+ StartPosition = FormStartPosition . Manual ;
80+ Location = Options . Bounds . Location ;
81+ }
82+
83+ if ( ! Options . LoadHidden ) {
84+ Show ( ) ;
85+ }
86+ }
87+
7688 private void SyncOptionsWithSampler ( Options options ) {
7789 var nic = sampler . NetworkInterface = options . NetworkInterface ;
7890
@@ -82,13 +94,8 @@ private void SyncOptionsWithSampler(Options options) {
8294 }
8395
8496 private void SyncOptionsWithUI ( Options options ) {
85- if ( ! options . Bounds . Location . IsEmpty && StartPosition != FormStartPosition . Manual ) {
86- StartPosition = FormStartPosition . Manual ;
87- Location = options . Bounds . Location ;
88- }
89-
90- if ( options . Topmost ) topmost . SimulateClick ( ) ;
91- if ( options . Transparent ) transparent . SimulateClick ( ) ;
97+ if ( options . Topmost && ! topmost . Selected ) topmost . SimulateClick ( ) ;
98+ if ( options . Transparent && ! transparent . Selected ) transparent . SimulateClick ( ) ;
9299 }
93100
94101 private void UpdateStats ( ) {
@@ -139,7 +146,7 @@ private void ToggleWindowVisibility() {
139146 }
140147
141148 private bool CanSnap ( int clientEdge , int containerEdge , int tension ) {
142- if ( ! options . Docking ) {
149+ if ( ! Options . Docking ) {
143150 return false ;
144151 }
145152
@@ -159,22 +166,22 @@ private void close_Click(object sender, EventArgs e) {
159166 }
160167
161168 private void minimize_Click ( object sender , EventArgs e ) {
162- Visible = false ;
169+ Hide ( ) ;
163170 }
164171
165172 private void topmost_Click ( object sender , EventArgs e ) {
166- TopMost = topmost . Selected = topmostMenuItem . Checked = options . Topmost =
173+ TopMost = topmost . Selected = topmostMenuItem . Checked = Options . Topmost =
167174 sender == topmost ? topmost . Selected : topmostMenuItem . Checked ;
168175
169- options . Save ( ) ;
176+ Options . Save ( ) ;
170177 }
171178
172179 private void transparent_Click ( object sender , EventArgs e ) {
173- Opacity = ( transparent . Selected = transparencyMenuItem . Checked = options . Transparent =
180+ Opacity = ( transparent . Selected = transparencyMenuItem . Checked = Options . Transparent =
174181 sender == transparent ? transparent . Selected : transparencyMenuItem . Checked
175182 ) ? .4 : 1 ;
176183
177- options . Save ( ) ;
184+ Options . Save ( ) ;
178185 }
179186
180187 private void reset_Click ( object sender , EventArgs e ) {
@@ -265,9 +272,9 @@ private void NetGraphForm_Paint(object sender, PaintEventArgs e) {
265272 }
266273
267274 private void NetGraphForm_FormClosed ( object sender , FormClosedEventArgs e ) {
268- options . Bounds = Bounds ;
275+ Options . Bounds = Bounds ;
269276
270- options . Save ( ) ;
277+ Options . Save ( ) ;
271278 }
272279
273280 #endregion
0 commit comments