public void Check_Menus() { //interval_tenth.Checked = interval_fifth.Checked = interval_half.Checked = interval_1.Checked = false; //scale_33.Checked = scale_56.Checked = scale_64.Checked = scale_128.Checked = scale_256.Checked = scale_512.Checked = scale_640.Checked = scale_1000.Checked = scale_1500.Checked = scale_2000.Checked = scale_3000.Checked = scale_5000.Checked = scale_7000.Checked = scale_10000.Checked = scale_11000.Checked = scale_32000.Checked = scale_54000.Checked = scale_100000.Checked = scale_1000000.Checked = scale_custom.Checked = false; if (timerInterval == 100) interval_tenth.Checked = true; else if (timerInterval == 200) interval_fifth.Checked = true; else if (timerInterval == 500) interval_half.Checked = true; else if (timerInterval == 1000) interval_1.Checked = true; switch (scale) { case 4200: scale_33.Checked = true; display_yscale = "Scale: 33.6 kb"; break; case 7000: scale_56.Checked = true; display_yscale = "Scale: 56 kb"; break; case 8000: scale_64.Checked = true; display_yscale = "Scale: 64 kb"; break; case 16000: scale_128.Checked = true; display_yscale = "Scale: 128 kb"; break; case 32000: scale_256.Checked = true; display_yscale = "Scale: 256 kb"; break; case 64000: scale_512.Checked = true; display_yscale = "Scale: 512 kb"; break; case 80000: scale_640.Checked = true; display_yscale = "Scale: 640 kb"; break; case 128000: scale_1000.Checked = true; display_yscale = "Scale: 1 mb"; break; case 192000: scale_1500.Checked = true; display_yscale = "Scale: 1.5 mb"; break; case 256000: scale_2000.Checked = true; display_yscale = "Scale: 2 mb"; break; case 384000: scale_3000.Checked = true; display_yscale = "Scale: 3 mb"; break; case 640000: scale_5000.Checked = true; display_yscale = "Scale: 5 mb"; break; case 896000: scale_7000.Checked = true; display_yscale = "Scale: 7 mb"; break; case 1280000: scale_10000.Checked = true; display_yscale = "Scale: 10 mb"; break; case 1408000: scale_11000.Checked = true; display_yscale = "Scale: 11 mb"; break; case 4096000: scale_32000.Checked = true; display_yscale = "Scale: 32 mb"; break; case 6912000: scale_54000.Checked = true; display_yscale = "Scale: 54 mb"; break; case 12800000: scale_100000.Checked = true; display_yscale = "Scale: 100 mb"; break; case 128000000: scale_1000000.Checked = true; display_yscale = "Scale: 1 gb"; break; default: scale_custom.Checked = true; display_yscale = "Scale: custom (" + Totals_LogForm.Value(scale, null) + ")"; break; } }
private void SetScale_MenuClick(Object sender, EventArgs e)//from a menu click to change graph scale { foreach (ToolStripMenuItem m in m_scale_menu.DropDownItems) { if (m != autoscale_checked) { if (m.Equals(sender)) { if (!m.Checked) m.Checked = true; switch (m.Text) { case "33.6 kb": scale = 4200; break; case "56 kb": scale = 7000; break; case "64 kb": scale = 8000; break; case "128 kb": scale = 16000; break; case "256 kb": scale = 32000; break; case "512 kb": scale = 64000; break; case "640 kb": scale = 80000; break; case "1 mb": scale = 128000; break; case "1.5 mb": scale = 192000; break; case "2 mb": scale = 256000; break; case "3 mb": scale = 384000; break; case "5 mb": scale = 640000; break; case "7 mb": scale = 896000; break; case "10 mb": scale = 1280000; break; case "11 mb": scale = 1408000; break; case "32 mb": scale = 4096000; break; case "54 mb": scale = 6912000; break; case "100 mb": scale = 12800000; break; case "1 gb": scale = 128000000; break; //custom default: { GetValueForm g = new GetValueForm("Provide custom scale in bytes (1024B = 1KB)"); if (g.ShowDialog() == DialogResult.OK) { try { scale = int.Parse(g.Value); m.Text = "custom (" + Totals_LogForm.Value(scale, null) + ")"; } catch { m.Text = "custom"; } } break; } } Check_Menus(); ResizeScale(); } else { m.Checked = false; } } } }
public MainForm(SplashForm frmSplash) { frmSplash.ShowState("Initialize UI..."); InitializeComponent(); frmSplash.ShowState("Get the network adapter(s)..."); if (monitor.Adapters.Length == 0) { MessageBox.Show("I can't find any network adapters on this computer.", "FreeMeter Revival Failed."); return; } foreach (NetworkAdapter adapter in monitor.Adapters) { ToolStripMenuItem tmp = new ToolStripMenuItem(adapter.name,null, new EventHandler(SetAdapter)); m_interfaces.DropDownItems.Add(tmp); tmp.Checked = adapter.Enabled; } frmSplash.ShowState("Start the logs..."); logs_form = new Totals_LogForm(); RestoreRegistry(); frmSplash.ShowState("Load the configuration..."); try { SetDefaults(); LoadConfiguration(); } catch {} frmSplash.ShowState("Check the menus..."); Check_Menus(); frmSplash.ShowState("Set the transparency trackbar..."); // Transparency Trackbar trackBar2.Location = new Point(2, WHeight - 14); trackBar2.Size = new Size(WLength - 15, 15); trackBar2.SendToBack(); trackBar2.Hide(); frmSplash.ShowState("Start the check process..."); backgroundWorker1.RunWorkerAsync(); frmSplash.ShowState("Launch check version background process..."); Check_Version(this, new EventArgs()); //hack to initially try to reduce the memory footprint of the app (admin only) try { Process loProcess = Process.GetCurrentProcess(); loProcess.MaxWorkingSet = loProcess.MaxWorkingSet; loProcess.Dispose(); } catch { } ShrinkTimer.Start(); frmSplash.CloseWithSleep(); }