private void ButtonProperty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UIPublic.ShowWaitingForm();
            var propertyValue = EditValue;

            var objectType = propertyValue.GetType();
            BaseObjectEditControl editControl = null;

            // 如果不是PaoObject类型,则显示默认编辑控件
            if (!objectType.IsAddonType())
            {
                editControl = EditorPublic.CreateEditControl(objectType) as BaseObjectEditControl;
            }

            if (editControl == null)
            {
                var editController = EditorPublic.GetOrCreateEditControllerFromStorage <ObjectLayoutEditController>(objectType);
                editControl = editController.CreateEditControl(objectType) as BaseObjectEditControl;
            }

            editControl.EditValue = IOPublic.ObjectClone(propertyValue);
            UIPublic.CloseWaitingForm();
            if (WinFormPublic.ShowDialog(editControl) == DialogReturn.OK)
            {
                EditValue = editControl.EditValue;
            }
            SetControlStatus();
        }
Esempio n. 2
0
        /// <summary>
        /// 显示异常对话框
        /// </summary>
        /// <param name="exception">异常对话框</param>
        protected virtual void ShowExceptionDialog(Exception exception)
        {
            UIPublic.ShowWaitingForm();
            var eventInfo = new ExceptionEventInfo(exception, true, true);

            UIPublic.CloseWaitingForm();
            UIPublic.ShowEventDialog(eventInfo);
        }
Esempio n. 3
0
        private void ButtonConfigTools_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UIPublic.ShowWaitingForm();
            var objectTreeControl = new ObjectTreeEditControl();

            objectTreeControl.EditValue = PaoApplication.Default;
            UIPublic.CloseWaitingForm();
            WinFormPublic.ShowDialog(objectTreeControl);
        }
Esempio n. 4
0
 public void Waiting(Action action, string message = "程序运行中...")
 {
     SetStatusText(message);
     UIPublic.ShowWaitingForm();
     this.EditItemWaitingBar.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
     this.Refresh();
     action();
     this.EditItemWaitingBar.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
     SetStatusText(Message_Status_Ready);
     UIPublic.CloseWaitingForm();
 }
Esempio n. 5
0
        private void ButtonAddonSelect_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UIPublic.ShowWaitingForm();
            var typeSelectControl = new TypeSelectControl();

            typeSelectControl.Initialize(p =>
            {
                return(p.IsDerivedFrom <DataFilter>());
            });
            UIPublic.CloseWaitingForm();
            WinFormPublic.ShowDialog(typeSelectControl);
        }
Esempio n. 6
0
        private void ButtonTestException_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UIPublic.ShowWaitingForm();
            var eventInfo = new ExceptionEventInfo(new Exception("这是测试消息")
                                                   , true
                                                   , true).AddEventData("测试", "测试");
            var eventControl = new EventControl();

            eventControl.Initialize(eventInfo);
            UIPublic.CloseWaitingForm();
            WinFormPublic.ShowDialog(eventControl);
        }
Esempio n. 7
0
 private void ButtonRemoteException_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     UIPublic.ShowWaitingForm();
     try {
         var testService = new TcpRemoteFactory <ITestService>()
         {
             ServerAddress = "localhost:7990",
             ServiceName   = "TestService"
         }.Value;
         testService.GetString("Exception");
     } catch (Exception err) {
         UIPublic.CloseWaitingForm();
         UIPublic.ShowEventDialog(new ExceptionEventInfo(err, true, true));
     }
 }
Esempio n. 8
0
        private void ButtonTestInformation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            EventControl eventControl = null;

            UIPublic.ShowWaitingForm();
            var eventInfo = new EventInfo(EventInfo.EventType_Information
                                          , "这是测试消息"
                                          , true
                                          , true);

            eventControl = new EventControl();
            eventControl.Initialize(eventInfo);
            UIPublic.CloseWaitingForm();

            WinFormPublic.ShowDialog(eventControl);
        }
