Exemplo n.º 1
0
 private void DoNotifyStyleChanged <TStyle>(StyleCollection <TStyle> styleCollection, TStyle style) where TStyle : class, IStyle
 {
     if (styleCollection == null)
     {
         throw new ArgumentNullException("styleCollection");
     }
     if (style == null)
     {
         throw new ArgumentNullException("style");
     }
     // create and set new PreviewStyle if the style is in the currently active design
     if (styleCollection.ContainsPreviewStyle(style))
     {
         TStyle previewStyle = styleCollection.GetPreviewStyle(style);
         Debug.Assert(previewStyle != null);
         ToolCache.NotifyStyleChanged(previewStyle);
     }
     ToolCache.NotifyStyleChanged(style);
 }
Exemplo n.º 2
0
		private void ExecuteSelection() {
			if (SelectedItem is OpenDesignerItem) {
				if (styleSetProvider is Project) {
					// Try to find the main window (the application's first opened window)
					Form parentForm = (Application.OpenForms.Count > 0) ? Application.OpenForms[0] : null;
					// Show dialog with parent form or otherwise it will show in background
					DesignEditorDialog dlg = new DesignEditorDialog((Project)styleSetProvider, styleCategory);
					if (parentForm == null) dlg.Show();
					else dlg.Show(parentForm);
				}
				SelectedItem = preselectedStyle;
			}
			if (editorService != null)
				editorService.CloseDropDown();
			else {
				// Notify ToolCache about changed styles only if no EditorService is set.
				// Otherwise the ToolCache re-creates the associated brush, pen, etc 
				// each time the user selects a style for a shape in the property grid.
				if (SelectedStyle is CapStyle || SelectedStyle is LineStyle)
					ToolCache.NotifyStyleChanged(SelectedStyle);
			}
		}
Exemplo n.º 3
0
 private void repository_StyleDeleted(object sender, RepositoryStyleEventArgs e)
 {
     ToolCache.NotifyStyleChanged(e.Style);
 }