예제 #1
0
        private void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.WriteLogFile();
            ProcessStartInfo startInfo = new ProcessStartInfo("explorer.exe");

            Process.Start(startInfo);
            if (e.Error != null)
            {
                FunctionalForm.Infomation(e.Error.ToString());
            }
            string text = string.Format(SR.Log_RunTaskFinished, this.succCount, this.failCount);

            if (this.failCount > 0)
            {
                text = text + Environment.NewLine + SR.Log_FailedNote;
            }
            if (this.succCount > 0)
            {
                text = text + Environment.NewLine + SR.AutoReboot;
                if (FunctionalForm.Question(text, true))
                {
                    RunReplaceTask.Reboot();
                }
            }
            else
            {
                FunctionalForm.Infomation(text);
            }
            Process.Start(this.logFile);
            base.Close();
        }
예제 #2
0
 private void Uninstall()
 {
     this._supressClosing = true;
     if (!FunctionalForm.Question(SR.ConfirmToDeleteSettings, true))
     {
         this._supressClosing = false;
         return;
     }
     Program.CFG.Uninstall();
     FunctionalForm.Infomation(SR.UninstallSuccessfully);
     Environment.Exit(0);
 }
예제 #3
0
        private void RunWork()
        {
            string content = string.Empty;

            if (this.chkKillAll.Checked)
            {
                content = SR.KillWarning;
            }
            else
            {
                content = SR.ExplorerWillBeKilled;
            }
            if (!FunctionalForm.Question(content, true))
            {
                return;
            }
            string text = Path.Combine(Application.StartupPath, "working");

            Directory.CreateDirectory(text);
            foreach (ListViewItem listViewItem in this.taskList.Items)
            {
                TaskInfo taskInfo = listViewItem.Tag as TaskInfo;
                this.SetStateInfo(listViewItem, SR.Copying);
                Application.DoEvents();
                if (taskInfo.ActionType)
                {
                    File.Copy(taskInfo.NewFile, Path.Combine(text, Path.GetFileName(taskInfo.FilePath)), true);
                }
                else
                {
                    File.WriteAllText(Path.Combine(text, Path.GetFileName(taskInfo.FilePath) + ".del"), "");
                }
                Application.DoEvents();
                this.SetStateInfo(listViewItem, SR.Ready);
            }
            string           arguments        = "-replace " + (this.chkKillAll.Checked ? "1" : "0") + " " + Process.GetCurrentProcess().Id.ToString();
            ProcessStartInfo processStartInfo = new ProcessStartInfo(Application.ExecutablePath, arguments);

            if (OS.OSMajorVersion > 5)
            {
                processStartInfo.Verb = "runas";
            }
            try
            {
                Process.Start(processStartInfo);
            }
            catch (Win32Exception ex)
            {
                FunctionalForm.Infomation(string.Format(SR.OperationFailed, ex.Message));
                return;
            }
            base.Close();
        }
예제 #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.lstBackupList.SelectedIndex == -1)
            {
                return;
            }
            if (!FunctionalForm.Question(SR.SureToDeleteBackup, true))
            {
                return;
            }
            string text = Path.Combine(Application.StartupPath, "backup");

            text = Path.Combine(text, this.lstBackupList.SelectedItem.ToString());
            Directory.Delete(text, true);
            this.lstBackupList.Items.RemoveAt(this.lstBackupList.SelectedIndex);
        }