Пример #1
0
        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);
 }