Exemple #1
0
        public DocumentManagerSupport(DevExpress.XtraBars.Docking2010.DocumentManager manager, DevExpress.XtraBars.BarItem[] saveComponents, DevExpress.XtraBars.BarItem[] saveAllComponents)
        {
            _manager = manager;
            _State   = new DocumentManagerState();

            _proxy = SEventProxy.getInstance();
            _proxy.addEventHandler <DocumentChangedEvent>(EventType.DocumentChangedEvent, HandleDocumentChanged);
            _proxy.addEventHandler <VisualControlActionEvent>(EventType.VisualControlActionEvent, HandleVisualControlAction);
            _saveComponents    = saveComponents;
            _saveAllComponents = saveAllComponents;
        }
        public DocumentManagerSupport(DevExpress.XtraBars.Docking2010.DocumentManager manager, DevExpress.XtraBars.BarItem[] saveComponents, DevExpress.XtraBars.BarItem[] saveAllComponents)
        {
            _manager = manager;
            _State = new DocumentManagerState();

            _proxy = SEventProxy.getInstance();
            _proxy.addEventHandler<DocumentChangedEvent>(EventType.DocumentChangedEvent, HandleDocumentChanged);
            _proxy.addEventHandler<VisualControlActionEvent>(EventType.VisualControlActionEvent, HandleVisualControlAction);
            _saveComponents = saveComponents;
            _saveAllComponents = saveAllComponents;
        }
Exemple #3
0
        protected override void AfterLoadState()
        {
            //state can be not loaded!!!!
            if (_State == null)
            {
                _State = new DocumentManagerState();
            }
            else
            {
                BaseDocument first = null;
                _manager.BeginUpdate();

                //state is casted _State
                foreach (VisualControlInfo vci in state.Documents)
                {
                    //do restore so it will mantain vci
                    VisualControl pluginControl = (VisualControl)vci.restoreInstance();
                    if (ReferenceEquals(null, pluginControl))
                    {
                        continue;
                    }

                    BaseDocument document = _manager.View.AddDocument(pluginControl);
                    document.Caption               = vci.Name;
                    document.ControlName           = vci.Name;
                    document.Properties.AllowFloat = DevExpress.Utils.DefaultBoolean.False;

                    // restore control state
                    (pluginControl as IPersistentState)?.LoadState();
                    (pluginControl as IVisualControl)?.Start(VisualControlStartingKind.StartingPersisted);
                    if (first == null)
                    {
                        first = document;
                    }
                }
                _manager.EndUpdate();
                _manager.View.Controller.Activate(first);
                //release VCI from state
                state.Documents = null;
            }
        }
        protected override void AfterLoadState()
        {
			//state can be not loaded!!!!
            if(_State == null) {
				_State = new DocumentManagerState();
			}else {
				BaseDocument first = null;
				_manager.BeginUpdate();

				//state is casted _State
				foreach (VisualControlInfo vci in state.Documents)
				{
					//do restore so it will mantain vci
					VisualControl pluginControl = (VisualControl)vci.restoreInstance();
					BaseDocument document = _manager.View.AddDocument(pluginControl);
					document.Caption = vci.Name;
					document.ControlName = vci.Name;
					document.Properties.AllowFloat = DevExpress.Utils.DefaultBoolean.False;
					
					// restore control state
					(pluginControl as IPersistentState)?.LoadState();
					(pluginControl as IVisualControl)?.Start(VisualControlStartingKind.StartingPersisted);
					if(first == null) {
						first = document;
					}
				}
				_manager.EndUpdate();
				_manager.View.Controller.Activate(first);
				//release VCI from state
				state.Documents = null;
			}			
        }