コード例 #1
0
 public WindowDrawing()
 {
     InitializeComponent();
     DataContext  = new VueModele();
     this.Loaded += WindowDrawing_Loaded;
     DrawingService.OnResizeCanvas += OnResizeCanvas;
 }
コード例 #2
0
        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()));
                });
            }
        }
コード例 #3
0
        public FenetreDessin()
        {
            InitializeComponent();
            DataContext = new VueModele();
            ClipBoard   = new StrokeCollection();

            ((VueModele)DataContext).PropertyChanged += new PropertyChangedEventHandler(EditeurProprieteModifiee);
        }
コード例 #4
0
 public FenetreDessin()
 {
     InitializeComponent();
     DataContext = new VueModele();
     (DataContext as VueModele).SendCanvas(this.surfaceDessin);
     this.surfaceDessin.AllowSelection = false;
     this.surfaceDessin.IsDraging      = false;
 }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        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()));
                });
            }
        }
コード例 #7
0
 public LineEdit(VueModele vueModele)
 {
     this.DataContext = vueModele;
     InitializeComponent();
 }
コード例 #8
0
 public FenetreDessin()
 {
     InitializeComponent();
     DataContext = new VueModele();
 }
コード例 #9
0
 void HistoryPopup_Loaded(object sender, RoutedEventArgs e)
 {
     dataContext = DataContext as VueModele;
 }