Esempio n. 1
0
        public MainWindow()
        {
            InitializeComponent();
            SizeToContent = System.Windows.SizeToContent.Manual;
            MaxHeight     = SystemParameters.WorkArea.Height;

            LayersWidgets             = new ObservableCollection <LayerWidget>();
            widgetsCanvas.DataContext = this;

            #region Button&Mouse Events
            // MainCanvas mouse events
            mainCanvas.MouseMove  += new MouseEventHandler(MainCanvas_MouseMove);
            mainCanvas.MouseWheel += new MouseWheelEventHandler(MainCanvas_MouseWheel);
            // System buttons
            MinimizeButton_Black.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(MinimizeButtonUp), true);
            CloseButton_Black.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(CloseButtonUp), true);
            MaximizeButton_Black.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(MaximizeButtonUp), true);
            //MaximizeButtonOFF.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(MaximizeButtonUp), true);
            // Navigator buttons
            AddPhotoButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(ButtonOpenPhoto_Click), true);
            ArrowButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(Arrow_Selected), true);
            ResizeButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(Resize_Selected), true);
            RotateButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(Rotate_Click), true);

            FillButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(Fill_Selected), true);
            EraseButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(Erase_Selected), true);
            BrushButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(Brush_Selected), true);
            // Layers
            LayerUpButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(MoveLayerUp), true);
            LayerDownButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(MoveLayerDown), true);
            AddLayerButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(NewLayer_Click), true);
            DeleteLayerButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(DeleteLayer_Click), true);
            // Effects
            GrayscaleButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(Grayscale_Click), true);
            NegativeButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(Negative_Click), true);
            GaussianBlurButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(GaussianBlur_Click), true);
            SobelEffectButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(SobelFilter_Click), true);
            SobelEffectGrayScaleButton.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(SobelFilterGrayscale_Click), true);
            #endregion

            Hide();
            Start StartWindow = new Start();
            StartWindow.Show();
            KeyDown += OnKeyDownHandler;
            KeyUp   += OnKeyUpHandler;
        }