private void Clip_Click(Object sender, EventArgs e) { if (clip_watch.Checked) { clip_watch.Checked = false; ClipData = null; ClipTimer.Stop(); } else { clip_watch.Checked = true; ClipData = ""; ClipTimer.Start(); } }
private void LoadConfiguration() { string app_dir = Application.ExecutablePath; app_dir = app_dir.Remove(app_dir.LastIndexOf('\\')); XmlDocument xml_doc = new XmlDocument(); xml_doc.Load(app_dir + "\\config.xml"); Hashtable xml = new Hashtable(); foreach (XmlNode node in xml_doc.DocumentElement.ChildNodes) xml[node.Name] = node.InnerText; avg_checked.Checked = bool.Parse(xml["DispAvg"].ToString()); units_kbytes.Checked = bool.Parse(xml["UnitsKbytes"].ToString()); units_kbits.Checked = bool.Parse(xml["UnitsKbits"].ToString()); graphs_download.Checked = bool.Parse(xml["GraphDownload"].ToString()); graphs_upload.Checked = bool.Parse(xml["GraphUpload"].ToString()); autoscale_checked.Checked = bool.Parse(xml["AutoScale"].ToString()); msMainFileTopmost.Checked = bool.Parse(xml["TopMost"].ToString()); msMainFileSimpleIcon.Checked = bool.Parse(xml["SimpleNotifyIcon"].ToString()); clip_watch.Checked = bool.Parse(xml["ClipWatch"].ToString()); LogEnabled = bool.Parse(xml["LogEnabled"].ToString()); timerInterval = int.Parse(xml["TimerInterval"].ToString()); LogInterval = int.Parse(xml["LogInterval"].ToString()); scale = int.Parse(xml["GraphScale"].ToString()); WLength = int.Parse(xml["DispWidth"].ToString()); WHeight = int.Parse(xml["DispHeight"].ToString()); m_full_downlines = new int[WLength]; m_full_uplines = new int[WLength]; full_downspeeds = new double[WLength]; full_upspeeds = new double[WLength]; ClientSize = new Size(WLength, WHeight); if (xml["WindowIsVisible"].ToString().ToLower() == "true") { Show(); Location = new Point(int.Parse(xml["WindowX"].ToString()), int.Parse(xml["WindowY"].ToString())); msMainFileShowMeter.Checked = true; } else { Location = new Point(int.Parse(xml["WindowX"].ToString()), int.Parse(xml["WindowY"].ToString())); msMainFileShowMeter.Checked = false; Hide(); } if (clip_watch.Checked) ClipTimer.Start(); LogTimer.Interval = LogInterval * 60000; if (LogEnabled) LogTimer.Start(); trackBar2.Maximum = 100; trackBar2.Minimum = 30; trackBar2.Value = int.Parse(xml["Trans"].ToString()); Opacity = ((float)trackBar2.Value) / 100; TopMost = msMainFileTopmost.Checked; icon_representation = msMainFileSimpleIcon.Checked; logs_form.LoadConfiguration(xml); graphs_summary.Checked = bool.Parse(xml["GraphSummary"].ToString()); FullMeter.ShowSummary = graphs_summary.Checked; }