コード例 #1
0
        void ServiceInterfaceRefresh()
        {
            //System.Threading.Thread.Sleep(100);
            if (Service.IsInstalled())
            {
                Install_button.Enabled            = false;
                UnInstall_button.Enabled          = true;
                Start_button.Enabled              = true;
                Stop_button.Enabled               = true;
                ServiceStartType_comboBox.Enabled = true;

                Service.StartType startType = Service.GetStartType();
                if ((int)startType >= 0 && (int)startType <= 3)
                {
                    ServiceStartType_comboBox.SelectedIndex = (int)startType;
                }

                string Status = Service.GetStatus();
                ServiceStatus_label.Text = "Status: " + Status;

                if (Status == "Stopped")
                {
                    Stop_button.Enabled = false;
                    InterfaceEnabled(true);
                }
                if (Status == "Running")
                {
                    Start_button.Enabled = false;
                    InterfaceEnabled(false);
                }
            }
            else
            {
                Install_button.Enabled            = true;
                UnInstall_button.Enabled          = false;
                Start_button.Enabled              = false;
                Stop_button.Enabled               = false;
                ServiceStartType_comboBox.Enabled = false;
            }
        }
コード例 #2
0
 private void ServiceStartType_comboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     Service.StartType value = (Service.StartType)ServiceStartType_comboBox.SelectedIndex;
     Service.SetStartType(value);
 }