Beispiel #1
0
        /// <summary>
        /// This takes care of the actual value-change of the property.
        /// </summary>
        /// <param name="itdc">Standard ITypeDescriptorContext object.</param>
        /// <param name="isp">Standard IServiceProvider object.</param>
        /// <param name="value">The value as an object.</param>
        /// <returns>The new value as an object.</returns>
        public override object EditValue(ITypeDescriptorContext itdc, IServiceProvider isp, object value)
        {
            if(itdc != null && itdc.Instance != null && isp != null)
            {
                iwfes = (IWindowsFormsEditorService)isp.GetService(typeof(IWindowsFormsEditorService));

                if(iwfes != null)
                {
                    MWCommon.TextDir td = MWCommon.TextDir.Normal;

                    if(value is MWCommon.TextDir)
                    {
                        td = (MWCommon.TextDir)itdc.PropertyDescriptor.GetValue(itdc.Instance);
                        pd = itdc.PropertyDescriptor;
                        oInstance = itdc.Instance;
                    }

                    EditorTextDirUI etdui = new EditorTextDirUI();
                    etdui.IWFES = iwfes;
                    etdui.ITDC = itdc;
                    etdui.TextDir = (MWCommon.TextDir)value;
                    etdui.TextDirChanged += new EditorTextDirUI.TextDirEventHandler(this.ValueChanged);

                    iwfes.DropDownControl(etdui);
                    value = etdui.TextDir;
                }
            }

            return value;
        }
Beispiel #2
0
        /// <summary>
        /// This takes care of the actual value-change of the property.
        /// </summary>
        /// <param name="itdc">Standard ITypeDescriptorContext object.</param>
        /// <param name="isp">Standard IServiceProvider object.</param>
        /// <param name="value">The value as an object.</param>
        /// <returns>The new value as an object.</returns>
        public override object EditValue(ITypeDescriptorContext itdc, IServiceProvider isp, object value)
        {
            if (itdc != null && itdc.Instance != null && isp != null)
            {
                iwfes = (IWindowsFormsEditorService)isp.GetService(typeof(IWindowsFormsEditorService));

                if (iwfes != null)
                {
                    MWCommon.TextDir td = MWCommon.TextDir.Normal;

                    if (value is MWCommon.TextDir)
                    {
                        td        = (MWCommon.TextDir)itdc.PropertyDescriptor.GetValue(itdc.Instance);
                        pd        = itdc.PropertyDescriptor;
                        oInstance = itdc.Instance;
                    }

                    EditorTextDirUI etdui = new EditorTextDirUI();
                    etdui.IWFES           = iwfes;
                    etdui.ITDC            = itdc;
                    etdui.TextDir         = (MWCommon.TextDir)value;
                    etdui.TextDirChanged += new EditorTextDirUI.TextDirEventHandler(this.ValueChanged);

                    iwfes.DropDownControl(etdui);
                    value = etdui.TextDir;
                }
            }

            return(value);
        }