public GraphEditDialog(ILogger logger, ColorProfile colorProfile, Graph graph, GraphEditDialogViewModel viewModel) { DataContext = viewModel; this.logger = logger; this.colorProfile = colorProfile; this.graph = graph; this.viewModel = viewModel; // initialize viewmodel viewModel.Name = graph.Name; viewModel.Shape = new ShapeSelection() { Shape = graph.Shape, Color = colorProfile.GetColorFromShape(graph.Shape) }; viewModel.Content = graph.Content; InitializeComponent(); }
private void Graphs_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { graphListItems.Clear(); foreach (var graph in graphs) { graphListItems.Add(new GraphListItem(graph, colorProfile.GetColorFromShape(graph.Shape))); if (e.Action == NotifyCollectionChangedAction.Add) { foreach (Graph g in e.NewItems) { foreach (var s in g.Strokes) { if (!strokes.Contains(s)) { strokes.Add(s); } } } } } }
private void ProcessColor(Graph graph) { SetColor(graph.Strokes, colorProfile.GetColorFromShape(graph.Shape)); }