示例#1
0
        public DialogSetting GetDialogSetting(IdentKey key)
        {
            _logger.Debug("GetDialogSetting.");
            ViewData viewData = GetViewByKey(key);

            return(viewData.Form.DialogSetting);
        }
示例#2
0
        void OnDocumentClosing(object sender, DocumentCancelEventArgs e)
        {
            BaseDocument doc  = e.Document;
            IdentKey     key  = doc.Tag as IdentKey;
            IView        view = null;

            if (key == null || !_views.TryGetValue(key, out view))
            {
                return;
            }

            if (!view.CanClose || !view.OnClosing(null))
            {
                e.Cancel = true;
            }
            else if (_documentManager.View.FloatDocuments.IndexOf(doc) == -1)
            {
                TabbedView tabbedView = _documentManager.View as TabbedView;
                //tabbedView.ReleaseDeferredLoadControl(e.Document);
                e.Cancel = true;
                doc.Form.Hide();
                doc.Form.MdiParent = null;
                tabbedView.Controller.RemoveDocument(doc);
                view.OnAfterClose();
                _views.Remove(key);
            }

            _logger.Debug("OnDocumentClosing event. " + view.ToString());
        }
示例#3
0
        void OnActivePanelChanged(object sender, ActivePanelChangedEventArgs e)
        {
            IdentKey  key   = null;
            IView     view  = null;
            DockPanel panel = e.Panel;

            if (panel != null)
            {
                key = panel.Tag as IdentKey;
                if (key == null || !_views.TryGetValue(key, out view))
                {
                    return;
                }
                _logger.Debug("OnActivePanelChanged event. Activate. " + view.ToString());
            }

            panel = e.OldPanel;
            if (panel != null)
            {
                key = panel.Tag as IdentKey;
                if (key == null || !_views.TryGetValue(key, out view))
                {
                    return;
                }
                _logger.Debug("OnActivePanelChanged event. Deacivate" + view.ToString());
            }
        }
        public IdentKey AddCommand(ICommand view)
        {
            IdentKey ident = _barCommandRegion.AddCommand(view, _subMenu.Name);

            _identKeyCash.Add(ident);
            return(ident);
        }
示例#5
0
        public override IdentKey AddView(IView view, ViewDockingState state, ViewDockingStateFlagExt allowStates)
        {
            IdentKey     key     = base.AddView(view);
            Control      control = view.UserControl as Control;
            BaseDocument doc     = null;

            try
            {
                control.Name                 = view.Name; //<<>>
                doc                          = CreateDocument(control);
                doc.Image                    = view.Image;
                doc.ControlName              = view.Name;
                doc.Caption                  = view.Caption;
                doc.Image                    = view.Image;
                doc.Tag                      = key;
                doc.Properties.AllowFloat    = (allowStates & ViewDockingStateFlagExt.Float) == ViewDockingStateFlagExt.Float ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;
                doc.Properties.AllowDock     = (allowStates & ViewDockingStateFlagExt.Dock) == ViewDockingStateFlagExt.Dock ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;
                doc.Properties.AllowClose    = (allowStates & ViewDockingStateFlagExt.Close) == ViewDockingStateFlagExt.Close ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;
                doc.Properties.AllowActivate = (allowStates & ViewDockingStateFlagExt.Activate) == ViewDockingStateFlagExt.Activate ? DevExpress.Utils.DefaultBoolean.True : DevExpress.Utils.DefaultBoolean.False;
                _views.Add(key, view);
                return(key);
            }
            catch (Exception ex)
            {
                ClearDocumentResource(key, view);
                throw ex;
            }
        }
示例#6
0
        public IdentKey AddCommand(ICommand view)
        {
            IdentKey ident = _barCommandRegion.AddCommand(view);

            AddToCash(view, ident);
            return(ident);
        }
示例#7
0
        private void ShowNoModalItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            IView view = CreateView();

            _key = _dialogMgr.ShowNoModal(view, DialogFormOption.ShowMinimizeButton);
            _dict.Add(_key, view);
        }
示例#8
0
        public bool IsActiveNoModal(IdentKey key)
        {
            _logger.Debug("IsActiveNoModal.");
            ViewData viewData = GetViewByKey(key);

            return(viewData.IsActive);
        }
