Exemplo n.º 1
0
        public MainViewModel()
        {
            LoadCmd  = new Command(LoadCommand);
            SaveCmd  = new Command(SaveCommand);
            ResetCmd = new Command(ResetCommand);

            GrayScaleCmd    = new GrayScaleCommand(() => Image);
            BlurCmd         = new BlurCommand(() => Image);
            LogCmd          = new LogCommand(() => Image);
            ContrastCmd     = new ContrastCommand(() => Image);
            FlipCmd         = new FlipCommand(() => Image);
            NegateCmd       = new NegateCommand(() => Image);
            SobelEdgesCmd   = new SobelEdgeDetectionCommand(() => Image);
            ImpulseNoiseCmd = new ImpulseNoiseCommand(() => Image);
            EdgesCmd        = new EdgeDetectionCommand(() => Image);

            FlipCmd.OnImageChanged += img => Image = img;
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var videoEditor = new VideoEditor();
            var history     = new History();


            var setTextCommand = new LabelCommand("label", history, videoEditor);

            setTextCommand.execute();
            Console.WriteLine("Text: " + videoEditor);

            setTextCommand = new LabelCommand("New Label", history, videoEditor);
            setTextCommand.execute();
            Console.WriteLine("Text: " + videoEditor);


            var setContrastCommand = new ContrastCommand(100.65f, history, videoEditor);

            setContrastCommand.execute();
            Console.WriteLine("Contrast: " + videoEditor);

            setContrastCommand = new ContrastCommand(1.05f, history, videoEditor);
            setContrastCommand.execute();
            Console.WriteLine("Contrast: " + videoEditor);


            var undoCommand = new UndoCommand(history);

            undoCommand.execute();
            Console.WriteLine("Undo: " + videoEditor);

            undoCommand.execute();
            Console.WriteLine("Undo: " + videoEditor);

            undoCommand.execute();
            Console.WriteLine("Undo: " + videoEditor);

            Console.ReadLine();
        }