public ThumToolsBaseCtrl(Control container, Control itemViewCtrl, string location, bool isShowToolBar) { this.InitializeComponent(); this.location = location; this.container = container; this.itemViewCtrl = itemViewCtrl; this.thumSetting = UIThumbnailHelper.Instance.ReadSetting(location); this.panRight.Width = this.thumSetting.PreviwWidth; if (this.ucThumbnail == null) { this.ucThumbnail = new UCThumbnail(this.thumSetting); this.ucThumbnail.Dock = DockStyle.Fill; } base.Controls.Remove(this.panMain); if (!isShowToolBar) { this.panMain.Controls.Remove(this.toolBar); } this.panMain.Dock = DockStyle.Fill; this.itemViewCtrl.Dock = DockStyle.Fill; this.panLeft.Controls.Add(this.itemViewCtrl); this.panRight.Controls.Add(this.ucThumbnail); this.container.Controls.Add(this.panMain); this.tspBtnDisplay.Checked = this.thumSetting.DisplayStyle == DisplayStyle.Thumbnail; this.tspBtnDisplay.Image = (this.thumSetting.DisplayStyle == DisplayStyle.Thumbnail) ? this.imageList1.Images[1] : this.imageList1.Images[0]; this.tspBtnPreview.Checked = this.thumSetting.IsPreview; this.panRight.Visible = this.tspBtnPreview.Checked; this.panRight.Width = this.thumSetting.PreviwWidth; if (this.DisplayStyleChanged != null) { this.DisplayStyleChanged(this, new ThumToolsEventArgs(this.thumSetting.IsPreview, this.thumSetting.DisplayStyle)); } }
public bool Display(object obizItem, DEPSOption psOption, ThumbnailSetting thumSetting) { if (obizItem is TreeNode) { obizItem = ((TreeNode)obizItem).Tag; } if (obizItem is DataRowView) { DataRowView view = (DataRowView)obizItem; obizItem = PLItem.Agent.GetBizItemByMaster(new Guid((byte[])view[0]), 0, psOption.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem) as DEBusinessItem; } if (!(obizItem is IBizItem)) { this.bizItem = null; this.InitFileRelaData(); int generation = GC.GetGeneration(this.pnlViewer); BrowserPool.BrowserManager.RemoveBrowser(this.pnlViewer); this.pnlViewer.Controls.Clear(); GC.Collect(generation); return(this.toolStrip1.Visible = false); } bool flag = false; if (this.bizItem == null) { flag = true; } else if (((IBizItem)obizItem).MasterOid != this.bizItem.MasterOid) { flag = true; } this.bizItem = PSConvert.ToBizItem(obizItem as IBizItem, psOption.CurView, ClientData.LogonUser.Oid); this.toolStrip1.Visible = true; this.psOption = psOption; this.thumSetting = thumSetting; bool flag2 = this.InitFiles(); if (!flag) { flag = flag2; } if (!flag) { this.toolStrip1.Visible = (this.curFile != null) && this.thumSetting.IsShowToolBar; return(this.curFile != null); } this.SetShowTypeContent(this.thumSetting); this.ShowFile(); this.toolStrip1.Visible = (this.curFile != null) && this.thumSetting.IsShowToolBar; return(this.curFile != null); }
public void SetShowTypeContent(ThumbnailSetting thumSetting) { this.thumSetting = thumSetting; PreviewStyle style = (PreviewStyle)Enum.Parse(typeof(PreviewStyle), ClientData.PreviewStyle); switch (style) { case PreviewStyle.Thumbnail: this.tspBtnShowType.Checked = true; this.tspBtnShowType.Text = "缩略图"; this.tspBtnShowType.Visible = false; this.toolStripSeparator1.Visible = false; break; case PreviewStyle.Visualization: this.tspBtnShowType.Checked = false; this.tspBtnShowType.Text = "可视化"; this.tspBtnShowType.Visible = false; this.toolStripSeparator1.Visible = false; break; } if (style == PreviewStyle.Thumbnail2Visualization) { if ((this.thumbnailFiles != null) && (this.thumbnailFiles.Count != 0)) { this.tspBtnShowType.Checked = true; this.tspBtnShowType.Text = "缩略图"; this.tspBtnShowType.Visible = (this.visualizationFiles != null) && (this.visualizationFiles.Count != 0); this.toolStripSeparator1.Visible = true; } else if ((this.visualizationFiles != null) && (this.visualizationFiles.Count != 0)) { this.tspBtnShowType.Checked = false; this.tspBtnShowType.Text = "可视化"; this.tspBtnShowType.Visible = false; this.toolStripSeparator1.Visible = false; } } if (((this.visualizationFiles == null) || (this.visualizationFiles.Count == 0)) && ((this.thumbnailFiles == null) || (this.thumbnailFiles.Count == 0))) { this.tspBtnShowType.Checked = true; this.tspBtnShowType.Text = "缩略图"; this.tspBtnShowType.Visible = false; this.toolStripSeparator1.Visible = false; } this.SetPageBtnsVisible(); }
public void SaveSetting(string location, ThumbnailSetting setting) { FileStream stream = null; try { string configFileName = this.GetConfigFileName(location, ModelContext.ConfigFileAccess.Write); if (File.Exists(configFileName)) { File.Delete(configFileName); } XmlSerializer serializer = new XmlSerializer(typeof(ThumbnailSetting)); stream = new FileStream(configFileName, FileMode.Create, FileAccess.Write); serializer.Serialize((Stream)stream, setting); stream.Close(); } catch (Exception exception) { PrintException.Print(exception); } finally { if (stream != null) { stream.Close(); } } }
public ThumbnailSetting ReadSetting(string location) { string configFileName = this.GetConfigFileName(location, ModelContext.ConfigFileAccess.Read); ThumbnailSetting setting = new ThumbnailSetting(); if (File.Exists(configFileName)) { FileStream stream = null; try { XmlSerializer serializer = new XmlSerializer(typeof(ThumbnailSetting)); stream = new FileStream(configFileName, FileMode.Open, FileAccess.Read); setting = (ThumbnailSetting)serializer.Deserialize(stream); } catch (Exception exception) { PrintException.Print(exception); } finally { if (stream != null) { stream.Close(); } } } return(setting); }
public UCThumbnail(ThumbnailSetting thumSetting) { this.InitializeComponent(); this.thumSetting = thumSetting; this.toolStrip1.Visible = false; }