Exemplo n.º 1
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl colorDialog = new SVWpfControl();
                colorDialog.Width  = 170;
                colorDialog.Height = 160 + 200;

                SVWpfColorDialog dialog = new SVWpfColorDialog();
                colorDialog.addContent(dialog);

                var clr = (System.Drawing.Color)value;
                dialog.setDataContext(System.Windows.Media.Color.FromArgb(clr.A, clr.R, clr.G, clr.B));

                edSvc.DropDownControl(colorDialog);
                var rgb = dialog.SelectColor;
                value = System.Drawing.Color.FromArgb(rgb.A, rgb.R, rgb.G, rgb.B);

                return(value);
            }

            return(value);
        }
Exemplo n.º 2
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVVarDefine variable = value as SVVarDefine;
                if (variable == null)
                {
                    return(value);
                }

                SVWpfControl variableDialog = new SVWpfControl();
                variableDialog.Width  = 280;
                variableDialog.Height = 400;

                SVWPFVariableDialog dialog = new SVWPFVariableDialog();
                dialog.setFilter(new List <String> {
                    "BOOL", "BOOL_S"
                });
                dialog.name.DataContext = variable.VarName;
                dialog.type.DataContext = variable.VarBlockType;
                variableDialog.addContent(dialog);

                edSvc.DropDownControl(variableDialog);

                variable.VarName      = (String)dialog.name.DataContext;
                variable.VarBlockType = Convert.ToByte(dialog.type.DataContext);
            }

            return(value);
        }
Exemplo n.º 3
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            //从当前对象中获取按钮控件对象
            SVPageWidget page = context.Instance as SVPageWidget;

            if (page == null)
            {
                return(null);
            }

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl textDialog = new SVWpfControl();
                textDialog.Width  = 200;
                textDialog.Height = 300;

                WPFWidgetBackGround edit = new WPFWidgetBackGround();
                edit.DataContext = page.Attrib;

                textDialog.addContent(edit);
                edSvc.DropDownControl(textDialog);

                page.refreshPropertyToPanel();
            }

            return(value);
        }
Exemplo n.º 4
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl textDialog = new SVWpfControl();
                textDialog.Width  = 100;
                textDialog.Height = 40;

                SVWPFBinaryTypeDialog dialog = new SVWPFBinaryTypeDialog();
                textDialog.addContent(dialog);
                dialog.listView.DataContext = value;
                edSvc.DropDownControl(textDialog);

                if (dialog.listView.SelectedIndex != -1)
                {
                    value = (Byte)dialog.listView.SelectedIndex;
                }

                return(value);
            }

            return(value);
        }
Exemplo n.º 5
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl alignTextDialog = new SVWpfControl();
                alignTextDialog.Width  = 120;
                alignTextDialog.Height = 120;

                SVWPFAlignDialog dialog = new SVWPFAlignDialog();
                alignTextDialog.addContent(dialog);
                dialog.CloseEvent += () =>
                {
                    edSvc.CloseDropDown();
                    value = dialog.AlignValue;
                };

                edSvc.DropDownControl(alignTextDialog);

                return(value);
            }

            return(value);
        }
Exemplo n.º 6
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            //SVButton svButton = context.Instance as SVButton;
            //if (svButton == null)
            //    return value;

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl textDialog = new SVWpfControl();
                textDialog.Width  = 200;
                textDialog.Height = 120;

                SVWPFBtnTextEdit edit = new SVWPFBtnTextEdit();
                edit.textBox.DataContext = value;
                textDialog.addContent(edit);
                edSvc.DropDownControl(textDialog);
                value = edit.textBox.Text;
                //svButton.refreshPropertyToPanel();

                return(value);
            }

            return(value);
        }
Exemplo n.º 7
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            SVLabel svLabel = context.Instance as SVLabel;

            if (svLabel == null)
            {
                return(value);
            }

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl textDialog = new SVWpfControl();
                textDialog.Width  = 200;
                textDialog.Height = 120;

                SVWPFLabelTextEdit edit = new SVWPFLabelTextEdit();
                edit.textBox.DataContext = value;
                textDialog.addContent(edit);
                edSvc.DropDownControl(textDialog);
                value = edit.textBox.Text;

                return(value);
            }

            return(value);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 重载EditValue
        /// </summary>
        /// <param Name="context"></param>
        /// <param Name="provider"></param>
        /// <param Name="value"></param>
        /// <returns></returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            SVHeartbeat heart = context.Instance as SVHeartbeat;

            if (heart == null)
            {
                return(value);
            }

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl picDialog = new SVWpfControl();
                picDialog.Width  = 300;
                picDialog.Height = 300;

                SVWPFHeartPic heartPicture = new SVWPFHeartPic();
                heartPicture.resultListView.ItemsSource = heart.Attrib.BitMapArray.BitmapArray;
                picDialog.addContent(heartPicture);
                edSvc.DropDownControl(picDialog);
                heart.refreshPropertyToPanel();
                heart.RedoUndo.operChanged();

                return(value);
            }

            return(value);
        }
