public void CloseADocumentControl(IDocumentControl documentContorl) { if (DocumentList != null && DocumentList.Contains(documentContorl)) { DocumentList.Remove(documentContorl); } }
public virtual void Open() { if (string.IsNullOrEmpty(FullName)) { throw new FileNotFoundException("未找到文件:" + FullName); } if (DocumentManager.DocumentList != null && DocumentManager.DocumentList.Count > 0) { //假如文档中已经存在,激活 foreach (IDocumentControl documentControl in DocumentManager.DocumentList) { if (documentControl.Document.DocumentResource is ISingleFileDocumentResource && ((ISingleFileDocumentResource)documentControl.Document.DocumentResource).FullName.Equals(FullName) ) { DocumentManager.SetDocumentControlActive(documentControl); return; } } } IDocumentControl docControl = IocManager.Resolve(DocumentControlType.Type) as IDocumentControl; if (docControl != null) { IDocumentControl documentControl = DocumentManager.AddADocument(DocumentControlType, Path.GetFileName(FullName)); documentControl.Open(this); } else { throw new DocumentOpenException("未找到打开文档的Control," + DocumentControlType.TypeName); } }
public void SetDocumentControlActive(IDocumentControl documentContorl) { if (DocumentList != null && DocumentList.Count > 0 && DocumentList.Contains(documentContorl)) { mainForm.ManualActiveADocumentControl(documentContorl); } }
/// <summary> /// 在中间的tab 页新添加一个文档 /// </summary> /// <param name="documentControl"></param> /// <returns></returns> public IDocumentControl AddADocument(IDocumentControl documentControl, string name) { if (!(documentControl is Control)) { throw new WinformUIExceptionDeal("Type of " + documentControl.GetType().FullName + " is not a control."); } //XtraUserControl child = new XtraUserControl(); DocumentSettings DocumentSettings = new DocumentSettings(); if (documentControl.Document != null) { DocumentSettings.Caption = documentControl.Document.DocumentName ?? name; if (documentControl.DocumentImage != null) { DocumentSettings.Image = documentControl.DocumentImage; } } //DocumentSettings.Attach(child, DocumentSettings); //((Control)documentControl).Parent = child; ((Control)documentControl).Dock = DockStyle.Fill; ((Control)documentControl).GotFocus += (sender, e) => { }; ((Control)documentControl).Visible = true; DocumentSettings.Attach((Control)documentControl, DocumentSettings); this.documentManagerDocking.TabbedView.AddDocument((Control)documentControl); return(documentControl); }
public void ClearStatusInfo(IDocumentControl documentControl) { if (documentStatuses.ContainsKey(documentControl)) { StatusInfo statusInfo; documentStatuses.TryRemove(documentControl, out statusInfo); } ShowActiveDocumentStauts(); }
public static void SetConfigItem(string name, object value) { IDocumentControl control = CANAPEServiceProvider.GlobalInstance.GetService(typeof(IDocumentControl)) as IDocumentControl; if (control != null) { control.SetConfigItem(name, value); } }
public static void SetIcon(IDocumentObject document, string iconName, Icon icon) { IDocumentControl control = CANAPEServiceProvider.GlobalInstance.GetService(typeof(IDocumentControl)) as IDocumentControl; if (control != null) { control.SetDocumentIcon(document, iconName, icon); } }
public static void Close(IDocumentObject document) { IDocumentControl control = CANAPEServiceProvider.GlobalInstance.GetService(typeof(IDocumentControl)) as IDocumentControl; if (control != null) { control.CloseDocumentForm(document); } }
public MultiThreadStatusStartEventData(IDocument document, IDocumentControl documentControl) { this.StatusInfo = new StatusInfo { StatusShowType = StatusShowType.ProcessBarWithoutProcess }; this.Document = document; this.DocumentControl = documentControl; }
/// <summary> /// 手动激活一个control /// </summary> /// <param name="documentControl"></param> public void ManualActiveADocumentControl(IDocumentControl documentControl) { var control = documentControl as Control; if (control != null) { this.tabbedView.ActivateDocument(control); } }
private void ShowDocumentStatus(IDocumentControl documentControl) { if (documentControl != null) { if (documentStatuses.ContainsKey(documentControl)) { ShowStauts(documentStatuses[documentControl]); } } }
public UserControlDockContent(string title, UserControl control, DockAreas dockAreas = DockAreas.Document) { InitializeComponent(); Text = title.EscapeAmpersand(); control.Dock = DockStyle.Fill; Controls.Add(control); Content = control as IDocumentControl; // disable floating windows DockAreas = dockAreas; }
public MultiThreadStatusStartEventData(string msg, IDocument document, IDocumentControl documentControl) { this.StatusInfo = new StatusInfo { Message = msg, StatusShowType = StatusShowType.Msg }; this.Document = document; this.DocumentControl = documentControl; }
public MultiThreadStatusStartEventData(int maxValue, IDocument document, IDocumentControl documentControl) { this.StatusInfo = new StatusInfo { StatusShowType = StatusShowType.ProcessBar, MaxValue = maxValue, CurrentValue = 0 //线程起来时,初始值为0 }; this.Document = document; this.DocumentControl = documentControl; }
public void SetStatusInfo(IDocumentControl documentControl, StatusInfo statusInfo) { if (documentControl == null) { return; } if (this.documentStatuses.ContainsKey(documentControl)) { documentStatuses[documentControl] = statusInfo; } else { documentStatuses.TryAdd(documentControl, statusInfo); } ShowDocumentStatus(documentControl); }
public void InitParams(IDocumentControl hostControl) { showLineWeight = false; useSelectEntity = false; useSHXFonts = false; ChangeTypeFont(); textVisible = true; dimVisible = true; useWinEllipse = false; lngFile = ""; curLngIndex = 0; ImageScale = 1; drawMode = true; Orb3D = new Orbit3D(); this.Orb3D.RotateEvent += new CADImport.FaceModule.CADImportEventHandler(this.ResizeLayout); this.useDoubleBuffering = true; this.HostControl = hostControl; }
public static T GetConfigItem <T>(string name, bool create) where T : class, new() { IDocumentControl control = CANAPEServiceProvider.GlobalInstance.GetService(typeof(IDocumentControl)) as IDocumentControl; T ret = null; if (control != null) { object item = control.GetConfigItem(name); ret = item as T; } if ((ret == null) && create) { return(new T()); } return(ret); }
public void Open() { if (string.IsNullOrEmpty(FilePath)) { throw new FileNotFoundException("未发现文件:" + FilePath); } IDocumentControl docControl = IocManager.Resolve(DocumentControlType.Type) as IDocumentControl; if (docControl != null) { IDocumentControl documentControl = DocumentManager.AddADocument <CADViewerControl>(Path.GetFileNameWithoutExtension(FilePath)); ((CADViewerControl)documentControl).OpenFile(FilePath); ToolbarControl.CADFileOpen(); } else { throw new DocumentOpenException("未找到打开文档的Control," + DocumentControlType.TypeName); } }
/// <summary> /// 在中间的tab 页新添加一个文档 /// </summary> /// <param name="documentControl"></param> /// <returns></returns> public IDocumentControl AddADocument(IDocumentControl documentControl, string name) { if (!(documentControl is Control)) { throw new WinformUIExceptionDeal("Type of " + documentControl.GetType().FullName + " is not a control."); } XtraUserControl child = new XtraUserControl(); DocumentSettings DocumentSettings = new DocumentSettings(); if (documentControl.Document != null) { DocumentSettings.Caption = documentControl.Document.DocumentName ?? name; if (documentControl.DocumentImage != null) { DocumentSettings.Image = documentControl.DocumentImage; } } DocumentSettings.Attach(child, DocumentSettings); ((Control)documentControl).Parent = child; ((Control)documentControl).Dock = DockStyle.Fill; ((Control)documentControl).GotFocus += (sender, e) => { var tempActiveDocument = this.ActiveDocumentControl; this.ActiveDocumentControl = sender as IDocumentControl; if (this.ActiveDocumentControl.PropertiesControl != null) { Control propertiesControl = (Control)this.ActiveDocumentControl.PropertiesControl; propertiesControl.Dock = DockStyle.Fill; if (this.PropertiesPanel.Controls.Count > 0) { this.PropertiesPanel.Controls.Clear(); } this.PropertiesPanel.AddControl(propertiesControl); } EventBus.Default.Trigger(new DocumentActiveChangeEventData { ChangeFromDocumentControl = tempActiveDocument, ChangeToDocumentControl = ActiveDocumentControl }); }; ((Control)documentControl).Visible = true; this.documentManagerDocking.TabbedView.AddDocument(child); return(documentControl); }
private void ApplySaveOnClose(UserControlDockContent f, IDocumentControl doc) { f.FormClosing += (sender, e) => doc.Save(); }
public MultiThreadStatusEndEventData(IDocument document, IDocumentControl documentControl) { this.Document = document; this.DocumentControl = documentControl; }
public static IComponent ShowControl(string name, Control control, Control parentControl) { IDocumentControl c = CANAPEServiceProvider.GlobalInstance.GetService(typeof(IDocumentControl)) as IDocumentControl; return(c.HostControl(name, control, parentControl)); }