public DiagramMarkEditorViewModel(DiagramMark diagramMark, bool isNew) { DiagramMark = diagramMark ?? throw new ArgumentNullException(nameof(diagramMark)); // Save properties _text = diagramMark.Text; // Save original _originalStyle = new ObservableDiagramStyle(diagramMark.Style, diagramMark.MarkStyle); // Create editable clone DiagramStyle clone = _originalStyle.Style.Clone(); if (_originalStyle.Style.ReadOnly) { clone.MarkAsReadOnly(); } Style = new ObservableDiagramStyle(clone); Style.MarkStyle.MarkType = DiagramMark.Type; Style.PropertyChanged += ObservableDiagramStyle_PropertyChanged; if (isNew) { _dirty = true; } }
public DiagramBarreEditorViewModel(DiagramBarre diagramBarre, bool isNew) { if (null == diagramBarre) { throw new ArgumentNullException("diagramBarre"); } DiagramBarre = diagramBarre; // Save original _originalStyle = new ObservableDiagramStyle(diagramBarre.Style); // Create editable clone DiagramStyle clone = _originalStyle.Style.Clone(); if (_originalStyle.Style.ReadOnly) { clone.MarkAsReadOnly(); } Style = new ObservableDiagramStyle(clone); Style.PropertyChanged += ObservableDiagramStyle_PropertyChanged; if (isNew) { _dirty = true; } }
public DiagramFretLabelEditorViewModel(DiagramFretLabel diagramFretLabel, bool isNew) { if (null == diagramFretLabel) { throw new ArgumentNullException("diagramFretLabel"); } DiagramFretLabel = diagramFretLabel; // Save properties _text = diagramFretLabel.Text; // Save original _originalStyle = new ObservableDiagramStyle(diagramFretLabel.Style); // Create editable clone DiagramStyle clone = _originalStyle.Style.Clone(); if (_originalStyle.Style.ReadOnly) { clone.MarkAsReadOnly(); } Style = new ObservableDiagramStyle(clone); Style.PropertyChanged += ObservableDiagramStyle_PropertyChanged; if (isNew) { _dirty = true; } }
public ObservableDiagram(Diagram diagram, bool autoRender = true, string name = "") : base() { _autoRender = autoRender; _name = name; _diagram = diagram ?? throw new ArgumentNullException(nameof(diagram)); Style = new ObservableDiagramStyle(diagram.Style); Style.PropertyChanged += Style_PropertyChanged; if (AutoRender) { Render(); } }
public DiagramStyleEditorViewModel(ObservableDiagramStyle diagramStyle) { if (null == diagramStyle) { throw new ArgumentNullException(nameof(diagramStyle)); } // Add original _originalStyles = new ObservableCollection <ObservableDiagramStyle> { diagramStyle }; // Recursively parents up the tree DiagramStyle style = diagramStyle.Style.Parent; while (null != style) { ObservableDiagramStyle parentStyle = new ObservableDiagramStyle(style); _originalStyles.Insert(0, parentStyle); style = style.Parent; } // Add editable clones Styles = new ObservableCollection <ObservableDiagramStyle>(); foreach (ObservableDiagramStyle originalStyle in _originalStyles) { DiagramStyle clone = originalStyle.Style.Clone(); if (originalStyle.Style.ReadOnly) { clone.MarkAsReadOnly(); } ObservableDiagramStyle editableStyle = new ObservableDiagramStyle(clone); editableStyle.PropertyChanged += ObservableDiagramStyle_PropertyChanged; Styles.Add(editableStyle); } _selectedStyleIndex = Styles.Count - 1; }
public ShowDiagramStyleEditorMessage(ObservableDiagramStyle diagramStyle, Action <bool> callback = null) : base() { DiagramStyleEditorVM = new DiagramStyleEditorViewModel(diagramStyle); Callback = callback; }