예제 #1
0
        private void treeList_ShownEditor(object sender, EventArgs e)
        {
            ObjectTreeList   treeList     = (ObjectTreeList)sender;
            IGridInplaceEdit activeEditor = treeList.ActiveEditor as IGridInplaceEdit;

            if (activeEditor != null && treeList.FocusedObject is IXPSimpleObject)
            {
                activeEditor.GridEditingObject = treeList.FocusedObject;
            }
        }
        private void TreeListOnShownEditor(object sender, EventArgs eventArgs)
        {
            IGridInplaceEdit activeEditor = treeList.ActiveEditor as IGridInplaceEdit;

            if (activeEditor != null && treeList.FocusedObject is IXPSimpleObject)
            {
                activeEditor.GridEditingObject = treeList.FocusedObject;
            }

            var currentObject = treeList.FocusedObject as ProtocolRecord;

            if (currentObject != null)
            {
                var type = currentObject.Type;
                if (type.Type == TypeEnum.Complex)
                {
                    treeList.HideEditor(); //скрыть редактор для комплексных типов
                }
                else if (type.Type == TypeEnum.Address)
                {
                    (Application as WinApplication).StartSplash();

                    // показываем окно выбора адреса
                    ShowViewParameters svp = new ShowViewParameters();
                    var        os          = Application.CreateObjectSpace();
                    var        asta        = new AddressSelector(os, currentObject.Value);
                    DetailView dv          = Application.CreateDetailView(os, asta);
                    svp.CreatedView  = dv;
                    svp.TargetWindow = TargetWindow.NewModalWindow;

                    var dc = Application.CreateController <DialogController>();
                    dc.Tag = currentObject;
                    dc.CancelAction.Caption = "Отмена";
                    dc.Accepting           += dc_Accepting;
                    svp.Controllers.Add(dc);

                    dv.Closing += dv_Closing;

                    dv.ControlsCreated += (o, e) =>
                    {
                        (Application as WinApplication).StopSplash();
                    };

                    Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
                }
                else if (type.Type == TypeEnum.List)
                {
                    var checkedComboEditor = treeList.ActiveEditor as CheckedComboBoxEdit;
                    if (checkedComboEditor != null && checkedComboEditor.IsEditorActive)
                    {
                        if (checkedComboEditor.IsPopupOpen == false)
                        {
                            checkedComboEditor.ShowPopup();
                        }
                    }
                    var comboEditor = treeList.ActiveEditor as ComboBoxEdit;
                    if (comboEditor != null && comboEditor.IsEditorActive)
                    {
                        if (comboEditor.IsPopupOpen == false)
                        {
                            comboEditor.ShowPopup();
                        }
                    }
                }
            }
        }