private void InitializeLvwImage() { string str = ""; this.ImageListLarge = new ImageList(); this.ImageListSmall = new ImageList(); this.lvwImage.LargeImageList = this.ImageListLarge; this.lvwImage.SmallImageList = this.ImageListSmall; this.lvwImage.View = View.Details; this.lvwImage.Items.Clear(); try { this.myList = new PLPicture().GetAllPictures(); if (this.myList.Count > 0) { int num; DEPicture picture2 = null; string filename = ""; for (num = 0; num < this.myList.Count; num++) { picture2 = (DEPicture)this.myList[num]; filename = FSClientUtil.DownloadFile(picture2.Oid, "ClaRel_BROWSE"); picture2.Name = filename; this.ImageListLarge.Images.Add(Image.FromFile(filename)); this.ImageListSmall.Images.Add(Image.FromFile(filename)); } ListViewItem item = null; for (num = 0; num < this.myList.Count; num++) { picture2 = (DEPicture)this.myList[num]; item = new ListViewItem(picture2.Alias, num); long size = picture2.Size; if (picture2.Size >= 0x400L) { size = picture2.Size / 0x400L; str = size.ToString() + " KB"; } else if (picture2.Size < 0x400L) { str = size.ToString() + " 字节"; } item.SubItems.AddRange(new string[] { str, picture2.Creator, picture2.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), picture2.Modifier, picture2.ModifyTime.ToString("yyyy-MM-dd HH:mm:ss"), picture2.Description }); item.Tag = picture2; this.lvwImage.Items.Add(item); } } } catch (PLMException exception) { PrintException.Print(exception); } catch (Exception exception2) { MessageBoxPLM.Show("初始化图片列表出错:" + exception2.Message, "图片资源"); } }
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 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 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("必须定义打开文件的内部浏览器,否则不能批注"); } } }