コード例 #1
0
        public void SaveLastResult()
        {
            //TODO: Save all results
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title            = "Save Test Results as XML";
            dlg.Filter           = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*";
            dlg.FileName         = "TestResult.xml";
            dlg.InitialDirectory = Path.GetDirectoryName(loader.TestFileName);
            dlg.DefaultExt       = "xml";
            dlg.ValidateNames    = true;
            dlg.OverwritePrompt  = true;

            if (dlg.ShowDialog(Form) == DialogResult.OK)
            {
                try
                {
                    string fileName = dlg.FileName;

                    loader.SaveLastResult(fileName);

                    Form.MessageDisplay.Info(String.Format("Results saved as {0}", fileName));
                }
                catch (Exception exception)
                {
                    Form.MessageDisplay.Error("Unable to Save Results", exception);
                }
            }
        }
コード例 #2
0
        public static void SaveLastResult(Form owner)
        {
            //TODO: Save all results
            TestLoader loader = Services.TestLoader;

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title            = "Save Test Results as XML";
            dlg.Filter           = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*";
            dlg.FileName         = "TestResult.xml";
            dlg.InitialDirectory = Path.GetDirectoryName(loader.TestFileName);
            dlg.DefaultExt       = "xml";
            dlg.ValidateNames    = true;
            dlg.OverwritePrompt  = true;

            if (dlg.ShowDialog(owner) == DialogResult.OK)
            {
                try
                {
                    string fileName = dlg.FileName;

                    loader.SaveLastResult(fileName);

                    string msg = String.Format("Results saved as {0}", fileName);
                    UserMessage.DisplayInfo(msg, "Save Results as XML");
                }
                catch (Exception exception)
                {
                    UserMessage.DisplayFailure(exception, "Unable to Save Results");
                }
            }
        }