protected override object OnEditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, System.Windows.Forms.Design.IWindowsFormsEditorService service, object value)
        {
            IWithProject mc = context.Instance as IWithProject;

            if (mc != null)
            {
                if (mc.Project == null)
                {
                    MathNode.Log(TraceLogClass.GetForm(provider), new DesignerException("Project not set for {0} [{1}]", mc, mc.GetType()));
                }
                else
                {
                    GetterClass          val      = value as GetterClass;
                    System.Drawing.Point curPoint = System.Windows.Forms.Cursor.Position;
                    rc.X = curPoint.X;
                    rc.Y = curPoint.Y;
                    DlgMethod dlg = val.CreateMethodEditor(rc);
                    try
                    {
                        dlg.SetNameReadOnly();
                        dlg.LoadMethod(val, EnumParameterEditType.ReadOnly);
                        dlg.Text = val.ToString();
                        if (service.ShowDialog(dlg) == DialogResult.OK)
                        {
                            value = val;
                            ILimnorDesignerLoader l = LimnorProject.ActiveDesignerLoader as ILimnorDesignerLoader;
                            if (l != null)
                            {
                                //save the property and hence save the getter
                                DesignUtil.SaveCustomProperty(LimnorProject.ActiveDesignerLoader.Node, l.Writer, val.Property);
                                //save actions
                                List <IAction> actions = val.GetActions();
                                if (actions != null)
                                {
                                    foreach (IAction a in actions)
                                    {
                                        l.GetRootId().SaveAction(a, l.Writer);
                                    }
                                }
                                LimnorProject.ActiveDesignerLoader.NotifyChanges();
                            }
                        }
                    }
                    catch (Exception err)
                    {
                        MathNode.Log(TraceLogClass.GetForm(provider), err);
                    }
                    finally
                    {
                        val.ExitEditor();
                    }
                }
            }
            return(value);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     try
     {
         System.Windows.Forms.Design.IWindowsFormsEditorService      edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
         Widgetsphere.Generator.Forms.CustomViewColumnCollectionForm F     = new Widgetsphere.Generator.Forms.CustomViewColumnCollectionForm();
         if (edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK)
         {
             context.OnComponentChanged();
         }
     }
     catch (Exception ex) { }
     return(value);
 }
Ejemplo n.º 3
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     try
     {
         System.Windows.Forms.Design.IWindowsFormsEditorService edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
         Table table = (Table)context.Instance;
         Widgetsphere.Generator.Forms.UnitTestDependencyForm F = new Widgetsphere.Generator.Forms.UnitTestDependencyForm(table);
         if (edSvc.ShowDialog(F) == System.Windows.Forms.DialogResult.OK)
         {
             table.UnitTestDependencies.Clear();
             table.UnitTestDependencies.AddRange(F.GetSelectedList());
             table.Name = table.Name;                     //Make Dirty
             context.OnComponentChanged();
         }
     }
     catch (Exception ex) { }
     return(value);
 }
Ejemplo n.º 4
0
		public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) 
		{
			if (context!=null && context.Instance!=null && provider!=null) 
			{
				m_EditorService=(System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
				
				if(m_EditorService!=null) 
				{
					if(context.Instance is Bar)
					{
						Bar bar=context.Instance as Bar;
						if(bar.Owner is DotNetBarManager && ((DotNetBarManager)bar.Owner).UseGlobalColorScheme)
							System.Windows.Forms.MessageBox.Show("Please note that your DotNetBarManager has its UseGlobalColorScheme set to true and any changes you make to ColorScheme object on the bar will not be used.");
					}
					else if(context.Instance is DotNetBarManager && !((DotNetBarManager)context.Instance).UseGlobalColorScheme)
					{
						System.Windows.Forms.MessageBox.Show("Please note that you need to set UseGlobalColorScheme=true in order for all bars to use ColorScheme you change on this dialog.");
					}

					if(value==null)
						value=new ColorScheme();
					ColorSchemeEditor editor=new ColorSchemeEditor();
					editor.CreateControl();
					editor.ColorScheme=(ColorScheme)value;
					m_EditorService.ShowDialog(editor);
					if(editor.ColorSchemeChanged)
					{
						value=editor.ColorScheme;
						context.OnComponentChanged();
						((ColorScheme)value)._DesignTimeSchemeChanged=true;
						if(context.Instance is Bar)
						{
							((Bar)context.Instance).Refresh();
						}
					}
					editor.Close();
				}
			}
			
			return value;
		}
Ejemplo n.º 5
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (!(value is ValueColorCollection))
            {
                return(value);
            }

            ValuesColorEditorForm editorform = new ValuesColorEditorForm(value);

            System.Windows.Forms.Design.IWindowsFormsEditorService edSvc = (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));

            if (edSvc != null)
            {
                if (edSvc.ShowDialog(editorform) == DialogResult.OK)
                {
                    return(editorform.valuesColor);
                }
            }

            return(value);
        }
Ejemplo n.º 6
0
 //--------------------------------------------------------------------------------
 #region Feilds And Propeties
 //--------------------------------------------------------------------------------
 #endregion
 //--------------------------------------------------------------------------------
 #region Constructors
 //--------------------------------------------------------------------------------
 #endregion
 //--------------------------------------------------------------------------------
 #region Methods
 //--------------------------------------------------------------------------------
 public override object EditValue(ITypeDescriptorContext context,
                                  IServiceProvider provider,
                                  object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         // Получаем интерфейс сервиса
         System.Windows.Forms.Design.IWindowsFormsEditorService edSvc =
             (System.Windows.Forms.Design.IWindowsFormsEditorService)provider.GetService(
                 typeof(System.Windows.Forms.Design.IWindowsFormsEditorService));
         if (edSvc != null)
         {
             ICanPortUITypeEditorDialogForm form = new ICanPortUITypeEditorDialogForm();
             // Устанавливаем текущее значение для редактирования
             form.ICanPort = (ICanPort)value;
             // Вызываем окно редактора
             System.Windows.Forms.DialogResult result = edSvc.ShowDialog(form);
             // Получаем новое значение
             value = form.ICanPort;
         }
     }
     //return base.EditValue(context, provider, value);
     return(value);
 }