#region btnRun_Click //Automate the service on clicking Run Button private void btnRun_Click(object sender, EventArgs e) { //To show service started message on button click(Status formload boolean varaiable set) formload = false; StartServiceCheck(); } #endregion #region StartServiceCheck Function //To check whether the Archival Automation is installed or not and if installed start the service private void StartServiceCheck() { startservice = false; serviceInstallationStatus = AS.CheckServiceInstallation(windowsservice); //Check Archival Automation is Installed in Services.msc if (serviceInstallationStatus == true) { //Start the Archival Automation installed in Services.msc startservice= AS.StartService(windowsservice); if (formload == true) { btnRun.Enabled = false; return; } //Check whether the Archival Automation is running and if so Run button will be diabled else Run button will be enabled if (startservice == true) { //Disable the Run Button if Service is Already Running btnRun.Enabled = false; //Show message box if the Archival Automation is Already running and to shown only on Run Button Click MessageBox.Show("Archival Automation is Already Running"); } //If the Archival Automation is not running else { //Enable the Run Button btnRun.Enabled = true; //Message to be shown only on Run Button Click with status formload if(formload==false) MessageBox.Show("Archival Automation has been started Successfully"); } btnStop.Enabled = true; } //Message Box if Archival Automation is not Installed else { MessageBox.Show("Archival Automation is Not Installed"); } }
myProgressBar.Style = ProgressBarStyle.Marquee;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)