Пример #1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Button b = sender as Button;
     artist.DropSurface();
     Unsubscriber(sender as Button);
     switch (b.Name)
     {
         case "free":
             artist = new FreeDraw(drawCanvas);
             break;
         case "line":
             artist = new LineDraw(drawCanvas);
             break;
         case "rect":
             artist = new RectDraw(drawCanvas);
             break;
         case "circle":
             artist = new CircleDraw(drawCanvas);
             break;
     }
     drawCanvas.MouseLeftButtonDown += artist.StartDrawing;
     drawCanvas.MouseMove += artist.Drawing;
     drawCanvas.MouseLeftButtonUp += artist.EndDrawing;
 }
Пример #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            artist = new FreeDraw(drawCanvas);
            drawCanvas.MouseLeftButtonDown += artist.StartDrawing;
            drawCanvas.MouseMove += artist.Drawing;
            drawCanvas.MouseLeftButtonUp += artist.EndDrawing;

            fileWorker = new FileWorker(drawCanvas);
            openFile.Click += fileWorker.OpenFile;
            saveFile.Click += fileWorker.SaveFile;
            editor = new ImageEditor(drawCanvas, statusBar);
            colorInvert.Click += SlowImageOperation;
            vertical.Click += SlowImageOperation;
            horizontal.Click += SlowImageOperation;
            rotation90.Click += SlowImageOperation;
            rotation180.Click += SlowImageOperation;
            this.Closing += MainWindow_Closing;
            exit.Click += (n, m) =>
            {
                this.Close();
            };
        }