Ejemplo n.º 1
0
        void onClicked(object sender, RoutedEventArgs e)
        {
            var tag = (e.Source as Button).Tag;

              if (tag.Equals("Exit"))
            Close();
              else if (tag.Equals("Save")) {
            SaveFileDialog dialog = new SaveFileDialog();
            if (dialog.ShowDialog() == true) {
              img.saveAs(dialog.FileName);
            }
              } else if (tag.Equals("Open")) {
            OpenFileDialog dialog = new OpenFileDialog();
            if (dialog.ShowDialog() == true) {
              img = new MyImage(dialog.FileName);
            }
              } else if (tag.Equals("Resize")) {
            SizeBox sb = new SizeBox(img.width, img.height);
            if (sb.ShowDialog() == true) {
              img.resize(sb.width, sb.height);
              InvalidateVisual();
            }
              } else if (tag.Equals("incBr")) {
            img.changeBrightness(+5);
            InvalidateVisual();
              } else if (tag.Equals("decBr")) {
            img.changeBrightness(-5);
            InvalidateVisual();
              } else if (tag.Equals("incCon")) {
            img.changeContrast(+5);
            InvalidateVisual();
              } else if (tag.Equals("decCon")) {
            img.changeContrast(-5);
            InvalidateVisual();
              } else if (tag.Equals("Flip90")) {
            img.rotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone);
            InvalidateVisual();
              } else if (tag.Equals("Mirror")) {
            img.rotateFlip(System.Drawing.RotateFlipType.RotateNoneFlipY);
            InvalidateVisual();
              }
        }
Ejemplo n.º 2
0
 void onClicked(object sender, ToolBarButtonClickEventArgs e)
 {
     if (e.Button.Tag.Equals("Exit"))
     Close();
       else if (e.Button.Tag.Equals("Save")) {
     SaveFileDialog dialog = new SaveFileDialog();
     if (dialog.ShowDialog(this) == DialogResult.OK) {
       img.saveAs(dialog.FileName);
     }
       } else if (e.Button.Tag.Equals("Open")) {
     OpenFileDialog dialog = new OpenFileDialog();
     if (dialog.ShowDialog(this) == DialogResult.OK) {
       img = new MyImage(dialog.FileName);
     }
       } else if (e.Button.Tag.Equals("Resize")) {
     SizeBox sb = new SizeBox(img.width, img.height);
     if (sb.ShowDialog(this) == DialogResult.OK) {
       img.resize(sb.width, sb.height);
       Refresh();
     }
       } else if (e.Button.Tag.Equals("incBr")) {
     img.changeBrightness(+5);
     Refresh();
       } else if (e.Button.Tag.Equals("decBr")) {
     img.changeBrightness(-5);
     Refresh();
       } else if (e.Button.Tag.Equals("incCon")) {
     img.changeContrast(+5);
     Refresh();
       } else if (e.Button.Tag.Equals("decCon")) {
     img.changeContrast(-5);
     Refresh();
       } else if (e.Button.Tag.Equals("Flip90")) {
     img.rotateFlip(RotateFlipType.Rotate90FlipNone);
     Refresh();
       } else if (e.Button.Tag.Equals("Mirror")) {
     img.rotateFlip(RotateFlipType.RotateNoneFlipY);
     Refresh();
       }
 }