Exemple #1
0
        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);
            }
        }