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

            return(viewData.Form.DialogSetting);
        }
        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());
        }
        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);
        }
        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;
            }
        }
Exemple #6
0
        public IdentKey AddCommand(ICommand view)
        {
            IdentKey ident = _barCommandRegion.AddCommand(view);

            AddToCash(view, ident);
            return(ident);
        }
Exemple #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);
        }
Exemple #8
0
        public bool IsActiveNoModal(IdentKey key)
        {
            _logger.Debug("IsActiveNoModal.");
            ViewData viewData = GetViewByKey(key);

            return(viewData.IsActive);
        }
Exemple #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;
            }
        }
Exemple #10
0
 private void AddToCash(ICommand view, IdentKey key)
 {
     if (view.CommandType == CommandType.Group)
     {
         _parentItemNameCash.Add(view.Name);
     }
     _identKeyCash.Add(key);
 }
Exemple #11
0
        public IdentKey AddCommand(ICommand view, string parentItem)
        {
            IsBelongToMainMenu(parentItem);
            IdentKey ident = _barCommandRegion.AddCommand(view, parentItem);

            AddToCash(view, ident);
            return(ident);
        }
Exemple #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);
        }
        public override void ActivateView(IdentKey key)
        {
            base.ActivateView(key);
            BaseDocument document = null;

            document = GetDocumentByIdentKey(key);
            _documentManager.View.ActivateDocument(document.Control);
        }
Exemple #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;
        }
Exemple #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);
        }
Exemple #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");
        }
Exemple #19
0
        private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_key2 == null)
            {
                return;
            }

            _regionMgr.GetViewRegion("DockingRegion").RemoveView(_key2);
            _key2 = null;
        }
        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;
        }
Exemple #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.");
     }
 }
Exemple #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();
        }
Exemple #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;
        }
Exemple #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);
        }
 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);
 }
        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());
        }
        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());
        }
Exemple #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);
        }
        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());
            }
        }