Пример #1
0
        private void cmiEdit_Click(object sender, EventArgs e)
        {
            DEBrowser     tag      = (DEBrowser)this.lvwBrowser.SelectedItems[0].Tag;
            FrmSetBrowser browser2 = new FrmSetBrowser(tag, true);

            if (browser2.ShowDialog() == DialogResult.OK)
            {
                DEBrowser deB = new DEBrowser();
                deB = browser2.deB;
                this.lvwBrowser.SelectedItems[0].SubItems[0].Text = deB.Name;
                if ((deB.Option & 1) == 1)
                {
                    foreach (ListViewItem item in this.lvwBrowser.Items)
                    {
                        item.SubItems[1].Text = "";
                    }
                    this.lvwBrowser.SelectedItems[0].SubItems[1].Text = "是";
                }
                else
                {
                    this.lvwBrowser.SelectedItems[0].SubItems[1].Text = "";
                }
                this.lvwBrowser.SelectedItems[0].SubItems[2].Text = deB.Creator;
                this.lvwBrowser.SelectedItems[0].SubItems[3].Text = deB.CreatTime.ToString("yyyy-MM-dd");
                this.lvwBrowser.SelectedItems[0].SubItems[4].Text = deB.Description;
                this.lvwBrowser.SelectedItems[0].Tag = deB;
                this.frmMain.RefreshBrowser();
                this.frmMain.FileTypeRefresh(sender, e);
            }
        }
