Exemplo n.º 1
0
 private void lvwTemplates_MouseUp(object sender, MouseEventArgs e)
 {
     if ((e.Button == MouseButtons.Right) && (this.lvwTemplates.SelectedItems.Count == 1))
     {
         DEBusinessItem tag = (DEBusinessItem)this.lvwTemplates.SelectedItems[0].Tag;
         if (tag.Iteration == null)
         {
             tag = PLItem.Agent.GetBizItemByMaster(tag.Master.Oid, tag.Revision.Revision, PLOption.GetUserGlobalOption(this.user.Oid).CurView, this.user.Oid, BizItemMode.BizItem) as DEBusinessItem;
         }
         this.BuildContextMenu(tag).Show(this.lvwTemplates, new Point(e.X, e.Y));
     }
 }
Exemplo n.º 2
0
 public void OpenTemplateEx(DEBusinessItem item)
 {
     if (item.Iteration == null)
     {
         item = PLItem.Agent.GetBizItemByMaster(item.Master.Oid, item.Revision.Revision, PLOption.GetUserGlobalOption(ClientData.LogonUser.Oid).CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem) as DEBusinessItem;
     }
     if (this.readOnly)
     {
         foreach (Form form in ClientData.mainForm.MdiChildren)
         {
             if ((form.Text.IndexOf(item.Master.Id) >= 0) && (form is FrmModeling))
             {
                 form.Activate();
                 return;
             }
         }
     }
     else
     {
         foreach (Form form2 in ClientData.mainForm.MdiChildren)
         {
             if ((form2.Text == item.Master.Id) && (form2 is FrmModeling))
             {
                 form2.Activate();
                 return;
             }
         }
     }
     if (this.readOnly || !(item.Master.Holder != this.user.Oid))
     {
         Cursor current = Cursor.Current;
         Cursor.Current = Cursors.WaitCursor;
         FrmModeling modeling = null;
         try
         {
             modeling = new FrmModeling(item, this.user, this.readOnly);
         }
         catch (Exception exception)
         {
             MessageBox.Show("新建FrmModeling失败。\n" + exception.Message, "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             return;
         }
         finally
         {
             Cursor.Current = current;
         }
         if (!this.readOnly)
         {
             modeling.MdiParent   = ClientData.mainForm;
             modeling.WindowState = FormWindowState.Maximized;
             modeling.Show();
         }
         else
         {
             modeling.ShowDialog();
         }
     }
     else
     {
         MessageBox.Show("请先检出该对象。", "卡片模板", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }