/// <summary>
        /// Checks if the client can do the command</summary>
        /// <param name="commandTag">Command</param>
        /// <returns>True if client can do the command</returns>
        bool ICommandClient.CanDoCommand(object commandTag)
        {
            bool canDo = false;

            if (commandTag is StandardCommand)
            {
                IViewingContext viewingContext = m_contextRegistry.GetActiveContext <IViewingContext>();

                switch ((StandardCommand)commandTag)
                {
                case StandardCommand.ViewFrameSelection:
                    ISelectionContext selectionContext = m_contextRegistry.GetActiveContext <ISelectionContext>();
                    if (viewingContext != null && selectionContext != null)
                    {
                        canDo = viewingContext.CanFrame(selectionContext.Selection);
                    }
                    break;

                case StandardCommand.ViewFrameAll:
                    IEnumerableContext enumerableContext = m_contextRegistry.GetActiveContext <IEnumerableContext>();
                    if (viewingContext != null && enumerableContext != null)
                    {
                        canDo = viewingContext.CanFrame(enumerableContext.Items);
                    }
                    break;
                }
            }

            return(canDo);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Frames the selection</summary>
 /// <param name="viewingContext">Active viewing context</param>
 /// <param name="items">Selected items</param>
 public void FrameSelection(IViewingContext viewingContext, IEnumerable<object> items)
 {
     if (viewingContext != null)
     {
         if (viewingContext.CanFrame(items))
             viewingContext.Frame(items);
     }
 }
 /// <summary>
 /// Frames the selection</summary>
 /// <param name="viewingContext">Active viewing context</param>
 /// <param name="items">Selected items</param>
 public void FrameSelection(IViewingContext viewingContext, IEnumerable <object> items)
 {
     if (viewingContext != null)
     {
         if (viewingContext.CanFrame(items))
         {
             viewingContext.Frame(items);
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Frames items</summary>
 /// <param name="viewingContext">Active viewing context</param>
 /// <param name="items">Items to be framed</param>
 public void FrameAll(IViewingContext viewingContext, IEnumerable<object> items)
 {
     if (items != null &&
         viewingContext != null)
     {
         if (viewingContext.CanFrame(items))
             viewingContext.Frame(items);
     }
 }