示例#9
0
        void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            _logger.Debug("OnFormClosing");
            if (e.CloseReason != CloseReason.UserClosing && e.CloseReason != CloseReason.None)
            {
                return;
            }
            ViewData viewData = null;

            try
            {
                IdentKey key = GetKeyOfFormBase(sender);
                viewData = GetViewByKey(key);
                viewData.DialogResult = viewData.Form.DialogResult;
                if ((viewData.DialogResult != DialogResult.Cancel && viewData.DialogResult != DialogResult.None && !viewData.View.CanClose) || !viewData.View.OnClosing(ConvertDialogResultToNBool(viewData.DialogResult)))
                {
                    viewData.Form.DialogResult = DialogResult.None;
                    e.Cancel = true;
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                viewData.Form.DialogResult = DialogResult.None;
                e.Cancel = true;
            }
        }
示例#10
0
 private void AddToCash(ICommand view, IdentKey key)
 {
     if (view.CommandType == CommandType.Group)
     {
         _parentItemNameCash.Add(view.Name);
     }
     _identKeyCash.Add(key);
 }
示例#11
0
        public IdentKey AddCommand(ICommand view, string parentItem)
        {
            IsBelongToMainMenu(parentItem);
            IdentKey ident = _barCommandRegion.AddCommand(view, parentItem);

            AddToCash(view, ident);
            return(ident);
        }
示例#12
0
 public EntityBase(string name)
 {
     _key          = new IdentKey();
     _cloneKey     = _key;
     _id           = _defaultId;
     _iPersisit    = false;
     _internalName = string.Format("{0}_{1}", name, _key.ToString());
 }
        public void RemoveButton(IdentKey key)
        {
            BarButtonItem button = GetButtonByKey(key);

            button.ItemClick -= new ItemClickEventHandler(button_ItemClick);
            _barManager.Items.Remove(button);
            _ButtonItems.Remove(key);
        }
示例#14
0
        public override void ActivateView(IdentKey key)
        {
            base.ActivateView(key);
            BaseDocument document = null;

            document = GetDocumentByIdentKey(key);
            _documentManager.View.ActivateDocument(document.Control);
        }
示例#15
0
        void OnLocationChanged(object sender, EventArgs e)
        {
            FormBase form     = sender as FormBase;
            IdentKey key      = form.Tag as IdentKey;
            ViewData viewData = GetViewByKey(key);

            viewData.View.DialogSetting = form.DialogSetting;
        }
示例#16
0
        void OnStatusBarButtonClick(IdentKey key, bool isActivate)
        {
            ViewData viewData = GetViewByKey(key);

            viewData.IsActive = isActivate;
            ChangeFormState(viewData, isActivate);
            viewData.View.OnActivate(isActivate);
        }
        public IdentKey AddCommand(ICommand view, string parentItem)
        {
            IsBelongToSubItem(parentItem);
            IdentKey ident = _barCommandRegion.AddCommand(view, parentItem);

            _identKeyCash.Add(ident);
            return(ident);
        }
示例#18
0
        private void simpleButton2_Click_1(object sender, EventArgs e)
        {
            ICommand command = new Command("testcommand2", () => { }, IsEnable, "NewMenu", null, null, "1", null, Core.SDK.Composite.UI.CommandType.Group);

            _key2   = _regionMgr.GetCommandRegion(Core.SDK.Composite.UI.CommonRegionName.MainMenu).AddCommand(command);
            command = new Command("testcommand2_1", () => { MessageBox.Show("test2_1"); }, IsEnable, "NewMenuItem", null, null, "1_1", null, Core.SDK.Composite.UI.CommandType.CheckButton);
            _key3   = _regionMgr.GetCommandRegion(Core.SDK.Composite.UI.CommonRegionName.MainMenu).AddCommand(command, "NewMenu");
        }
示例#19
0
        private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_key2 == null)
            {
                return;
            }

            _regionMgr.GetViewRegion("DockingRegion").RemoveView(_key2);
            _key2 = null;
        }
示例#20
0
        public override void ActivateView(IdentKey key)
        {
            base.ActivateView(key);
            DockPanel panel = GetPanelByIdentKey(key);

            if (panel == null)
            {
                throw new InvalidOperationException("View's panel with such key is not find.");
            }
            _dockManager.ActivePanel = panel;
        }