Exemplo n.º 9
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl fontDialog = new SVWpfControl();
                fontDialog.Width  = 160;
                fontDialog.Height = 120;

                SVWPFFontDialog dialog = new SVWPFFontDialog();
                dialog.listView.SelectedValue = value;
                fontDialog.addContent(dialog);

                edSvc.DropDownControl(fontDialog);
                if (dialog.listView.SelectedValue != null)
                {
                    value = dialog.listView.SelectedValue;
                }

                return(value);
            }

            return(value);
        }
Exemplo n.º 10
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            SVBitmap bitmap = value as SVBitmap;

            if (bitmap == null)
            {
                return(value);
            }

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl picDialog = new SVWpfControl();
                picDialog.Width  = 240;
                picDialog.Height = 260;

                SVWPfIconPic iconPicture = new SVWPfIconPic();
                iconPicture.image.DataContext = bitmap.ShowName;

                picDialog.addContent(iconPicture);
                edSvc.DropDownControl(picDialog);
                value = iconPicture.resultBitmap();

                return(value);
            }

            return(value);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 进入编辑按钮备注的对话框
        /// </summary>
        /// <param oldName="context"></param>
        /// <param oldName="provider"></param>
        /// <param oldName="value"></param>
        /// <returns></returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            ///确保操作的对象为按钮控件,其他对象不能使用该类进行包装
            SVButton svButton = context.Instance as SVButton;

            if (svButton == null)
            {
                return(value);
            }

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl textDialog = new SVWpfControl();
                textDialog.Width  = 200;
                textDialog.Height = 120;

                SVWPFBtnMemoEdit edit = new SVWPFBtnMemoEdit();
                edit.textBox.DataContext = svButton.Attrib;
                textDialog.addContent(edit);
                edSvc.DropDownControl(textDialog);

                return(value);
            }

            return(value);
        }
Exemplo n.º 12
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            SVButton svPanel = context.Instance as SVButton;

            if (svPanel == null)
            {
                return(value);
            }

            ///获取当前页面中的所以趋势图
            List <SVCurveProperties> attribList = new List <SVCurveProperties>();

            foreach (var sv in svPanel.Parent.Controls)
            {
                SVCurve curve = sv as SVCurve;
                if (curve != null)
                {
                    attribList.Add(curve.Attrib);
                }
            }

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl variableDialog = new SVWpfControl();
                variableDialog.Width  = 100;
                variableDialog.Height = 100;

                SVWPFCurveSelect curveDialog = new SVWPFCurveSelect();
                curveDialog.listView.ItemsSource = attribList;
                variableDialog.addContent(curveDialog);
                edSvc.DropDownControl(variableDialog);

                SVCurveProperties obj = curveDialog.listView.SelectedItem as SVCurveProperties;
                if (obj != null)
                {
                    switch (svPanel.Attrib.ButtonType)
                    {
                    case 6:
                        svPanel.Attrib.BtnVarText = obj.ForwardControl;
                        break;

                    case 7:
                        svPanel.Attrib.BtnVarText = obj.CurControl;
                        break;

                    case 8:
                        svPanel.Attrib.BtnVarText = obj.BackwardControl;
                        break;
                    }

                    return(obj.ID.ToString());
                }
            }

            return(value);
        }
Exemplo n.º 13
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                SVWpfControl picDialog = new SVWpfControl();
                picDialog.Width  = 40;
                picDialog.Height = 110;

                SVWPFLockDialog lockDialog = new SVWPFLockDialog();
                lockDialog.setChecked((Boolean)value);
                picDialog.addContent(lockDialog);
                edSvc.DropDownControl(picDialog);
                value = lockDialog.getChecked();

                return(value);
            }

            return(value);
        }