コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context,
			IServiceProvider provider, object value)
        {
            if(provider != null)
            {
                IWindowsFormsEditorService winEdit = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                ISite site = null;
                if(winEdit != null)
                {
                    if(context.Instance is IComponent)
                    {
                        site = ((IComponent)context.Instance).Site;
                    }
                    else if(context.Instance is object[] &&
                        ((object[])context.Instance)[0] is IComponent)
                    {
                        site = ((IComponent)(((object[])context.Instance)[0])).Site;
                    }
                    RecurrenceDialog dlg = new RecurrenceDialog();
                    //dlg.RegularExpression = value.ToString();
                    DialogResult res = dlg.ShowDialog();
                    //if(res == DialogResult.OK)
                    //	value = dlg.RegularExpression;

                }
            }
            return value;
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="provider"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public override object EditValue(ITypeDescriptorContext context,
                                  IServiceProvider provider, object value)
 {
     if (provider != null)
     {
         IWindowsFormsEditorService winEdit = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         ISite site = null;
         if (winEdit != null)
         {
             if (context.Instance is IComponent)
             {
                 site = ((IComponent)context.Instance).Site;
             }
             else if (context.Instance is object[] &&
                      ((object[])context.Instance)[0] is IComponent)
             {
                 site = ((IComponent)(((object[])context.Instance)[0])).Site;
             }
             RecurrenceDialog dlg = new RecurrenceDialog();
             //dlg.RegularExpression = value.ToString();
             DialogResult res = dlg.ShowDialog();
             //if(res == DialogResult.OK)
             //	value = dlg.RegularExpression;
         }
     }
     return(value);
 }