Example #1
0
 virtual public bool OnUpdateCommand(string MenuId, CommandState CommandState)
 {   // OnUpdateCommand klappert rückwärts durch den Action Stack
     // und ruft die einzelnen OnUpdateCommand auf, bis einer reagiert
     // das ist notwendig, da SelectObjectsAction einiges ein und ausschaltet
     // und sonst während des Zeichnens das Verschieben aktiv ist.
     try
     {
         object[] ar = Actions.ToArray();
         // top of stack wird 0
         for (int i = 0; i < ar.Length; ++i)
         {
             Action a = ar[i] as Action;
             if (a != null && a.OnUpdateCommand(MenuId, CommandState))
             {
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {   // der ActionStack ist der Verteiler der MouseMessages. Falls dort eine Exception auftritt
         // wird die hier gefangen und stört nicht weiter. Das ist eine Forderung von ERSA. Ggf.
         // hier eine Möglichkeit die Exceeption doch noch weiterzureichen vorsehen.
         if (ex is ThreadAbortException)
         {
             throw (ex);
         }
     }
     return(false);
 }
Example #2
0
 virtual public bool OnCommand(string MenuId)
 {   // siehe OnUpdateCommand ...
     try
     {
         object[] ar = Actions.ToArray();
         for (int i = 0; i < ar.Length; ++i)
         {
             Action a = ar[i] as Action;
             if (a != null && a.OnCommand(MenuId))
             {
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {   // der ActionStack ist der Verteiler der MouseMessages. Falls dort eine Exception auftritt
         // wird die hier gefangen und stört nicht weiter. Das ist eine Forderung von ERSA. Ggf.
         // hier eine Möglichkeit die Exceeption doch noch weiterzureichen vorsehen.
         if (ex is ThreadAbortException)
         {
             throw (ex);
         }
     }
     return(false);
 }
Example #3
0
 public void OnMouseMove(MouseEventArgs e, IView View)
 {
     try
     {
         Action a = (Actions.Count > 0) ? (Action)Actions.Peek() : null;
         if (a != null && a.AcceptMouseInput(View))
         {
             a.SetCurrentMouseView(View);
             a.OnMouseMove(e, View);
         }
         else
         {
             View.SetCursor("No");
         }
         ++liceneseCounter; // overflow macht nix, ausprobiert!
         if (liceneseCounter % 5000 == 10)
         {
         }
     }
     catch (Exception ex)
     {   // der ActionStack ist der Verteiler der MouseMessages. Falls dort eine Exception auftritt
         // wird die hier gefangen und stört nicht weiter. Das ist eine Forderung von ERSA. Ggf.
         // hier eine Möglichkeit die Exceeption doch noch weiterzureichen vorsehen.
         if (ex is ThreadAbortException)
         {
             throw (ex);
         }
     }
 }
Example #4
0
 public override void OnInactivate(Actions.Action NewActiveAction, bool RemovingAction)
 {
     if (shell.Layer != null)
     {
         shell.Layer.Transparency = 0;
     }
     base.OnInactivate(NewActiveAction, RemovingAction);
 }
Example #5
0
 public override void OnActivate(Actions.Action OldActiveAction, bool SettingAction)
 {
     if (shell.Layer != null)
     {
         shell.Layer.Transparency = 128;
     }
     base.OnActivate(OldActiveAction, SettingAction);
 }
Example #6
0
 public override void OnInactivate(Action NewActiveAction, bool RemovingAction)
 {
     if (!RemovingAction)
     {
         base.RemoveThisAction();
     }
     base.OnInactivate(NewActiveAction, RemovingAction);
 }
Example #7
0
 internal Action PrevoiusAction(Action action)
 {
     object[] allAction = Actions.ToArray();
     for (int i = 0; i < allAction.Length - 1; ++i)
     {
         if (allAction[i] == action)
         {
             return(allAction[i + 1] as Action);
         }
     }
     return(null);
 }
Example #8
0
        public void SetAction(Action Action)
        {
            //			if (!Action.WorksOnLayoutView)
            //			{	// das ist jetzt besser gelöst mit "OnlyThisView" etc.
            //				frame.AssureModelView(); // geht nur mit ModelView!
            //			}
            if (Action.ChangeTabInControlCenter)
            {
                Action.returnToTabPage = frame.GetActivePropertyDisplay();
                frame.ShowPropertyDisplay("Action");
            }
            Action.ActionStack = this;
            Action.OnSetAction(); // erstes Ereigniss für die neue Aktion (noch nicht auf dem Stack)
            Frame.RaiseActionStartedEvent(Action);
            Action OldAction = null;

            if (Actions.Count > 0)
            {
                OldAction = Actions.Peek() as Action;
            }
            // folgende Schleife ist notwendig, da bei Inactivate eine Aktion sich
            // selbst entfernen kann. Dann aber bekommt die drunterliegende ein Activate
            // was gleich wieder von einem Inactivate gefolgt werden muss
            while (OldAction != null)
            {
                OldAction.OnInactivate(Action, false); // alte Aktion inaktivieren (kann sich auch verabschieden)
                if (Actions.Count > 0)
                {
                    if (OldAction != Actions.Peek())
                    {
                        OldAction = Actions.Peek() as Action;
                    }
                    else
                    {
                        OldAction = null;
                    }
                }
                else
                {
                    OldAction = null;
                }
            }
            Actions.Push(Action);
            Action.OnActivate(OldAction, true);
        }
Example #9
0
 public void OnMouseWheel(MouseEventArgs e, IView View)
 {
     try
     {
         Action a = (Actions.Count > 0) ? (Action)Actions.Peek() : null;
         if (a != null && a.AcceptMouseInput(View))
         {
             a.OnMouseWheel(e, View);
         }
     }
     catch (Exception ex)
     {   // der ActionStack ist der Verteiler der MouseMessages. Falls dort eine Exception auftritt
         // wird die hier gefangen und stört nicht weiter. Das ist eine Forderung von ERSA. Ggf.
         // hier eine Möglichkeit die Exceeption doch noch weiterzureichen vorsehen.
         if (ex is ThreadAbortException)
         {
             throw (ex);
         }
     }
 }
Example #10
0
 public void OnMouseUp(MouseEventArgs e, IView View)
 {
     try
     {
         Action a = (Actions.Count > 0) ? (Action)Actions.Peek() : null;
         if (a != null && a.AcceptMouseInput(View))
         {
             a.SetCurrentMouseView(View);
             a.OnMouseUp(e, View);
         }
         {   // folgende Zeile nur zum Aufwecken der open cascade dll
             // dmit die Prüfung der Lizenz stattfindet
         }
     }
     catch (Exception ex)
     {   // der ActionStack ist der Verteiler der MouseMessages. Falls dort eine Exception auftritt
         // wird die hier gefangen und stört nicht weiter. Das ist eine Forderung von ERSA. Ggf.
         // hier eine Möglichkeit die Exceeption doch noch weiterzureichen vorsehen.
         if (ex is ThreadAbortException)
         {
             throw (ex);
         }
     }
 }
Example #11
0
        public void RemoveActiveAction()
        {
            Action Action = ActiveAction;

            if (Action != null)
            {
                Action.OnInactivate(null, true);
                Actions.Pop();
                if (Action.ChangeTabInControlCenter)
                {
                    frame.ShowPropertyDisplay(Action.returnToTabPage);
                }
                Action NewActiveAction = ActiveAction;
                if (NewActiveAction != null)
                {
                    NewActiveAction.OnActivate(Action, false);
                }
                Action.OnRemoveAction();
                Frame.RaiseActionTerminatedEvent(Action);
            }
            else
            {
                throw new ActionException("RemoveActiveAction: There is no Action object on the action stack");
            }
            // der Autonmatismus, der eine Aktion automatisch wiederholen lässt.
            if (Action.AutoRepeat())
            {   // die Aktion soll automatisch wiederholt werden.
                System.Reflection.ConstructorInfo ci = Action.GetType().GetConstructor(new Type[] { });
                if (ci != null)
                {
                    object repaction = ci.Invoke(new object[] { });
                    if (repaction != null && repaction is Action)
                    {
                        (repaction as Action).AutoRepeated();
                        this.SetAction(repaction as Action);
                    }
                }
                else
                {       // 2. Versuch: gibt es einen Kontruktor, der genau den gleichen Aktionstyp als einzigen Parameter nimmt
                    ci = Action.GetType().GetConstructor(new Type[] { Action.GetType() });
                    if (ci != null)
                    {
                        try
                        {
                            object repaction = ci.Invoke(new object[] { Action });
                            if (repaction != null && repaction is Action)
                            {
                                (repaction as Action).AutoRepeated();
                                this.SetAction(repaction as Action);
                            }
                        }
                        catch (Exception e)
                        {
                            if (e is ThreadAbortException)
                            {
                                throw (e);
                            }
                        }
                    }
                }
            }
        }