public OpenCompositionCommand(CompositionDiagramElement composition) { if (composition == null) throw new ArgumentNullException(nameof(composition)); Composition = composition; }
private void OnDebuggerCompositionChanged(CompositionDiagramElement element) { this.GuiAsync(() => { DiagramEditor.Composition = element; }); }
public void Remove(CompositionDiagramElement element, bool isComposition) { if (element == null) { throw new ArgumentNullException("element"); } if (isComposition) { _compositionRegistry.TryRemove(element); _compositions.Remove(element); } else { _strategies.Remove(element); } var path = isComposition ? _compositionsPath : _strategiesPath; var file = Path.Combine(path, element.GetFileName()); if (File.Exists(file)) { File.Delete(file); } }
private void SelectElement(CompositionDiagramElement element, bool isCompositionSelected) { //StrategiesListBox.SelectedItem = element; DiagramEditorControl.Composition = element; _isCompositionSelected = isCompositionSelected; }
public CompositionDiagramElement Clone(CompositionDiagramElement element) { var settings = _compositionRegistry.Serialize(element); var clone = _compositionRegistry.Deserialize(settings); return(clone); }
private void SelectElement(CompositionDiagramElement element, bool isCompositionSelected) { //StrategiesListBox.SelectedItem = element; DiagramEditorControl.Composition = element; _isCompositionSelected = isCompositionSelected; }
public CompositionDiagramElement Discard(CompositionDiagramElement element, bool isComposition) { if (element == null) { throw new ArgumentNullException("element"); } var path = isComposition ? _compositionsPath : _strategiesPath; var file = Path.Combine(path, element.GetFileName()); var settings = _serializer.Deserialize(file); var discardedElement = _compositionRegistry.Deserialize(settings); if (isComposition) { // TODO discard in CompositionRegistry DiagramElements.Remove(element); DiagramElements.Add(discardedElement); var index = _compositions.IndexOf(element); _compositions[index] = discardedElement; } else { var index = _strategies.IndexOf(element); _strategies[index] = discardedElement; } return(discardedElement); }
private void OnDebuggerCompositionChanged(CompositionDiagramElement element) { this.GuiAsync(() => { DiagramEditor.Composition = element; }); }
public void Save(CompositionDiagramElement element, bool isComposition) { if (element == null) { throw new ArgumentNullException(nameof(element)); } if (!isComposition) { if (!_strategies.Contains(element)) { _strategies.Add(element); } } else { DiagramElements.Add(element); } var path = isComposition ? _compositionsPath : _strategiesPath; var settings = _compositionRegistry.Serialize(element); var file = Path.Combine(path, element.GetFileName()); _serializer.Serialize(settings, file); }
private string GetCompositionFileName(CompositionDiagramElement element) { #if DEBUG return(CheckCreatePath(Path.Combine(CompositionsPath, element.Name.Replace(" ", "") + "DiagramElement.xml"))); #else return(CheckCreatePath(Path.Combine(CompositionsPath, element.TypeId + ".xml"))); #endif }
public static string GetFileName(this CompositionDiagramElement element) { if (element == null) { throw new ArgumentNullException(nameof(element)); } return(element.TypeId.ToString().Replace("-", "_") + ".xml"); }
public OpenCompositionCommand(CompositionDiagramElement composition) { if (composition == null) { throw new ArgumentNullException(nameof(composition)); } Composition = composition; }
private void AddCommand_OnExecuted(object sender, ExecutedRoutedEventArgs e) { var element = new CompositionDiagramElement { Name = "New strategy" }; Added.SafeInvoke(this, element); }
public void RemoveComposition(CompositionDiagramElement element) { var file = GetCompositionFileName(element); if (File.Exists(file)) { File.Delete(file); } }
private void AddCommand_OnExecuted(object sender, ExecutedRoutedEventArgs e) { var element = new CompositionDiagramElement { Name = "New strategy" }; Added.SafeInvoke(this, element); }
public CompositionItem(CompositionType type, CompositionDiagramElement element) { if (element == null) { throw new ArgumentNullException(nameof(element)); } Type = type; Element = element; }
public void Reload(CompositionDiagramElement element, bool isComposition) { if (element == null) { throw new ArgumentNullException(nameof(element)); } var settings = _compositionRegistry.Serialize(element); _compositionRegistry.Load(element, settings); }
public void SaveComposition(CompositionDiagramElement element, SettingsStorage data) { try { File.WriteAllText(GetCompositionFileName(element), data.SaveSettingsStorage()); } catch (Exception ex) { this.AddErrorLog(LocalizedStrings.Str3635Params, ex); } }
private void AddCommand_OnExecuted(object sender, ExecutedRoutedEventArgs e) { var type = (CompositionType)e.Parameter; var element = new CompositionDiagramElement { Name = "New " + type.ToString().ToLower() }; _strategiesRegistry.Save(element, type == CompositionType.Composition); }
public void Discard(CompositionDiagramElement element, bool isComposition) { if (element == null) { throw new ArgumentNullException(nameof(element)); } var path = isComposition ? _compositionsPath : _strategiesPath; var file = Path.Combine(path, element.GetFileName()); var settings = _serializer.Deserialize(file); _compositionRegistry.Load(element, settings); }
private void OnCompositionChanged(CompositionDiagramElement composition) { composition.IsModifiable = false; if (Debugger != null) { _debuggerSettings = Debugger.Save(); } Debugger = new DiagramDebugger(composition); SafeLoadDebuggerSettings(); DiagramEditor.Composition = composition; }
public ExportCompositionWindow(CompositionDiagramElement composition) { if (composition == null) throw new ArgumentNullException("composition"); //_composition = new ExportDiagramElement(composition); var registry = ConfigManager.GetService<CompositionRegistry>(); var storage = registry.Serialize(composition); _composition = registry.DeserializeExported(storage); InitializeComponent(); PropertyGrid.SelectedObject = _composition; }
public SolutionExplorerItem(CompositionDiagramElement element, SolutionExplorerItem parent) : this(element.TypeId, element.Name, parent) { if (element == null) { throw new ArgumentNullException(nameof(element)); } if (parent == null) { throw new ArgumentNullException(nameof(parent)); } Element = new CompositionItem(parent.Type, element); Type = parent.Type; }
public void Remove(CompositionDiagramElement element, bool isComposition) { if (element == null) throw new ArgumentNullException("element"); if (isComposition) { _compositionRegistry.TryRemove(element); _compositions.Remove(element); } else _strategies.Remove(element); var path = isComposition ? _compositionsPath : _strategiesPath; var file = Path.Combine(path, element.GetFileName()); if (File.Exists(file)) File.Delete(file); }
public ExportCompositionWindow(CompositionDiagramElement composition) { if (composition == null) { throw new ArgumentNullException(nameof(composition)); } //_composition = new ExportDiagramElement(composition); var registry = ConfigManager.GetService <CompositionRegistry>(); var storage = registry.Serialize(composition); _composition = registry.DeserializeExported(storage); InitializeComponent(); PropertyGrid.SelectedObject = _composition; }
public SolutionExplorerItem(CompositionDiagramElement element, SolutionExplorerItem parent) : this(element.TypeId, element.Name, parent) { if (element == null) { throw new ArgumentNullException(nameof(element)); } if (parent == null) { throw new ArgumentNullException(nameof(parent)); } Type = parent.Type; Tooltip = element.Description; Element = new CompositionItem(parent.Type, element); Element.Element.PropertyChanged += OnElementPropertyChanged; }
public void Save(CompositionDiagramElement element, bool isComposition) { if (element == null) throw new ArgumentNullException(nameof(element)); if (!isComposition) { if (!_strategies.Contains(element)) _strategies.Add(element); } else DiagramElements.Add(element); var path = isComposition ? _compositionsPath : _strategiesPath; var settings = _compositionRegistry.Serialize(element); var file = Path.Combine(path, element.GetFileName()); CultureInfo.InvariantCulture.DoInCulture(() => _serializer.Serialize(settings, file)); }
private void CompositionPropertyChanged(CompositionDiagramElement newComposition) { if (newComposition != null) { _debugger = new DiagramDebugger(newComposition); _debugger.Break += OnDebuggerBreak; NoStrategyLabel.Visibility = Visibility.Hidden; DiagramEditor.Composition = newComposition; } else { _debugger = null; NoStrategyLabel.Visibility = Visibility.Visible; DiagramEditor.Composition = new CompositionDiagramElement { Name = string.Empty }; } DiagramEditor.Composition.IsModifiable = false; }
private void CompositionPropertyChanged(CompositionDiagramElement oldComposition, CompositionDiagramElement newComposition) { if (oldComposition != null) oldComposition.Changed -= CompositionChanged; if (newComposition != null) { NoStrategyLabel.Visibility = Visibility.Hidden; DiagramEditor.Composition = newComposition; newComposition.Changed += CompositionChanged; } else { NoStrategyLabel.Visibility = Visibility.Visible; DiagramEditor.Composition = new CompositionDiagramElement { Name = string.Empty }; } IsChanged = false; }
private void CompositionPropertyChanged(CompositionDiagramElement newComposition) { if (newComposition != null) { _debugger = new DiagramDebugger(newComposition); _debugger.Break += OnDebuggerBreak; NoStrategyLabel.Visibility = Visibility.Hidden; DiagramEditor.Composition = newComposition; } else { _debugger = null; NoStrategyLabel.Visibility = Visibility.Visible; DiagramEditor.Composition = new CompositionDiagramElement { Name = string.Empty }; } DiagramEditor.Composition.IsModifiable = false; }
private void CompositionPropertyChanged(CompositionDiagramElement oldComposition, CompositionDiagramElement newComposition) { if (oldComposition != null) { oldComposition.Changed -= CompositionChanged; } if (newComposition != null) { NoStrategyLabel.Visibility = Visibility.Hidden; DiagramEditor.Composition = newComposition; newComposition.Changed += CompositionChanged; } else { NoStrategyLabel.Visibility = Visibility.Visible; DiagramEditor.Composition = new CompositionDiagramElement { Name = string.Empty }; } IsChanged = false; }
public void Save(CompositionDiagramElement element, bool isComposition) { if (element == null) throw new ArgumentNullException("element"); if (!isComposition) { if (!_strategies.Contains(element)) _strategies.Add(element); } else { DiagramElements.Add(element); if (!_compositions.Contains(element)) _compositions.Add(element); } var path = isComposition ? _compositionsPath : _strategiesPath; var settings = _compositionRegistry.Serialize(element); var file = Path.Combine(path, element.GetFileName()); _serializer.Serialize(settings, file); }
public void Reload(CompositionDiagramElement element, bool isComposition) { if (element == null) throw new ArgumentNullException(nameof(element)); var settings = _compositionRegistry.Serialize(element); _compositionRegistry.Load(element, settings); }
public void Discard(CompositionDiagramElement element, bool isComposition) { if (element == null) throw new ArgumentNullException(nameof(element)); var path = isComposition ? _compositionsPath : _strategiesPath; var file = Path.Combine(path, element.GetFileName()); var settings = CultureInfo.InvariantCulture.DoInCulture(() => _serializer.Deserialize(file)); _compositionRegistry.Load(element, settings); }
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { var element = (CompositionDiagramElement)StrategiesComboBox.SelectedItem; Composition = element != null ? StrategiesRegistry.Clone(element) : null; }
private void OnDebuggerCompositionChanged(CompositionDiagramElement composition) { GuiDispatcher.GlobalDispatcher.AddAction(() => DiagramEditor.Composition = composition); }
private void ElementsControl_OnAdded(DiagramElementsControl ctrl, CompositionDiagramElement element) { _strategiesRegistry.Save(element, true); SelectElement(element, true); }
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { var element = (CompositionDiagramElement)StrategiesComboBox.SelectedItem; Composition = element != null?StrategiesRegistry.Clone(element) : null; }
private void ElementsControl_OnRemoved(DiagramElementsControl ctrl, CompositionDiagramElement element) { _strategiesRegistry.Remove(element, true); SelectElement(null, true); }
public CompositionDiagramElement Discard(CompositionDiagramElement element, bool isComposition) { if (element == null) throw new ArgumentNullException("element"); var path = isComposition ? _compositionsPath : _strategiesPath; var file = Path.Combine(path, element.GetFileName()); var settings = _serializer.Deserialize(file); var discardedElement = _compositionRegistry.Deserialize(settings); if (isComposition) { // TODO discard in CompositionRegistry DiagramElements.Remove(element); DiagramElements.Add(discardedElement); var index = _compositions.IndexOf(element); _compositions[index] = discardedElement; } else { var index = _strategies.IndexOf(element); _strategies[index] = discardedElement; } return discardedElement; }
private void ElementsControl_OnSelected(DiagramElementsControl ctrl, CompositionDiagramElement element) { CheckIsStrategyChanged(); SelectElement(element, true); }
private void OnCompositionChanged(CompositionDiagramElement composition) { composition.IsModifiable = false; if (Debugger != null) _debuggerSettings = Debugger.Save(); Debugger = new DiagramDebugger(composition); SafeLoadDebuggerSettings(); DiagramEditor.Composition = composition; }
private void OnDebuggerCompositionChanged(CompositionDiagramElement composition) { GuiDispatcher.GlobalDispatcher.AddAction(() => DiagramEditor.Composition = composition); }
private void AddCommand_OnExecuted(object sender, ExecutedRoutedEventArgs e) { var type = (CompositionType)e.Parameter; var element = new CompositionDiagramElement { Name = "New " + type.ToString().ToLower() }; var item = new CompositionItem(type, element); _strategiesRegistry.Save(item); OpenComposition(item); }
private void ElementsControl_OnAdded(DiagramElementsControl ctrl, CompositionDiagramElement element) { _strategiesRegistry.Save(element, true); SelectElement(element, true); }
public CompositionDiagramElement Clone(CompositionDiagramElement element) { var settings = _compositionRegistry.Serialize(element); var clone = _compositionRegistry.Deserialize(settings); return clone; }
private void ElementsControl_OnRemoved(DiagramElementsControl ctrl, CompositionDiagramElement element) { _strategiesRegistry.Remove(element, true); SelectElement(null, true); }
private void ElementsControl_OnSelected(DiagramElementsControl ctrl, CompositionDiagramElement element) { CheckIsStrategyChanged(); SelectElement(element, true); }