示例#21
0
        public IdentKey ShowNoModal(IView view, DialogFormOption options, DialogSetting settings)
        {
            _logger.Debug("ShowNoModal.");
            IdentKey key      = CreateViewForm(view, options, settings);
            ViewData viewData = GetViewByKey(key);

            viewData.IsModal = false;
            viewData.Form.Show(_parentForm);
            viewData.Form.Focus();
            return(key);
        }
 public void RefreshCommand(IdentKey key)
 {
     if (_identKeyCash.IndexOf(key) != -1)
     {
         _barCommandRegion.RefreshCommand(key);
     }
     else
     {
         throw new InvalidOperationException("Command with such key is not found.");
     }
 }
示例#23
0
        public void CloseNoModal(IdentKey key)
        {
            _logger.Debug("CloseNoModal.");
            ViewData viewData = GetViewByKey(key);

            if (viewData.IsClose == true)
            {
                throw new InvalidOperationException("View already close.");
            }
            viewData.Form.Close();
        }
示例#24
0
        void OnSizeChanged(object sender, EventArgs e)
        {
            IdentKey key      = GetKeyOfFormBase(sender);
            ViewData viewData = GetViewByKey(key);
            FormBase form     = sender as FormBase;

            if ((viewData.Form.DialogFormOption & DialogFormOption.ShowInOSTaskBar) == 0 && viewData.Form.WindowState == FormWindowState.Minimized && !viewData.IsModal)
            {
                viewData.Form.Hide();
            }
            viewData.View.DialogSetting = form.DialogSetting;
        }
示例#25
0
        private void OnChangeState(IdentKey key, bool isActivate)
        {
            ViewData viewData = GetViewByKey(key);

            viewData.IsActive = isActivate;
            if (viewData.Form.WindowState != FormWindowState.Minimized)
            {
                viewData.FormWindowState = viewData.Form.WindowState;
            }
            _statusBarButtonController.ChangeButtonState(key, isActivate);
            viewData.View.OnActivate(isActivate);
        }
示例#26
0
 private DockPanel GetPanelByIdentKey(IdentKey key)
 {
     foreach (DockPanel panel in _dockManager.Panels)
     {
         IdentKey panelKey = panel.Tag as IdentKey;
         if (key != null && panelKey == key)
         {
             return(panel);
         }
     }
     return(null);
 }
示例#27
0
        void OnEndDocking(object sender, EndDockingEventArgs e)
        {
            DockPanel panel = e.Panel;
            IdentKey  key   = panel.Tag as IdentKey;
            IView     view  = null;

            if (key == null || !_views.TryGetValue(key, out view))
            {
                return;
            }
            _logger.Debug("OnEndDocking event. " + view.ToString());
        }
示例#28
0
        void OnEndDocking(object sender, DocumentEventArgs e)
        {
            BaseDocument doc  = e.Document;
            IdentKey     key  = doc.Tag as IdentKey;
            IView        view = null;

            if (key == null || !_views.TryGetValue(key, out view))
            {
                return;
            }
            _logger.Debug("OnEndDocking event. " + view.ToString());
        }
示例#29
0
        public DialogResult ShowModal(IView view, DialogFormOption options, DialogSetting settings)
        {
            _logger.Debug("ShowModal.");
            IdentKey key      = null;
            ViewData viewData = null;

            key      = CreateViewForm(view, options, settings);
            viewData = GetViewByKey(key);
            viewData.Form.ShowInTaskbar = false; // Hack: ShowDialog и ShowInTaskbar = true не работают вместе
            viewData.IsModal            = true;
            viewData.Form.ShowDialog(_parentForm);
            return(viewData.DialogResult);
        }
示例#30
0
        void OnDocumentDeactivated(object sender, DocumentEventArgs e)
        {
            BaseDocument activeDoc = e.Document;
            IView        view      = null;

            IdentKey key = activeDoc.Tag as IdentKey;

            if (key != null && _views.TryGetValue(key, out view))
            {
                view.OnActivate(false);
                _logger.Debug("OnDocumentDeactivated event. " + view.ToString());
            }
        }