Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (processname != null &&
                username != null &&
                cpuperformance != null &&
                memory != null &&
                description != null &&
                processid != null)
            {
                //弹出对话框
                Process process = Process.GetProcessById(Convert.ToInt32(processid));
                int pid = Convert.ToInt32(processid);
                SaveFileDialog save = new SaveFileDialog();
                save.Title = "文件另存为";
                save.InitialDirectory = @"C:\Users\wsx\Documents\Visual Studio 2012\Projects";
                save.FileName = processname + "_" + processid;
                save.Filter = "上下文文件(*.context)|*.context";
                save.DefaultExt = "context";
                save.OverwritePrompt = true;
                save.RestoreDirectory = true;
                save.OverwritePrompt = true;

               if (save.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string path = save.FileName.ToString();

                   checkpoint check = new checkpoint();

                   check.DumpProcState(pid, path);

                   processname = null;
                   username = null;
                   cpuperformance = null;
                   memory = null;
                   description = null;
                   processid = null;
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Nothing available!");
            }
        }