public WindowDrawing() { InitializeComponent(); DataContext = new VueModele(); this.Loaded += WindowDrawing_Loaded; DrawingService.OnResizeCanvas += OnResizeCanvas; }
private void DupliquerSelection(object sender, RoutedEventArgs e) { VueModele vueModele = ((VueModele)this.DataContext); List <CustomStroke> selectedStrokes = vueModele.Traits.Where(stroke => ((CustomStroke)stroke).isSelected()).Cast <CustomStroke>().ToList(); //If no stroke is selected ==> Cut/Paste operation if (selectedStrokes.Count == 0) { vueModele.Traits.Add(ClipBoard); ClipBoard.ToList().ForEach(stroke => { EditionSocket.AddStroke(((Savable)stroke).toJson()); Editeur.instance.Do(new NewStroke(((CustomStroke)stroke).Id.ToString(), ((Savable)stroke).toJson())); }); ClipBoard.Clear(); } else { EditionSocket.UnlockStrokes(); vueModele.editeur.EditingStroke = null; selectedStrokes.ForEach(stroke => { CustomStroke duplicate = stroke.Duplicate(); ((VueModele)this.DataContext).Traits.Add(duplicate); duplicate.Select(); EditionSocket.AddStroke(((Savable)duplicate).toJson()); Editeur.instance.Do(new NewStroke(((CustomStroke)duplicate).Id.ToString(), ((Savable)duplicate).toJson())); }); } }
public FenetreDessin() { InitializeComponent(); DataContext = new VueModele(); ClipBoard = new StrokeCollection(); ((VueModele)DataContext).PropertyChanged += new PropertyChangedEventHandler(EditeurProprieteModifiee); }
public FenetreDessin() { InitializeComponent(); DataContext = new VueModele(); (DataContext as VueModele).SendCanvas(this.surfaceDessin); this.surfaceDessin.AllowSelection = false; this.surfaceDessin.IsDraging = false; }
private void Canvas_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e) { VueModele vueModele = ((VueModele)this.DataContext); //Empiler la modification if (e.Stroke is Savable && !((CustomStroke)e.Stroke).isLocked()) { CustomStroke erasedStroke = (CustomStroke)e.Stroke; vueModele.editeur.Do(new DeleteStroke(erasedStroke.Id.ToString(), ((Savable)erasedStroke).toJson())); EditionSocket.RemoveStroke(erasedStroke.Id.ToString()); } else if (((CustomStroke)e.Stroke).isLocked()) { e.Cancel = true; } }
private void SupprimerSelection(object sender, RoutedEventArgs e) { VueModele vueModele = ((VueModele)this.DataContext); vueModele.editeur.EditingStroke = null; var selectedStrokes = vueModele.Traits.Where(stroke => ((CustomStroke)stroke).isSelected()).ToList(); if (selectedStrokes.Count > 0) { ClipBoard.Clear(); selectedStrokes.ForEach(stroke => { vueModele.Traits.Remove(stroke); ClipBoard.Add(stroke); EditionSocket.RemoveStroke(((CustomStroke)stroke).Id.ToString()); Editeur.instance.Do(new DeleteStroke(((CustomStroke)stroke).Id.ToString(), ((Savable)stroke).toJson())); }); } }
public LineEdit(VueModele vueModele) { this.DataContext = vueModele; InitializeComponent(); }
public FenetreDessin() { InitializeComponent(); DataContext = new VueModele(); }
void HistoryPopup_Loaded(object sender, RoutedEventArgs e) { dataContext = DataContext as VueModele; }