public ContentMenuCommandService(IContentMenuService contentMenuService, IUnitOfWork unitOfWork, ICommandExecutor executor)
 {
   _contentMenuService = contentMenuService;
   _unitOfWork = unitOfWork;
   _executor = executor;
   _userSession = new UserSession();
 }
 public ContentMenuCommandService(IContentMenuService contentMenuService, IUnitOfWork unitOfWork, ICommandExecutor executor)
 {
     _contentMenuService = contentMenuService;
     _unitOfWork         = unitOfWork;
     _executor           = executor;
     _userSession        = new UserSession();
 }
Exemplo n.º 3
0
        /// <summary>
        /// 构建插件单元
        /// </summary>
        /// <param name="caller">调用者</param>
        /// <param name="context">上下文,用于存放在构建时需要的组件</param>
        /// <param name="element">插件单元</param>
        /// <param name="subItems">被构建的子对象列表</param>
        /// <returns>构建好的插件单元</returns>
        public object BuildItem(object caller, WorkItem context, AddInElement element, ArrayList subItems)
        {
            IContentMenuService cmbService = context.Services.Get <IContentMenuService>();

            if (cmbService == null)
            {
                throw new UniframeworkException(String.Format("未注册IContentMenuBarService无法创建上下文菜单 \"{0}\"。", element.Name));
            }

            BarSubItem item = new BarSubItem();

            item.Name    = element.Name;
            item.Tag     = element.Path;
            item.Manager = BuilderUtility.GetBarManager(context); // 设置工具栏管理器
            string exPath = BuilderUtility.CombinPath(element.Path, element.Id);

            cmbService.RegisterContentMenu(exPath, item);

            // 添加插件单元到系统中
            if (!String.IsNullOrEmpty(element.Path) && context.UIExtensionSites.Contains(element.Path))
            {
                context.UIExtensionSites[element.Path].Add(item);
            }
            if (!String.IsNullOrEmpty(element.Command))
            {
                Command cmd = BuilderUtility.GetCommand(context, element.Command);
                if (cmd != null)
                {
                    cmd.AddInvoker(item, "Popup");
                }
            }

            context.UIExtensionSites.RegisterSite(exPath, item);
            return(item);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 控件的鼠标释放事件在这里处理架构右键菜单
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
 private void Control_MouseUp(object sender, MouseEventArgs e)
 {
     if (workItem != null && e.Button == MouseButtons.Right)
     {
         Control control = sender as Control;
         if (control != null)
         {
             string exPath = (string)control.Tag;
             IContentMenuService contentService = workItem.Services.Get <IContentMenuService>(); // 上下文菜单服务
             if (!String.IsNullOrEmpty(exPath) && contentService != null)
             {
                 PopupMenu content = contentService.GetContentMenu(exPath) as PopupMenu;
                 if (content != null)
                 {
                     // DevExpress TreeList 控件
                     if (control is TreeList)
                     {
                         TreeListHitInfo hi = ((TreeList)control).CalcHitInfo(new Point(e.X, e.Y));
                         if (hi.HitInfoType == HitInfoType.Row || hi.HitInfoType == HitInfoType.Cell || hi.HitInfoType == HitInfoType.Empty)
                         {
                             content.ShowPopup(Control.MousePosition);
                         }
                     }
                     else if (control is GridControl)   // DevExpress GridControl控件
                     {
                         GridHitInfo hi = ((GridControl)control).MainView.CalcHitInfo(new Point(e.X, e.Y)) as GridHitInfo;
                         if (hi != null)
                         {
                             string hitTest = hi.HitTest.ToString();
                             if (hi.InRow || hi.InRowCell || hitTest == EMPTYROW)
                             {
                                 content.ShowPopup(Control.MousePosition);
                             }
                         }
                         else
                         {
                             content.ShowPopup(Control.MousePosition);
                         }
                     }
                     else
                     {
                         content.ShowPopup(Control.MousePosition);
                     }
                 }
             }
         }
     }
 }
 public ContentMenuReportService(ICommandExecutor executor, IContentMenuService contentMenuService)
 {
   _executor = executor;
   _contentMenuService = contentMenuService;
   _userSession = new UserSession();
 }
Exemplo n.º 6
0
 public ContentMenuReportService(ICommandExecutor executor, IContentMenuService contentMenuService)
 {
     _executor           = executor;
     _contentMenuService = contentMenuService;
     _userSession        = new UserSession();
 }