コード例 #1
0
ファイル: Commander.cs プロジェクト: 15835229565/flavor-ms
        protected void SubscribeToUndo(EventHandler handler)
        {
            ProgramEventHandler ph = s => realizer.Undo -= handler;

            ph      += s => this.ProgramStateChanged -= ph;
            handler += (s, e) => {
                realizer.Undo            -= handler;
                this.ProgramStateChanged -= ph;
            };
            realizer.Undo            += handler;
            this.ProgramStateChanged += ph;
        }
コード例 #2
0
        void customMapsControl_OpenCustomMap(string mapFileName)
        {
            var oldProfileMenu = Program.Instance.ProfileMenuDefault;

            Program.Instance.ProfileMenuDefault = ProfileMenuType.MainMenu;
            Program.Instance.Profile            = Profile.NewDeveloper();
            var game = new Game.Game(mapFileName);

            Program.Instance.ProgramState = game;
            ProgramEventHandler p = null;

            p = (e) => {
                if (e.Type == ProgramEventType.ProgramStateChanged)
                {
                    Program.Instance.ProfileMenuDefault = oldProfileMenu;
                    Program.Instance.ProgramEvent      -= p;
                }
            };
            Program.Instance.ProgramEvent += p;
        }
コード例 #3
0
 public void Remove(ProgramEventHandler handler)
 {
     _removeAction(handler);
 }
コード例 #4
0
 public void Add(ProgramEventHandler handler)
 {
     _addAction(handler);
 }