コード例 #1
0
        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;
            }
        }
コード例 #2
0
        private void OnFillXamlOutputChecked(object sender, RoutedEventArgs e)
        {
            if (_xamlPage == null || String.IsNullOrEmpty(_xamlFilePath))
            {
                return;
            }

            try
            {
                this.Cursor      = Cursors.Wait;
                this.ForceCursor = true;

                if (!File.Exists(_xamlFilePath) && _drawingPage != null)
                {
                    if (!_drawingPage.SaveDocument(_xamlFilePath))
                    {
                        return;
                    }
                }

                if (File.Exists(_xamlFilePath) &&
                    (fillXamlOutput.IsChecked != null && fillXamlOutput.IsChecked.Value))
                {
                    _xamlPage.LoadDocument(_xamlFilePath);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Wpf-Svg Test Sample",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                this.Cursor      = Cursors.Arrow;
                this.ForceCursor = false;
            }
        }