public LayoutTabPanel() { this.borderPen = new Pen(); this.borderPen.Thickness = 1; BindingOperations.SetBinding(this.borderPen, Pen.BrushProperty, new Binding { Source = this, Path = new PropertyPath(BorderBrushProperty) }); this.geometry = new PathGeometry(); this.figure = new PathFigure() { IsClosed = true, IsFilled = true }; this.geometry.Figures.Add(this.figure); this.solidAffinitizedBrush = new SolidColorBrush(); this.lightAffinitizedBrush = new SolidColorBrush(); this.SetBinding(DocumentTypeAffinityMarginProperty, Theme.CreateBinding("DocumentAffinityMargin")); this.SetBinding(DocumentTypeAffinityLineThicknessProperty, Theme.CreateBinding("DocumentAffinityLineThickness")); this.fadeBinding = Theme.CreateBinding("DocumentAffinityFade"); }
private void SetRenderValues() { if (this.IsSelected) { this.StrokeThickness = 2; this.Fill = new SolidColorBrush(this.PenData.Brush.Color); BindingOperations.SetBinding(this.Fill, SolidColorBrush.OpacityProperty, Theme.CreateBinding("ConsoleViewGraphFillOpacity")); } else { this.StrokeThickness = 1; this.Fill = null; } }
void Initialize() { ComputeStateStorageDirectory(this.AppName, this.AppVersion); this.ExtensionManager = new ExtensionManager(this.StateStorageDirectory); this.ExtensionManager.LoadState(this.ExtensionAssemblies); this.RootServiceProvider = new RootServiceProvider(this.ExtensionManager); this.RootServiceProvider.AddService(typeof(IUserNotificationService), new SimpleNotificationService(this.AppTitle)); this.RootServiceProvider.AddService(typeof(ToolsUIApplication), this); this.RootServiceProvider.AddService(this.GetType(), this); this.RootServiceProvider.AddService(typeof(Dispatcher), Dispatcher.CurrentDispatcher); this.sessionStateService = new SessionStateService(); this.RootServiceProvider.AddService(typeof(ISessionStateService), this.sessionStateService); this.windowStateFileName = Path.Combine(this.StateStorageDirectory, "WindowState.xml"); this.sessionStateFileName = Path.Combine(this.StateStorageDirectory, "SessionState.xml"); if (File.Exists(this.sessionStateFileName)) { try { XElement sessionState = XElement.Load(this.sessionStateFileName); this.sessionStateService.SetFullSessionState(sessionState); } catch (Exception) { } } this.sessionStateService.StateSaveRequested += OnSessionStateSaveRequested; InitializeTheme(); this.viewCreators = this.ExtensionManager.BuildViewCreatorDictionary(); this.RecentDocumentService = this.RootServiceProvider.GetService(typeof(RecentDocumentService)) as RecentDocumentService; if (this.RecentDocumentService != null) { ((INotifyCollectionChanged)this.RecentDocumentService.DocumentIdentities).CollectionChanged += OnRecentDocumentIdentitiesCollectionChanged; OnRecentDocumentIdentitiesCollectionChanged(null, null); } this.FoldersSource.GroupDescriptions.Add(new PropertyGroupDescription { PropertyName = "Category" }); if (this.RecentDocumentService != null) { NotifyCollectionChangedEventHandler handler = (s, e) => { this.FoldersSource.Source = new CategorizedFolder[] { new CategorizedFolder { Category = "Current Folder", DirectoryInfo = new DirectoryInfo(Directory.GetCurrentDirectory()), ShortcutKey = "C" } }.Concat(this.RecentDocumentService.RecentFolders.Select((d, i) => new CategorizedFolder { Category = "Recent Folders", DirectoryInfo = d, ShortcutKey = string.Format("D{0}", i + 1) })); }; ((INotifyCollectionChanged)this.RecentDocumentService.RecentFolders).CollectionChanged += handler; handler(null, null); } this.documentCategories = new List <DocumentCategory>(); foreach (var factoryName in this.ExtensionManager.DocumentFactoryNames) { var factory = this.ExtensionManager.LookupDocumentFactory(factoryName); if (factory != null) { var category = new DocumentCategory { DisplayName = factory.DocumentKind, DocumentFactoryName = factoryName }; BindingOperations.SetBinding(category, DocumentCategory.ColorProperty, Theme.CreateBinding(factory.ColorThemePropertyName)); this.documentCategories.Add(category); } } this.documentCategories.Add(new DocumentCategory { Color = Colors.Transparent, DisplayName = "Any", DocumentFactoryName = null }); OnInitialized(); }