示例#1
0
        public MainForm()
        {
            //Viewing and starting GUI/Application Created
            _sensorVisitor = new SensorVisitor(ProcessSensor);

            InitializeComponent();
            if (Initialize())
            {
                mainTimer.Enabled = true;
                WindowState       = FormWindowState.Minimized;
            }
        }
        public MainForm()
        {
            _sensorVisitor = new SensorVisitor(ProcessSensor);

            RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\OHMArduino");

            object regBaud     = key.GetValue("Baud", null);
            object regInterval = key.GetValue("Interval", null);
            object regOutput   = key.GetValue("Output", null);

            key.Close();

            InitializeComponent();
            if (Initialize())
            {
                mainTimer.Enabled = true;
                WindowState       = FormWindowState.Minimized;
            }

            if (regBaud != null)
            {
                baudComboBox1.SelectedIndex = int.Parse(regBaud.ToString());
            }
            else
            {
                baudComboBox1.SelectedIndex = 0;
            }

            if (regInterval != null)
            {
                intervalComboBox1.SelectedIndex = int.Parse(regInterval.ToString());
            }
            else
            {
                intervalComboBox1.SelectedIndex = 1;
            }

            gradientTrackBar1.Enabled = false;

            if (checkAdministrator() == true)
            {
                adminLinkLabel1.Visible    = false;
                outputList[0]              = "Off";
                outputList[1]              = "Manual";
                outputList[2]              = "CPU Usage";
                outputList[3]              = "RAM Usage";
                outputList[4]              = "CPU Temp";
                outputList[5]              = "GPU Temp";
                outputComboBox1.DataSource = outputList;
            }
            else
            {
                cpuTempLabel1.Visible      = false;
                gpuTempLabel1.Visible      = false;
                cpuTempBox.Visible         = false;
                gpuTempBox.Visible         = false;
                outputList[0]              = "Off";
                outputList[1]              = "Manual";
                outputList[2]              = "CPU Usage";
                outputList[3]              = "RAM Usage";
                outputComboBox1.DataSource = outputList;
            }

            if (regOutput != null)
            {
                outputComboBox1.SelectedIndex = int.Parse(regOutput.ToString());
            }
            else
            {
                outputComboBox1.SelectedIndex = 2;
            }
        }