Пример #2
0
        public void CreateList()
        {
            this.lvwFile.Items.Clear();
            PLFileType type         = new PLFileType();
            ArrayList  allFileTypes = null;

            try
            {
                allFileTypes = type.GetAllFileTypes();
            }
            catch (EnvironmentException exception)
            {
                MessageBox.Show(exception.Message, "文件类型管理", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            catch
            {
                MessageBox.Show("显示文件类型信息失败!", "文件类型管理", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            for (int i = 0; i < allFileTypes.Count; i++)
            {
                DEFileType type2 = (DEFileType)allFileTypes[i];
                string     str   = "";
                if ((type2.Option & 1) == 1)
                {
                    str = "是";
                }
                else
                {
                    str = "否";
                }
                string name = "";
                for (int j = 0; j < this.allTools.Count; j++)
                {
                    DETool tool = (DETool)this.allTools[j];
                    if (tool.Oid.Equals(type2.ToolOid))
                    {
                        name = tool.Name;
                    }
                }
                string str3 = "";
                for (int k = 0; k < this.allEditor.Count; k++)
                {
                    DEBrowser browser = (DEBrowser)this.allEditor[k];
                    if (browser.Oid.Equals(type2.DefaultEditorOid))
                    {
                        str3 = browser.Name;
                    }
                }
                string[]     items = new string[] { type2.Name, type2.Postfix, name, type2.DefaultBrowserName, str3, str, type2.Creator, type2.CreatTime.ToString("yyyy-MM-dd HH:mm:ss"), type2.Description };
                ListViewItem item  = new ListViewItem(items)
                {
                    Tag        = type2,
                    ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_ENV_FILETYPE")
                };
                this.lvwFile.Items.Add(item);
            }
        }
Пример #3
0
        private void cmiDel_Click(object sender, EventArgs e)
        {
            DEBrowser tag = (DEBrowser)this.lvwBrowser.SelectedItems[0].Tag;

            if ((tag.Option & 8) == 8)
            {
                if (MessageBox.Show("是否删除选中浏览器?", "删除浏览器", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    PLBrowser browser2 = new PLBrowser();
                    try
                    {
                        tag.Creator = ClientData.LogonUser.LogId;
                        if (browser2.Delete(tag))
                        {
                            this.lvwBrowser.SelectedItems[0].Remove();
                            this.frmMain.RefreshBrowser();
                            this.frmMain.FileTypeRefresh(sender, e);
                        }
                    }
                    catch (EnvironmentException exception)
                    {
                        MessageBox.Show(exception.Message, "删除浏览器", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    catch
                    {
                        MessageBox.Show("删除浏览器失败!", "删除浏览器", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                }
            }
            else if (((tag.Option & 0x10) == 0x10) && (MessageBox.Show("是否删除选中编辑器?", "删除编辑器", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK))
            {
                PLBrowser browser3 = new PLBrowser();
                try
                {
                    tag.Creator = ClientData.LogonUser.LogId;
                    if (browser3.Delete(tag))
                    {
                        this.lvwBrowser.SelectedItems[0].Remove();
                        this.frmMain.RefreshBrowser();
                        this.frmMain.FileTypeRefresh(sender, e);
                    }
                }
                catch (EnvironmentException exception2)
                {
                    MessageBox.Show(exception2.Message, "删除编辑器", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                catch
                {
                    MessageBox.Show("删除编辑器失败!", "删除编辑器", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }
Пример #4
0
        private void cmiEdit_Click(object sender, EventArgs e)
        {
            DEFileType  tag    = (DEFileType)this.lvwFile.SelectedItems[0].Tag;
            FrmFTDialog dialog = new FrmFTDialog(tag, true);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                DEFileType deF = dialog.deF;
                this.lvwFile.SelectedItems[0].SubItems[0].Text = deF.Name;
                this.lvwFile.SelectedItems[0].SubItems[1].Text = deF.Postfix;
                if (deF.ToolOid == Guid.Empty)
                {
                    this.lvwFile.SelectedItems[0].SubItems[2].Text = "";
                }
                else
                {
                    this.lvwFile.SelectedItems[0].SubItems[2].Text = dialog.StrTool;
                }
                this.lvwFile.SelectedItems[0].SubItems[3].Text = deF.DefaultBrowserName;
                string name = "";
                for (int i = 0; i < this.allEditor.Count; i++)
                {
                    DEBrowser browser = (DEBrowser)this.allEditor[i];
                    if (browser.Oid.Equals(tag.DefaultEditorOid))
                    {
                        name = browser.Name;
                    }
                }
                this.lvwFile.SelectedItems[0].SubItems[4].Text = name;
                if ((deF.Option & 1) == 1)
                {
                    this.lvwFile.SelectedItems[0].SubItems[5].Text = "是";
                }
                else
                {
                    this.lvwFile.SelectedItems[0].SubItems[5].Text = "否";
                }
                this.lvwFile.SelectedItems[0].SubItems[6].Text = deF.Creator;
                this.lvwFile.SelectedItems[0].SubItems[7].Text = deF.CreatTime.ToString("yyyy-MM-dd HH:mm:ss");
                this.lvwFile.SelectedItems[0].SubItems[8].Text = deF.Description;
                this.lvwFile.SelectedItems[0].Tag = deF;
            }
            dialog.Dispose();
        }
Пример #5
0
        public void NewFileType(object sender, EventArgs e)
        {
            FrmFTDialog dialog = new FrmFTDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                DEFileType deF = dialog.deF;
                this.GetBaseToolAndEdit();
                string[] items = new string[9];
                items[0] = deF.Name;
                items[1] = deF.Postfix;
                bool flag = false;
                for (int i = 0; i < this.allTools.Count; i++)
                {
                    DETool tool = (DETool)this.allTools[i];
                    if (tool.Oid.Equals(deF.ToolOid))
                    {
                        items[2] = tool.Name;
                        flag     = true;
                    }
                }
                if (!flag)
                {
                    items[2] = "";
                }
                flag     = false;
                items[3] = deF.DefaultBrowserName;
                for (int j = 0; j < this.allEditor.Count; j++)
                {
                    DEBrowser browser = (DEBrowser)this.allEditor[j];
                    if (browser.Oid.Equals(deF.DefaultEditorOid))
                    {
                        items[4] = browser.Name;
                        flag     = true;
                    }
                }
                if (!flag)
                {
                    items[4] = "";
                }
                if ((deF.Option & 1) == 1)
                {
                    items[5] = "是";
                }
                else
                {
                    items[5] = "否";
                }
                items[6] = deF.Creator;
                items[7] = deF.CreatTime.ToString("yyyy-MM-dd HH:mm:ss");
                items[8] = deF.Description;
                ListViewItem item = new ListViewItem(items)
                {
                    Tag        = deF,
                    ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_ENV_FILETYPE")
                };
                this.lvwFile.Items.Add(item);
                int count = this.lvwFile.Items.Count;
                this.lvwFile.Items[count - 1].Selected = true;
            }
            dialog.Dispose();
        }
Пример #6
0
        public void CreatList()
        {
            PLBrowser browser     = new PLBrowser();
            ArrayList allBrowsers = null;
            ArrayList allEditors  = null;

            try
            {
                allBrowsers = browser.GetAllBrowsers();
                allEditors  = browser.GetAllEditors();
            }
            catch (EnvironmentException exception)
            {
                MessageBox.Show(exception.Message, "编辑浏览器管理", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            catch
            {
                MessageBox.Show("显示编辑器、浏览器信息失败!", "编辑浏览器管理", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            for (int i = 0; i < allBrowsers.Count; i++)
            {
                DEBrowser browser2 = (DEBrowser)allBrowsers[i];
                string    str      = "";
                string    str2     = "";
                if ((browser2.Option & 1) == 1)
                {
                    str = "缺省浏览器";
                }
                if ((browser2.Option & 4) == 4)
                {
                    str2 = "系统浏览器";
                }
                else
                {
                    str2 = "定制浏览器";
                }
                string[]     items = new string[] { browser2.Name, str, str2, browser2.Creator, browser2.CreatTime.ToString("yyyy-MM-dd"), browser2.Description };
                ListViewItem item  = new ListViewItem(items)
                {
                    Tag        = browser2,
                    ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_ENV_BROWER")
                };
                this.lvwBrowser.Items.Add(item);
            }
            for (int j = 0; j < allEditors.Count; j++)
            {
                DEBrowser browser3 = (DEBrowser)allEditors[j];
                string    str3     = "";
                string    str4     = "";
                if ((browser3.Option & 1) == 1)
                {
                    str3 = "缺省编辑器";
                }
                if ((browser3.Option & 0x10) == 0x10)
                {
                    str4 = "定制编辑器";
                }
                string[]     strArray2 = new string[] { browser3.Name, str3, str4, browser3.Creator, browser3.CreatTime.ToString("yyyy-MM-dd"), browser3.Description };
                ListViewItem item2     = new ListViewItem(strArray2)
                {
                    Tag        = browser3,
                    ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_ENV_BROWER")
                };
                this.lvwBrowser.Items.Add(item2);
            }
        }
Пример #7
0
        public static void ViewFile(DESecureFile file, string fileName, string className, DELProcessInfoForCLT processArgs, bool deleteAllowed, IBizItem bizItem, DEBrowser browser, bool isShowFileList)
        {
            CurViewFilePath = fileName;
            if (bizItem != null)
            {
                switch (PLGrantPerm.Agent.CanDoObjectOperation(ClientData.LogonUser.Oid, bizItem.MasterOid, bizItem.ClassName, PLGrantPerm.ToPermString(PLMBOOperation.BOView), bizItem.SecurityLevel, bizItem.Phase, bizItem.RevNum))
                {
                case 0:
                    MessageBoxPLM.Show("您没有浏览该对象源文件的权限。", "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;

                case 2:
                    MessageBoxPLM.Show("当前对象在流程中,您没有浏览该对象源文件的权限。", "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                if (Path.GetExtension(fileName).ToUpper() == ".GXT")
                {
                    switch (PLGrantPerm.Agent.CanDoObjectOperation(ClientData.LogonUser.Oid, bizItem.MasterOid, bizItem.ClassName, PLGrantPerm.ToPermString(PLMBOOperation.BODownload), bizItem.SecurityLevel, bizItem.Phase, bizItem.RevNum))
                    {
                    case 0:
                        MessageBoxPLM.Show("您没有下载该对象源文件的权限。", "编辑源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;

                    case 2:
                        MessageBoxPLM.Show("当前对象在流程中,您没有下载该对象源文件的权限。", "编辑源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }
            }
            FileBrowseWay      innerBrowser = FileBrowseWay.InnerBrowser;
            string             title        = "文件浏览";
            BrowserDisplayRule rule         = null;

            if (Path.GetExtension(fileName).ToUpper() == ".GXT")
            {
                rule = new BrowserDisplayRule {
                    IsEdit      = IsEditGxt,
                    OnlyBrowser = IsOnlyBrowser
                };
                if (IsEditGxt)
                {
                    title = "文件编辑";
                }
                rule.Item     = bizItem as DEBusinessItem;
                IsEditGxt     = false;
                IsOnlyBrowser = false;
            }
            try
            {
                if (browser == null)
                {
                    innerBrowser = UIBrowser.GetBrowser(file.FileOid, fileName, file.FileType, out browser);
                }
                else
                {
                    innerBrowser = browser.IsInnerBrowser ? FileBrowseWay.InnerBrowser : FileBrowseWay.OpenProcess;
                }
            }
            catch (Exception exception)
            {
                PrintException.Print(exception, title);
                return;
            }
            if (innerBrowser == FileBrowseWay.InnerBrowser)
            {
                FrmViewFile file2 = null;
                Form        form  = FormManager.GetForm(PLMFormType.ViewFile, file.FileOid);
                if ((form != null) && (form is FrmViewFile))
                {
                    file2 = (FrmViewFile)form;
                    if (bizItem != null)
                    {
                        file2.Text = bizItem.Id + "[" + ModelContext.MetaModel.GetClassLabel(bizItem.ClassName) + "] - " + title;
                        file2.SetStatusText(GetSecureFile(bizItem, file.FileOid));
                    }
                    else
                    {
                        file2.Text = Path.GetFileName(fileName) + " - " + title;
                    }
                }
                else
                {
                    try
                    {
                        file2 = new FrmViewFile();
                        if (bizItem != null)
                        {
                            file2.Text = bizItem.Id + "[" + ModelContext.MetaModel.GetClassLabel(bizItem.ClassName) + "] - " + title;
                            file2.SetStatusText(GetSecureFile(bizItem, file.FileOid));
                        }
                        else
                        {
                            file2.Text = Path.GetFileName(fileName) + " - " + title;
                        }
                    }
                    catch (Exception exception2)
                    {
                        PrintException.Print(exception2, MessageBoxIcon.Exclamation);
                        return;
                    }
                    file2.SetManaged(PLMFormType.ViewFile, file.FileOid);
                }
                file2.SetInput(bizItem, file, isShowFileList, processArgs, className);
                file2.Show();
                file2.Activate();
                string deleteFilePath = null;
                if (deleteAllowed)
                {
                    deleteFilePath = Path.GetDirectoryName(fileName);
                }
                UIBrowser.OpenFileWithBrowser(file.FileOid, fileName, file2.panelBrowser, innerBrowser, browser, deleteFilePath, rule, bizItem);
            }
            else
            {
                UIBrowser.OpenFileWithBrowser(file.FileOid, fileName, null, innerBrowser, browser, Path.GetDirectoryName(fileName), bizItem);
            }
        }
Пример #8
0
        private void combFiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            DESecureFile  selectedItem;
            string        str;
            bool          flag;
            FileBrowseWay way;

            if (this.combFiles.SelectedItem != null)
            {
                if (this.IsMarkUpMode)
                {
                    MessageBox.Show("当前文件处于批注状态,请先保存批注或者退出批注状态再操作!", "提示");
                    this.combFiles.SelectedIndexChanged -= new EventHandler(this.combFiles_SelectedIndexChanged);
                    this.combFiles.SelectedIndex         = this.LastSelectedIndex;
                    this.combFiles.SelectedIndexChanged += new EventHandler(this.combFiles_SelectedIndexChanged);
                    return;
                }
                if (this._bizItem == null)
                {
                    return;
                }
                selectedItem           = this.combFiles.SelectedItem as DESecureFile;
                this.LastSelectedIndex = this.combFiles.SelectedIndex;
                if (this._bizItem.FileList.GetFileByFileOid(selectedItem.FileOid) == null)
                {
                    return;
                }
                if (Path.GetExtension(selectedItem.FileName).ToUpper() == ".GXT")
                {
                    switch (PLGrantPerm.Agent.CanDoObjectOperation(ClientData.LogonUser.Oid, this._bizItem.MasterOid, this._bizItem.ClassName, PLGrantPerm.ToPermString(PLMBOOperation.BODownload), this._bizItem.SecurityLevel, this._bizItem.Phase, this._bizItem.RevNum))
                    {
                    case 0:
                        MessageBoxPLM.Show("您没有下载该对象源文件的权限。", "编辑源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;

                    case 2:
                        MessageBoxPLM.Show("当前对象在流程中,您没有下载该对象源文件的权限。", "编辑源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }
                DESecureFile relationFileForBrowse = ViewFileHelper.GetRelationFileForBrowse(this._bizItem.Iteration, selectedItem);
                if (relationFileForBrowse != null)
                {
                    selectedItem = relationFileForBrowse;
                }
                ArrayList files = PLFileService.Agent.GetFiles(selectedItem.FileOid);
                if ((files != null) && (files.Count > 0))
                {
                    DEFile file3 = files[0] as DEFile;
                    if (file3 != null)
                    {
                        int num2 = Convert.ToInt32((long)(file3.OriginalSize / 0x100000L));
                        if ((num2 > 50) && (MessageBoxPLM.Show("您当前要浏览的源文件为" + num2.ToString() + "M,浏览会花费较长时间,您确认要继续吗?", "浏览源文件", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Cancel))
                        {
                            return;
                        }
                    }
                }
                str = string.Empty;
                string path = string.Empty;
                flag = false;
                if (FileEvent.fileOperEvent != null)
                {
                    FileEvent.fileOperEvent(OperEventType.Before, "ClaRel_BROWSE", selectedItem.FileOid);
                }
                bool editable = this._bizItem.CanEdit(ClientData.LogonUser.Oid);
                if (!selectedItem.InLocalHost)
                {
                    try
                    {
                        str = ViewFileHelper.DownloadFileByDir(this._bizItem.Iteration, selectedItem, null, ClientData.UserGlobalOption, false, true, "ClaRel_BROWSE");
                    }
                    catch (Exception exception4)
                    {
                        if (editable)
                        {
                            MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:" + exception4.Message, "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        else
                        {
                            MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:" + exception4.Message, "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        return;
                    }
                    switch (str)
                    {
                    case null:
                    case "":
                        return;
                    }
                    if (!File.Exists(str))
                    {
                        MessageBoxPLM.Show("指定的文件索引不存在,可能是文件没有正确上载。", "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    flag = true;
                    goto Label_04DE;
                }
                if (selectedItem.InCurrentHost)
                {
                    path = selectedItem.Location;
                    str  = selectedItem.Location + @"\" + selectedItem.FileName;
                    if (!File.Exists(str))
                    {
                        if (DialogResult.Yes == MessageBoxPLM.Show("在指定路径下没有找到该文件,无法浏览!可能是文件路径发生变化,或已被删除。是否尝试从服务器获取文件?", "浏览源文件", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        {
                            try
                            {
                                ViewFileHelper.DownLoadFile(this._bizItem.Iteration, selectedItem, path, ClientData.UserGlobalOption, editable, "ClaRel_BROWSE", this._bizItem);
                                goto Label_04DE;
                            }
                            catch (Exception exception)
                            {
                                if (editable)
                                {
                                    MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:" + exception.Message, "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                }
                                else
                                {
                                    MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:" + exception.Message, "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                }
                            }
                        }
                        return;
                    }
                    try
                    {
                        if (ClientData.LogonUser.Oid != selectedItem.UserOid)
                        {
                            str = ViewFileHelper.DownLoadFile(this._bizItem.Iteration, selectedItem, null, ClientData.UserGlobalOption, true, "ClaRel_BROWSE", this._bizItem);
                        }
                        if (!File.Exists(str))
                        {
                            MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:源文件未上载", "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        goto Label_04DE;
                    }
                    catch (Exception exception2)
                    {
                        if (editable)
                        {
                            MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:" + exception2.Message, "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        else
                        {
                            MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:" + exception2.Message, "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        return;
                    }
                }
                if (DialogResult.Yes == MessageBoxPLM.Show("文件存在于他人机器上。是否尝试从服务器获取文件?", "浏览源文件", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    try
                    {
                        str = ViewFileHelper.DownLoadFile(this._bizItem.Iteration, selectedItem, null, ClientData.UserGlobalOption, editable, "ClaRel_BROWSE", this._bizItem);
                        if (str == null)
                        {
                            MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:文件未上载", "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        goto Label_04DE;
                    }
                    catch (Exception exception3)
                    {
                        if (editable)
                        {
                            MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:" + exception3.Message, "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        else
                        {
                            MessageBoxPLM.Show("无法从文件服务器获取源文件,原因是:" + exception3.Message, "浏览源文件", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        return;
                    }
                }
            }
            return;

Label_04DE:
            way = FileBrowseWay.InnerBrowser;
            string             title = "文件浏览";
            BrowserDisplayRule rule  = null;

            if (Path.GetExtension(str).ToUpper() == ".GXT")
            {
                rule = new BrowserDisplayRule {
                    IsEdit      = IsEditGxt,
                    OnlyBrowser = IsOnlyBrowser
                };
                if (IsEditGxt)
                {
                    title = "文件编辑";
                }
                rule.Item     = this._bizItem;
                IsEditGxt     = false;
                IsOnlyBrowser = false;
            }
            DEBrowser browser = null;

            try
            {
                way = UIBrowser.GetBrowser(selectedItem.FileOid, str, selectedItem.FileType, out browser);
            }
            catch (Exception exception5)
            {
                PrintException.Print(exception5, title);
                return;
            }
            if (way == FileBrowseWay.InnerBrowser)
            {
                string deleteFilePath = null;
                if (flag)
                {
                    deleteFilePath = Path.GetDirectoryName(str);
                }
                UIBrowser.OpenFileWithBrowser(selectedItem.FileOid, str, this.panelBrowser, way, browser, deleteFilePath, rule, this._bizItem);
            }
            else
            {
                UIBrowser.OpenFileWithBrowser(selectedItem.FileOid, str, null, way, browser, Path.GetDirectoryName(str), this._bizItem);
            }
        }
Пример #9
0
        private void btnMarkup_Click(object sender, EventArgs e)
        {
            try
            {
                DESecureFile selectedItem = this.combFiles.SelectedItem as DESecureFile;
                for (int i = 0; i < this.panelBrowser.Controls.Count; i++)
                {
                    Control control = this.panelBrowser.Controls[i];
                    try
                    {
                        this.browser = (IInnerBrowser)control;
                    }
                    catch
                    {
                        this.browser = null;
                    }
                    if (this.browser != null)
                    {
                        this.DoShowMarkUp(selectedItem);
                        this.IsMarkUpMode      = true;
                        this.btnMarkup.Enabled = false;
                        goto Label_0085;
                    }
                }
            }
            catch (Exception exception)
            {
                PrintException.Print(exception);
            }
Label_0085:
            try
            {
                if (this.combFiles.SelectedIndex != -1)
                {
                    FileBrowseWay way;
                    DEBrowser     browser = null;
                    DESecureFile  info    = this.combFiles.SelectedItem as DESecureFile;
                    try
                    {
                        way = UIBrowser.GetMarkupTool(info.FileOid, info.FileName, info.FileType, out browser);
                    }
                    catch (Exception exception2)
                    {
                        PrintException.Print(exception2, "业务对象管理");
                        return;
                    }
                    if (way == FileBrowseWay.InnerBrowser)
                    {
                        if (browser != null)
                        {
                            IInnerBrowser browser2 = null;
                            try
                            {
                                browser2 = BrowserPool.BrowserManager.GetBrowser(browser, null);
                            }
                            catch (Exception exception3)
                            {
                                MessageBoxPLM.Show(exception3.Message);
                                return;
                            }
                            if (browser2 != null)
                            {
                                this.DoShowMarkUp(info);
                                this.IsMarkUpMode      = true;
                                this.btnMarkup.Enabled = false;
                            }
                        }
                        else
                        {
                            MessageBoxPLM.Show("没有获取到有效的浏览器,无法批注。", "文件批注", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                    else
                    {
                        MessageBoxPLM.Show("批注文件必须通过内部浏览器完成。", "文件批注", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch (Exception exception4)
            {
                PrintException.Print(exception4);
            }
        }
Пример #10
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if ((this.lvwProcess.SelectedIndices.Count != 1) || (this.lvwWorkItem.SelectedIndices.Count != 1))
     {
         if (this.lvwProcess.SelectedIndices.Count == 0)
         {
             MessageBoxPLM.Show("请选择一个流程!");
         }
         else if (this.lvwWorkItem.SelectedIndices.Count == 0)
         {
             MessageBoxPLM.Show("请选择一个步骤!");
         }
         base.DialogResult = DialogResult.None;
     }
     else
     {
         FileBrowseWay way;
         base.DialogResult = DialogResult.OK;
         DELProcessInsProperty tag  = (DELProcessInsProperty)this.lvwProcess.SelectedItems[0].Tag;
         DELWorkItem           item = (DELWorkItem)((object[])this.lvwWorkItem.SelectedItems[0].Tag)[0];
         DEMarkup markup            = (DEMarkup)((object[])this.lvwWorkItem.SelectedItems[0].Tag)[1];
         base.Close();
         if (markup.FileOid != this.file.FileOid)
         {
             DESecureFile fileByFileOid = PLItem.Agent.GetBizItemByIteration(markup.ItemOid, this.className, Guid.Empty, ClientData.LogonUser.Oid, BizItemMode.SmartBizItem).FileList.GetFileByFileOid(markup.FileOid);
             if (fileByFileOid != null)
             {
                 this.file = fileByFileOid;
             }
             else
             {
                 this.file.FileOid = markup.FileOid;
             }
         }
         if (this.AllFileNames.Contains(this.file.FileOid))
         {
             this.fileName = this.AllFileNames[this.file.FileOid] as string;
         }
         else
         {
             this.fileName      = FSClientUtil.DownloadFile(this.file.FileOid, "ClaRel_DOWNLOAD");
             this.file.FileType = UIFileType.GetFileType(this.fileName);
             this.file.FileName = this.fileName;
             this.AllFileNames.Add(this.file.FileOid, this.fileName);
         }
         DEBrowser browser = null;
         try
         {
             way = UIBrowser.GetMarkupTool(this.file.FileOid, this.file.FileName, this.file.FileType, out browser);
         }
         catch (Exception exception)
         {
             PrintException.Print(exception, "浏览文件批注");
             return;
         }
         if (way == FileBrowseWay.InnerBrowser)
         {
             if (browser != null)
             {
                 IInnerBrowser browser2 = null;
                 try
                 {
                     browser2 = BrowserPool.BrowserManager.GetBrowser(browser, null);
                 }
                 catch (Exception exception2)
                 {
                     MessageBoxPLM.Show(exception2.Message);
                     return;
                 }
                 if (browser2 != null)
                 {
                     if (this.AllFileNames.Contains(this.file.FileOid))
                     {
                         this.fileName = this.AllFileNames[this.file.FileOid] as string;
                     }
                     else
                     {
                         this.fileName = FSClientUtil.DownloadFile(this.file.FileOid, "ClaRel_DOWNLOAD");
                         this.AllFileNames.Add(this.file.FileOid, this.fileName);
                     }
                     FrmMarkupByBrowser.ViewMarkUp(this.fileName, this.file.FileOid, tag.ID, item.ID, Guid.Empty, item.ActorID, this.className, this.isShowDialog, browser2);
                 }
             }
         }
         else
         {
             MessageBoxPLM.Show("必须定义打开文件的内部浏览器,否则不能批注");
         }
     }
 }