예제 #1
0
 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);
            }
        }
예제 #3
0
 public void SetDocumentControlActive(IDocumentControl documentContorl)
 {
     if (DocumentList != null && DocumentList.Count > 0 && DocumentList.Contains(documentContorl))
     {
         mainForm.ManualActiveADocumentControl(documentContorl);
     }
 }
예제 #4
0
        /// <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);
        }
예제 #5
0
 public void ClearStatusInfo(IDocumentControl documentControl)
 {
     if (documentStatuses.ContainsKey(documentControl))
     {
         StatusInfo statusInfo;
         documentStatuses.TryRemove(documentControl, out statusInfo);
     }
     ShowActiveDocumentStauts();
 }
예제 #6
0
        public static void SetConfigItem(string name, object value)
        {
            IDocumentControl control = CANAPEServiceProvider.GlobalInstance.GetService(typeof(IDocumentControl)) as IDocumentControl;

            if (control != null)
            {
                control.SetConfigItem(name, value);
            }
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
        public static void Close(IDocumentObject document)
        {
            IDocumentControl control = CANAPEServiceProvider.GlobalInstance.GetService(typeof(IDocumentControl)) as IDocumentControl;

            if (control != null)
            {
                control.CloseDocumentForm(document);
            }
        }
예제 #9
0
 public MultiThreadStatusStartEventData(IDocument document, IDocumentControl documentControl)
 {
     this.StatusInfo = new StatusInfo
     {
         StatusShowType = StatusShowType.ProcessBarWithoutProcess
     };
     this.Document        = document;
     this.DocumentControl = documentControl;
 }
예제 #10
0
        /// <summary>
        /// 手动激活一个control
        /// </summary>
        /// <param name="documentControl"></param>
        public void ManualActiveADocumentControl(IDocumentControl documentControl)
        {
            var control = documentControl as Control;

            if (control != null)
            {
                this.tabbedView.ActivateDocument(control);
            }
        }
예제 #11
0
 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;
    }
예제 #13
0
 public MultiThreadStatusStartEventData(string msg,
                                        IDocument document,
                                        IDocumentControl documentControl)
 {
     this.StatusInfo = new StatusInfo
     {
         Message        = msg,
         StatusShowType = StatusShowType.Msg
     };
     this.Document        = document;
     this.DocumentControl = documentControl;
 }
예제 #14
0
 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;
 }
예제 #15
0
 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);
 }
예제 #16
0
 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;
 }
예제 #17
0
        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);
        }
예제 #18
0
        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);
            }
        }
예제 #19
0
        /// <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);
        }
예제 #20
0
 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;
 }
예제 #22
0
        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));
        }