Example #1
0
        private void LoadEntryDetails()
        {
            LinuxCPUEntry currentEntry = (LinuxCPUEntry)SelectedEntry;

            if (currentEntry == null)
            {
                currentEntry = new LinuxCPUEntry();
            }
            sshConnectionDetails  = currentEntry.SSHConnection;
            txtSSHConnection.Text = Linux.SSHConnectionDetails.FormatSSHConnection(sshConnectionDetails);

            chkUseOnlyTotalCPUvalue.Checked = currentEntry.UseOnlyTotalCPUvalue;
            nudMSSampleDelay.SaveValueSet(currentEntry.MSSampleDelay);
            warningNumericUpDown.SaveValueSet((decimal)currentEntry.WarningValue);
            errorNumericUpDown.SaveValueSet((decimal)currentEntry.ErrorValue);
        }
Example #2
0
        private void cmdOK_Click(object sender, EventArgs e)
        {
            LinuxCPUEntry selectedEntry;

            if (SelectedEntry == null)
            {
                SelectedEntry = new LinuxCPUEntry();
            }
            selectedEntry = (LinuxCPUEntry)SelectedEntry;

            selectedEntry.SSHConnection = sshConnectionDetails;

            selectedEntry.UseOnlyTotalCPUvalue = chkUseOnlyTotalCPUvalue.Checked;
            selectedEntry.MSSampleDelay        = (int)nudMSSampleDelay.Value;
            selectedEntry.WarningValue         = (double)warningNumericUpDown.Value;
            selectedEntry.ErrorValue           = (double)errorNumericUpDown.Value;

            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }
Example #3
0
        public void FromXml(string configurationString)
        {
            if (configurationString == null || configurationString.Length == 0)
            {
                return;
            }
            XmlDocument config = new XmlDocument();

            config.LoadXml(configurationString);
            XmlElement root = config.DocumentElement;

            Entries.Clear();
            foreach (XmlElement pcNode in root.SelectNodes("linux/cpu"))
            {
                LinuxCPUEntry entry = new LinuxCPUEntry();
                entry.SSHConnection        = SSHConnectionDetails.FromXmlElement(pcNode);
                entry.MSSampleDelay        = pcNode.ReadXmlElementAttr("msSampleDelay", 200);
                entry.UseOnlyTotalCPUvalue = pcNode.ReadXmlElementAttr("totalCPU", true);
                entry.WarningValue         = float.Parse(pcNode.ReadXmlElementAttr("warningValue", "80"));
                entry.ErrorValue           = float.Parse(pcNode.ReadXmlElementAttr("errorValue", "99"));

                Entries.Add(entry);
            }
        }