Esempio n. 9
0
        private void ButtonCallRemote_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            UIPublic.ShowWaitingForm();
            string resultString = "";
            var    task         = Task.Factory.StartNew(() =>
            {
                var testService = new TcpRemoteFactory <ITestService>()
                {
                    ServerAddress = "localhost:7990",
                    ServiceName   = "TestService"
                }.Value;
                resultString = testService.GetString("Hello world!");
            });

            task.Wait();
            UIPublic.CloseWaitingForm();
            UIPublic.ShowInfomationDialog(resultString);
        }
Esempio n. 10
0
        /// <summary>
        /// 根据对象填充属性字段
        /// </summary>
        /// <param name="groupItem">组项目</param>
        /// <param name="objType">对象类型</param>
        private void RetrieveFields(LayoutControlGroup groupItem, Type objType)
        {
            UIPublic.ShowWaitingForm();
            this.DataLayoutControl.CloseControl();
            EditControls.Clear();
            this.DataLayoutControl.Clear(true, true);

            var controller = Controller as ObjectLayoutEditController;

            if (objType == null)
            {
                return;
            }

            this.DataLayoutControl.SuspendLayout();
            TabbedControlGroup tabbledGroup = null;

            foreach (PropertyDescriptor propDesc in TypeDescriptor.GetProperties(objType))
            {
                if (!propDesc.IsBrowsable)
                {
                    continue;
                }

                BaseEditController editController = null;
                Control            editControl    = null;

                if (controller != null)
                {
                    editController = controller.GetPredefinedEditController(propDesc.PropertyType, propDesc.Name);
                }

                if (editController == null)
                {
                    if (propDesc.PropertyType.IsAddon())
                    {
                        var commonEditController = new CommonObjectEditController();
                        commonEditController.StartEditProperty(EditValue, propDesc.Name);
                        editController = commonEditController;
                    }
                    else
                    {
                        editController = EditorPublic.GetEditController(propDesc);
                    }
                }

                editControl = editController.CreateEditControl(propDesc.PropertyType);

                if (editControl.GetType().GetProperty("EditValue") == null)
                {
                    throw new Exception("编辑控件必须实现EditValue属性");
                }

                LayoutControlItem layoutControlItem = null;
                if (editControl is BaseObjectEditControl)
                {
                    if (tabbledGroup == null)
                    {
                        tabbledGroup = groupItem.AddTabbedGroup();
                    }
                    var layoutGroupItem = tabbledGroup.AddTabPage();
                    layoutGroupItem.Name = "Group_" + propDesc.Name;
                    layoutGroupItem.Text = propDesc.DisplayName;
                    layoutGroupItem.CustomizationFormText = "组_" + propDesc.DisplayName;
                    layoutGroupItem.Padding = new DevExpress.XtraLayout.Utils.Padding(0);

                    layoutControlItem = layoutGroupItem.AddItem();
                    layoutControlItem.TextLocation = DevExpress.Utils.Locations.Top;
                }
                else
                {
                    layoutControlItem = groupItem.AddItem();
                    layoutControlItem.TextLocation = DevExpress.Utils.Locations.Left;
                }
                EditControls.Add(propDesc, editControl);
                editControl.Tag  = propDesc;
                editControl.Name = propDesc.Name;

                layoutControlItem.Control = editControl;
                layoutControlItem.Name    = propDesc.Name;
                layoutControlItem.Text    = propDesc.DisplayName;
                layoutControlItem.CustomizationFormText = propDesc.DisplayName;

                if (editControl is BaseObjectEditControl)
                {
                    layoutControlItem.TextVisible = false;
                }
                else
                {
                    layoutControlItem.TextVisible = true;
                }
            }
            this.DataLayoutControl.ResumeLayout();
            this.DataLayoutControl.SetDefaultLayout();

            // 读取布局数据
            if (controller != null && controller.LayoutData.IsNotNullOrEmpty())
            {
                this.DataLayoutControl.SetLayoutData(controller.LayoutData);
            }
            UIPublic.CloseWaitingForm();
        }