コード例 #1
0
        public static void Behavioral_CommandDemo2()
        {
            //var videoEditor = new VideoEditor();
            //videoEditor.SetText("demo2 video text");
            //videoEditor.SetContrast(0.7f);
            //var result = videoEditor.ToString();
            //Console.WriteLine(result);

            var videoEditor = new VideoEditor();
            var history     = new Command.Demo2.History();

            var setTextCommand = new SetTextCommand("Video Title", videoEditor, history);

            setTextCommand.Execute();
            Console.WriteLine("TEXT: " + videoEditor);

            var setContrast = new SetContrastCommand(1, videoEditor, history);

            setContrast.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);
        }