private void OnFillXamlOutputChecked() { if (_xamlPage == null || string.IsNullOrWhiteSpace(_xamlFilePath)) { tabXamlOutput.Visibility = _optionSettings.ShowOutputFile ? Visibility.Visible : Visibility.Collapsed; return; } Cursor saveCursor = this.Cursor; try { if (_optionSettings.ShowOutputFile) { this.Cursor = Cursors.Wait; this.ForceCursor = true; if (!File.Exists(_xamlFilePath)) { if (!_drawingPage.SaveDocument(_xamlFilePath)) { return; } } if (File.Exists(_xamlFilePath)) { _xamlPage.LoadDocument(_xamlFilePath); } else { _xamlPage.UnloadDocument(); } } else { _xamlPage.UnloadDocument(); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), AppErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error); } finally { this.Cursor = saveCursor; this.ForceCursor = false; tabXamlOutput.Visibility = _optionSettings.ShowOutputFile ? Visibility.Visible : Visibility.Collapsed; } }
private void CloseFile() { try { if (_svgPage != null) { _svgPage.UnloadDocument(); } if (_xamlPage != null) { _xamlPage.UnloadDocument(); } if (_drawingPage != null) { _drawingPage.UnloadDocument(); } if (_canDeleteXaml && !String.IsNullOrEmpty(_xamlFilePath) && File.Exists(_xamlFilePath)) { File.Delete(_xamlFilePath); } _svgFilePath = null; _xamlFilePath = null; _canDeleteXaml = false; } catch { } }