Пример #1
0
 public override bool Execute(object param, object data)
 {
     try
     {
         MainForm form = param as MainForm;
         if (form == null)
         {
             return(false);
         }
         foreach (DockContent item in form.DockPanel.Contents)
         {
             if (item is PdfViewForm)
             {
                 item.Activate();
                 return(true);
             }
         }
         PdfViewForm role = new PdfViewForm(form);
         role.Show(form.DockPanel, DockState.Document);
         role.Activate();
     }
     catch (Exception ex)
     {
         LogManager.Instance.WriteLog(ex.ToString());
     }
     return(true);
 }
Пример #2
0
        public override bool Execute(object param, object data)
        {
            try
            {
                MainForm form = param as MainForm;
                if (form == null)
                {
                    return(false);
                }
                string filePath = data as string;
                if (string.IsNullOrEmpty(filePath))
                {
                    return(true);
                }

                foreach (DockContent item in form.DockPanel.Contents)
                {
                    if (item is PdfViewForm)
                    {
                        if ((item as PdfViewForm).FilePath == filePath)
                        {
                            item.Activate();
                            return(true);
                        }
                    }
                }
                PdfViewForm frm = new PdfViewForm(form);
                frm.FilePath = filePath;
                frm.Show(form.DockPanel, DockState.Document);
                frm.Activate();
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog(ex.ToString());
            }
            return(true);
        }