コード例 #1
0
        public override void Execute(object parameter = null)
        {
            if (parameter is Fluent.ToggleButton)
            {
                ToggleButton = (ToggleButton)parameter;
            }
            if (CommandLogger.LoggingStarted)
            {
                MessageBoxResult result = ExolutioYesNoBox.ShowYesNoCancel("Save log", "Do you wish to save recorded log file?");
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                if (result == MessageBoxResult.Yes)
                {
                    SaveFileDialog dlg = new SaveFileDialog
                    {
                        DefaultExt = ".eXoL",
                        Filter     = "eXolutio log files (*.eXoL)|*.eXoL|XML files (*.xml)|*.xml|All files (*.*)|*.*||"
                    };

                    bool?sresult = dlg.ShowDialog();
                    if (sresult == true)
                    {
                        XDocument doc = CommandLogger.SerializationDocument;
                        doc.Save(dlg.FileName);
                        CommandLogger.StopLogging();
                    }
                }
                else
                {
                    CommandLogger.StopLogging();
                }
            }
        }