private void OnOpenSvgPath(object sender, RoutedEventArgs e) { var filePath = txtSvgPath.Text; if (string.IsNullOrWhiteSpace(filePath) || Directory.Exists(filePath) == false) { return; } OptionSettings.OpenFolderAndSelectItem(filePath, null); }
public OptionSettings(OptionSettings source) { if (source == null) { return; } _hidePathsRoot = source._hidePathsRoot; _defaultSvgPath = source._defaultSvgPath; _currentSvgPath = source._currentSvgPath; _showInputFile = source._showInputFile; _showOutputFile = source._showOutputFile; _recursiveSearch = source._recursiveSearch; _wpfSettings = source._wpfSettings; }
public MainWindow() { InitializeComponent(); leftExpander.Expanded += OnLeftExpanderExpanded; leftExpander.Collapsed += OnLeftExpanderCollapsed; leftSplitter.MouseMove += OnLeftSplitterMove; bottomExpander.Expanded += OnBottomExpanderExpanded; bottomExpander.Collapsed += OnBottomExpanderCollapsed; bottomSplitter.MouseMove += OnBottomSplitterMove; this.Loaded += OnWindowLoaded; this.Unloaded += OnWindowUnloaded; this.Closing += OnWindowClosing; _drawingDir = IoPath.Combine(IoPath.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location), DrawingPage.TemporalDirName); if (!Directory.Exists(_drawingDir)) { Directory.CreateDirectory(_drawingDir); } _optionSettings = new OptionSettings(); _testSettingsPath = IoPath.GetFullPath(SvgTestSettings); if (!string.IsNullOrWhiteSpace(_testSettingsPath) && File.Exists(_testSettingsPath)) { _optionSettings.Load(_testSettingsPath); // Override any saved local directory, default to sample files. _optionSettings.CurrentSvgPath = _optionSettings.DefaultSvgPath; } _optionSettings.PropertyChanged += OnSettingsPropertyChanged; try { _folderClose = this.GetImage(new Uri("Images/FolderClose.svg", UriKind.Relative)); _folderOpen = this.GetImage(new Uri("Images/FolderOpen.svg", UriKind.Relative)); _fileThumbnail = this.GetImage(new Uri("Images/SvgLogoBasic.svg", UriKind.Relative)); } catch (Exception ex) { _folderClose = null; _folderOpen = null; MessageBox.Show(ex.ToString(), AppErrorTitle, MessageBoxButton.OK, MessageBoxImage.Error); } }
public OptionSettings Clone() { OptionSettings optSettings = new OptionSettings(this); if (_wpfSettings != null) { optSettings._wpfSettings = _wpfSettings.Clone(); } if (_defaultSvgPath != null) { optSettings._defaultSvgPath = new string(_defaultSvgPath.ToCharArray()); } if (_currentSvgPath != null) { optSettings._currentSvgPath = new string(_currentSvgPath.ToCharArray()); } return(optSettings); }
public OptionSettings Clone() { OptionSettings optSettings = new OptionSettings(this); if (_wpfSettings != null) { optSettings._wpfSettings = _wpfSettings.Clone(); } if (_defaultSvgPath != null) { optSettings._defaultSvgPath = string.Copy(_defaultSvgPath); } if (_currentSvgPath != null) { optSettings._currentSvgPath = string.Copy(_currentSvgPath); } return(optSettings); }
private void OnPageLoaded(object sender, RoutedEventArgs e) { if (_mainWindow == null || _mainWindow.OptionSettings == null) { return; } _optionSettings = _mainWindow.OptionSettings; var wpfSettings = _optionSettings.ConversionSettings; if (wpfSettings != null) { _wpfSettings = wpfSettings.Clone(); } if (_wpfSettings == null) { return; } _isInitialising = true; txtSvgPath.Text = _optionSettings.GetPath(_optionSettings.CurrentSvgPath); txtSvgPathDefault.Text = _optionSettings.GetPath(_optionSettings.DefaultSvgPath); txtSvgPath.IsReadOnly = _optionSettings.HidePathsRoot; chkHidePathsRoot.IsChecked = _optionSettings.HidePathsRoot; chkRecursiveSearch.IsChecked = _optionSettings.RecursiveSearch; chkShowInputFile.IsChecked = _optionSettings.ShowInputFile; chkShowOutputFile.IsChecked = _optionSettings.ShowOutputFile; chkTextAsGeometry.IsChecked = _wpfSettings.TextAsGeometry; chkIncludeRuntime.IsChecked = _wpfSettings.IncludeRuntime; chkIgnoreRootViewbox.IsChecked = _wpfSettings.IgnoreRootViewbox; chkEnsureViewboxSize.IsChecked = _wpfSettings.EnsureViewboxSize; chkEnsureViewboxPosition.IsChecked = _wpfSettings.EnsureViewboxPosition; _isConversionModified = false; _isInitialising = false; }