private void FrmMarkupByBrowser_Load(object sender, EventArgs e) { this.browser.AddControl(this.pnlBrowser); this.browser.SetSourceFile(this.FileName); this.markLocation = ViewFileHelper.Instance.GetTempMarkupPath(); if (Directory.Exists(this.markLocation)) { if ((Directory.GetFiles(this.markLocation).Length > 0) && (MessageBoxPLM.Show("系统可能正在批注其他的文件,继续操作将使原批注文件丢失,是否继续操作?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)) { return; } ViewFileHelper.DeleteDirectory(this.markLocation); Thread.Sleep(100); } while (Directory.Exists(this.markLocation)) { } Directory.CreateDirectory(this.markLocation); new DirectoryInfo(this.markLocation).Attributes = FileAttributes.Hidden; try { this.curMarkup = PLItem.Agent.GetMarkup(this.FileOid, this.workItemOid, this.dataOid, this.UserOid); if ((this.curMarkup != null) && (this.Mode == 0)) { this.Mode = 2; } if ((this.Mode == 0) && (this.curMarkup == null)) { this.curMarkup = new DEMarkup(); this.curMarkup.FileOid = this.FileOid; this.curMarkup.ProcessOid = this.processOid; this.curMarkup.WorkItemOid = this.workItemOid; this.curMarkup.DataOid = this.dataOid; this.curMarkup.UserOid = this.UserOid; this.curMarkup.MarkupFileOid = Guid.Empty; } if (this.curMarkup.MarkupFileOid != Guid.Empty) { ArrayList files = PLFileService.Agent.GetFiles(this.curMarkup.MarkupFileOid); if ((files != null) && (files.Count > 0)) { this.markFileName = this.markLocation + @"\" + ViewFileHelper.Instance.GetFileName(this.curMarkup.MarkupFileOid); FSClientUtil.DownloadFile("ClaRel_BROWSE", this.curMarkup.MarkupFileOid, this.markFileName); } } this.ShowMarkup(); } catch (Exception exception) { PrintException.Print(exception); } }
private void Save() { this.bCancel = false; this.browser.ExitMarkupMode(); Thread.Sleep(100); string[] files = Directory.GetFiles(this.markLocation); if (((files.Length == 0) && this.browser.CanMarkup()) && (this.Mode != 1)) { MessageBoxPLM.Show("无法获取批注文件,请确认批注文件已保存!"); base.DialogResult = DialogResult.None; bool allowMarkup = true; try { if (this.markFileName == null) { this.browser.EnterMarkupMode(this.FileName, this.markLocation, Path.GetFileName(this.FileName) + ".plmmkp", allowMarkup); } else { this.browser.EnterMarkupMode(this.FileName, this.markLocation, Path.GetFileName(this.markFileName), allowMarkup); } } catch (Exception exception) { PrintException.Print(exception); } return; } if (this.Mode == 0) { if (!this.browser.CanMarkup() && (this.txtMark.Text.Trim() == "")) { goto Label_0340; } DEMarkup mark = new DEMarkup { UserOid = this.UserOid, ProcessOid = this.processOid, WorkItemOid = this.workItemOid, DataOid = this.dataOid, Markup = this.txtMark.Text.Trim(), FileOid = this.FileOid, MarkupFileOid = Guid.NewGuid(), ItemOid = this.ItemOid, ItemIteration = this.ItemIteration, ClassName = this.ClassName }; bool flag2 = false; if (this.browser.CanMarkup()) { try { if (this.NeedUploadMarkupFile(this.FileOid, files[0])) { FSClientUtil.UploadFile(mark.MarkupFileOid, files[0], this.ClassName, 'I', Guid.Empty, ClientData.LogonUser.Name); flag2 = true; } } catch (Exception exception2) { PrintException.Print(exception2); return; } } if (!flag2 && (this.txtMark.Text.Trim() == "")) { goto Label_0340; } try { PLItem.Agent.CreateMarkup(mark, ClientData.LogonUser.Oid); goto Label_0340; } catch (Exception exception3) { PrintException.Print(exception3); return; } } if (this.Mode == 2) { bool flag3 = false; if (this.curMarkup.Markup == null) { this.curMarkup.Markup = ""; } if (this.curMarkup.Markup != this.txtMark.Text.Trim()) { this.curMarkup.Markup = this.txtMark.Text.Trim(); flag3 = true; } this.curMarkup.ItemOid = this.ItemOid; this.curMarkup.ItemIteration = this.ItemIteration; bool flag4 = false; if (this.browser.CanMarkup()) { try { if (this.NeedUploadMarkupFile(this.curMarkup.FileOid, files[0])) { FSClientUtil.UploadFile(this.curMarkup.MarkupFileOid, files[0], this.ClassName, 'I', Guid.Empty, ClientData.LogonUser.Name); flag4 = true; } } catch (Exception exception4) { PrintException.Print(exception4); return; } } try { if (flag3 || flag4) { PLItem.Agent.ModifyMarkup(this.curMarkup, ClientData.LogonUser.Oid); } } catch (Exception exception5) { PrintException.Print(exception5); return; } } Label_0340: base.DialogResult = DialogResult.OK; }
private void DoShowMarkUp(DESecureFile info) { if (this.browser == null) { MessageBox.Show("没有合适的批注编辑器,无法批注!", "提示"); } else { this.Mode = 0; this.CurFile = info; this.lstSelfDefRemarks.Items.Clear(); Hashtable userOption = ClientData.GetUserOption(); for (int i = 1; userOption["Option_Remark_" + i.ToString()] != null; i++) { string item = (string)userOption["Option_Remark_" + i.ToString()]; this.lstSelfDefRemarks.Items.Add(item); } this.txtRemark.Text = ""; this.markLocation = ViewFileHelper.Instance.GetTempMarkupPath(); this.panelButtons.Visible = true; this.splitContainerSmall.PanelVisibility = SplitPanelVisibility.Both; this.markFileName = null; if (Directory.Exists(this.markLocation)) { if ((Directory.GetFiles(this.markLocation).Length > 0) && (MessageBox.Show("系统可能正在批注其他的文件,继续操作将使原批注文件丢失,是否继续操作?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)) { return; } ViewFileHelper.DeleteDirectory(this.markLocation); Thread.Sleep(100); } while (Directory.Exists(this.markLocation)) { } Directory.CreateDirectory(this.markLocation); try { this.curMarkup = PLItem.Agent.GetMarkup(info.FileOid, this._processArgs.WorkItemOid, this._processArgs.GroupDataOid, ClientData.LogonUser.Oid); if ((this.curMarkup != null) && (this.Mode == 0)) { this.Mode = 2; } if ((this.Mode == 0) && (this.curMarkup == null)) { this.curMarkup = new DEMarkup(); this.curMarkup.FileOid = info.FileOid; this.curMarkup.ProcessOid = this._processArgs.ProcessInstanceOid; this.curMarkup.WorkItemOid = this._processArgs.WorkItemOid; this.curMarkup.DataOid = this._processArgs.GroupDataOid; this.curMarkup.UserOid = ClientData.LogonUser.Oid; this.curMarkup.MarkupFileOid = Guid.Empty; this.curMarkup.ClassName = this._className; } if (this.curMarkup.MarkupFileOid != Guid.Empty) { ArrayList files = PLFileService.Agent.GetFiles(this.curMarkup.MarkupFileOid); if ((files != null) && (files.Count > 0)) { this.markFileName = this.markLocation + @"\" + ViewFileHelper.Instance.GetFileName(this.curMarkup.MarkupFileOid); FSClientUtil.DownloadFile("ClaRel_BROWSE", this.curMarkup.MarkupFileOid, this.markFileName); } } this.ShowMarkup(); } catch { } } }
private void Save() { this.btnMarkup.Enabled = true; this.browser.ExitMarkupMode(); Thread.Sleep(100); string[] files = Directory.GetFiles(this.markLocation); if ((files.Length == 0) && this.browser.CanMarkup()) { MessageBox.Show("无法获取批注文件,请确认批注文件已保存!"); bool allowMarkup = true; try { if (this.markFileName == null) { this.browser.EnterMarkupMode(CurViewFilePath, this.markLocation, Path.GetFileName(CurViewFilePath) + ".plmmkp", allowMarkup); } else { this.browser.EnterMarkupMode(CurViewFilePath, this.markLocation, Path.GetFileName(this.markFileName), allowMarkup); } } catch (Exception exception) { PrintException.Print(exception); } return; } if (this.Mode == 0) { if (!this.browser.CanMarkup() && (this.txtRemark.Text.Trim() == "")) { goto Label_036C; } DEMarkup mark = new DEMarkup { UserOid = ClientData.LogonUser.Oid, ProcessOid = this._processArgs.ProcessInstanceOid, WorkItemOid = this._processArgs.WorkItemOid, DataOid = this._processArgs.GroupDataOid, Markup = this.txtRemark.Text.Trim(), FileOid = this.CurFile.FileOid, MarkupFileOid = Guid.NewGuid(), ItemOid = this._bizItem.IterOid, ItemIteration = this._bizItem.LastIteration, ClassName = this._bizItem.ClassName }; bool flag2 = false; if (this.browser.CanMarkup()) { try { if (this.NeedUploadMarkupFile(this.CurFile.FileOid, files[0])) { FSClientUtil.UploadFile(mark.MarkupFileOid, files[0], this._bizItem.ClassName, 'I', Guid.Empty, ClientData.LogonUser.Name); flag2 = true; } } catch (Exception exception2) { PrintException.Print(exception2); return; } } if (!flag2 && (this.txtRemark.Text.Trim() == "")) { goto Label_036C; } try { PLItem.Agent.CreateMarkup(mark, ClientData.LogonUser.Oid); goto Label_036C; } catch (Exception exception3) { PrintException.Print(exception3); return; } } if (this.Mode == 2) { bool flag3 = false; if (this.curMarkup.Markup == null) { this.curMarkup.Markup = ""; } if (this.curMarkup.Markup != this.txtRemark.Text.Trim()) { this.curMarkup.Markup = this.txtRemark.Text.Trim(); flag3 = true; } this.curMarkup.ItemOid = this._bizItem.IterOid; this.curMarkup.ItemIteration = this._bizItem.LastIteration; bool flag4 = false; if (this.browser.CanMarkup()) { try { if (this.NeedUploadMarkupFile(this.curMarkup.FileOid, files[0])) { FSClientUtil.UploadFile(this.curMarkup.MarkupFileOid, files[0], this._bizItem.ClassName, 'I', Guid.Empty, ClientData.LogonUser.Name); flag4 = true; } } catch (Exception exception4) { PrintException.Print(exception4); return; } } try { if (flag3 || flag4) { PLItem.Agent.ModifyMarkup(this.curMarkup, ClientData.LogonUser.Oid); } } catch (Exception exception5) { PrintException.Print(exception5); return; } } Label_036C: ViewFileHelper.DeleteDirectory(this.markLocation); this.IsMarkUpMode = false; }
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("必须定义打开文件的内部浏览器,否则不能批注"); } } }