/// <summary> /// Unregisters a command target visitor. /// </summary> /// <param name='visitor'> /// The visitor. /// </param> public void UnregisterCommandTargetVisitor (ICommandTargetVisitor visitor) { visitors.Remove (visitor); }
/// <summary> /// Registers a command target visitor. /// </summary> /// <param name='visitor'> /// The visitor. /// </param> /// <remarks> /// Command target visitors can be used to visit the whole active command route /// to perform custom actions on the objects of the route. The command manager /// periodically visits the command route. The visit frequency varies, but it /// is usually at least once a second. /// </remarks> public void RegisterCommandTargetVisitor (ICommandTargetVisitor visitor) { visitors.Add (visitor); StartStatusUpdater (); }
/// <summary> /// Visits the active command route /// </summary> /// <returns> /// Visitor result /// </returns> /// <param name='visitor'> /// Visitor. /// </param> /// <param name='initialTarget'> /// Initial target (provide null to use the default initial target) /// </param> public object VisitCommandTargets (ICommandTargetVisitor visitor, object initialTarget) { CommandTargetRoute targetRoute = new CommandTargetRoute (initialTarget); object cmdTarget = GetFirstCommandTarget (targetRoute); visitor.Start (); try { while (cmdTarget != null) { if (visitor.Visit (cmdTarget)) return cmdTarget; cmdTarget = GetNextCommandTarget (targetRoute, cmdTarget); } } catch (Exception ex) { LoggingService.LogError ("Error while visiting command targets", ex); } finally { visitor.End (); } return null; }
public object VisitCommandTargets (ICommandTargetVisitor visitor, object initialTarget) { CommandTargetRoute targetRoute = new CommandTargetRoute (initialTarget); object cmdTarget = GetFirstCommandTarget (targetRoute); while (cmdTarget != null) { if (visitor.Visit (cmdTarget)) return cmdTarget; cmdTarget = GetNextCommandTarget (targetRoute, cmdTarget); } visitor.Visit (null); return null; }
public void RegisterCommandTargetVisitor (ICommandTargetVisitor visitor) { visitors.Add (visitor); if (enableToolbarUpdate && !toolbarUpdaterRunning) { GLib.Timeout.Add (500, new GLib.TimeoutHandler (UpdateStatus)); toolbarUpdaterRunning = true; } }
/// <summary> /// Unregisters a command target visitor. /// </summary> /// <param name='visitor'> /// The visitor. /// </param> public void UnregisterCommandTargetVisitor (ICommandTargetVisitor visitor) { visitors.Remove (visitor); StopStatusUpdaterIfNeeded (); }