Пример #1
0
        protected override void OnHelpRequested(HelpEventArgs hevent)
        {
            base.OnHelpRequested(hevent);
            Point   helpAt    = this.PointToClient(hevent.MousePos);
            Control acControl = this.GetChildAtPoint(helpAt);

            if (acControl != null && acControl is ArgumentPanel)
            {
                ArgumentPanel panel = acControl as ArgumentPanel;
                panel.Focus();
                if (panel.FieldConfig != null && panel.FieldConfig.Tooltip != null && !panel.FieldConfig.Tooltip.Equals(String.Empty))
                {
                    ToolTip toolTip = panel.ToolTip;
                    toolTip.Show(panel.FieldConfig.Tooltip, this, helpAt, toolTip.AutoPopDelay);
                }
            }
        }
Пример #2
0
 private void SetFirstArgumentPanelFocus()
 {
     this.Wizard.Focus();
     this.Focus();
     if (this.Configuration != null && this.Configuration.Fields.Length >= 1)
     {
         IValueInfoService metaDataService =
             (IValueInfoService)GetService(typeof(IValueInfoService));
         ValueInfo argument = metaDataService.GetInfo(this.Configuration.Fields[0].ValueName);
         if (argument != null)
         {
             ArgumentPanel firstArgumentPanel =
                 (ArgumentPanel)Arguments[argument];
             firstArgumentPanel.Focus();
         }
     }
 }
Пример #3
0
 private void RecipeArgumentChanged(object sender, ComponentChangedEventArgs e)
 {
     try
     {
         if (e.Component == null)
         {
             throw new ArgumentNullException("Component");
         }
         // Forward call to appropriate providers.
         ArgumentPanel argumentPanel = (ArgumentPanel)Arguments[((ValueInfo)e.Component)];
         if (argumentPanel != null)
         {
             argumentPanel.UpdateValueInternal(e.NewValue);
         }
     }
     catch (Exception ex)
     {
         ErrorHelper.Show((IUIService)GetService(typeof(IUIService)), ex);
     }
 }
Пример #4
0
 public override void EndInit()
 {
     if (IsInitializing)
     {
         base.EndInit();
         if (!IsInitializing)
         {
             bool usingHelp    = !string.IsNullOrEmpty(this.Configuration.Help);
             int  heightNeeded = 0;
             IsInitializing = true;
             IServiceProvider serviceProvider = (IServiceProvider)GetService(typeof(IServiceProvider));
             this.SuspendLayout();
             ArgumentPanel[] argumentPanels = new ArgumentPanel[this.Configuration.Fields.Length];
             for (int i = 0; i < this.Configuration.Fields.Length; i++)
             {
                 argumentPanels[i] = CreateEditingPanel(this.Configuration.Fields[i]);
                 ((System.ComponentModel.ISupportInitialize)(argumentPanels[i])).BeginInit();
                 argumentPanels[i].SuspendLayout();
                 this.Controls.Add(argumentPanels[i]);
                 this.Controls.SetChildIndex(argumentPanels[i], 0);
                 ((System.ComponentModel.ISupportInitialize)(argumentPanels[i])).EndInit();
                 argumentPanels[i].ResumeLayout();
                 heightNeeded += argumentPanels[i].Height;
                 usingHelp    |= !string.IsNullOrEmpty(this.Configuration.Fields[i].Help);
             }
             for (int i = this.Configuration.Fields.Length; --i >= 0;)
             {
                 argumentPanels[i].TabIndex = i;
             }
             heightNeeded += InfoRTBoxSize.Height;
             if (usingHelp && this.Height < heightNeeded)
             {
                 this.MinimumSize = new Size(this.Width, heightNeeded);
                 this.Height      = heightNeeded;
             }
             this.ResumeLayout();
             IsInitializing = false;
         }
     }
 }
Пример #5
0
        private ArgumentPanel CreateEditingPanel(Configuration.Field field)
        {
            IValueInfoService metaDataService =
                (IValueInfoService)GetService(typeof(IValueInfoService));
            ValueInfo argument = metaDataService.GetInfo(field.ValueName);

            if (argument == null)
            {
                throw new ArgumentNullException("Field");
            }
            ArgumentPanel          argumentPanel = null;
            ITypeResolutionService loaderService =
                (ITypeResolutionService)GetService(typeof(ITypeResolutionService));
            Type argType = argument.Type;

            if (argType == null)
            {
                throw new TypeLoadException(
                          String.Format(
                              CultureInfo.CurrentCulture, Properties.Resources.WizardGatheringService_CannotLoadTypeStepField,
                              argument.Name,
                              this.Configuration.Title));
            }
            if (argType == typeof(bool) ||               // The type is a simple boolean value, so let's use ArgumentPanelBool
                argType == typeof(Nullable <bool>))
            {
                argumentPanel = new ArgumentPanelBool();
            }
            else
            {
                if (!string.IsNullOrEmpty(field.PanelType))
                {
                    Type paneltype = loaderService.GetType(field.PanelType);
                    argumentPanel = (ArgumentPanelTypeEditor)Activator.CreateInstance(paneltype);
                }
                else
                {
                    argumentPanel = new ArgumentPanelTypeEditor();
                }
                //First try to use any UITypeEditor defined for our type
                Type editorType = field.Editor == null ? null : loaderService.GetType(field.Editor.Type);
                if (editorType != null)
                {
                    UITypeEditor editorInstance = (UITypeEditor)Activator.CreateInstance(editorType);
                    if (editorInstance is IAttributesConfigurable)
                    {
                        ImmutableKeyStringDictionary values = new ImmutableKeyStringDictionary();
                        if (field.Editor.AnyAttr != null)
                        {
                            foreach (XmlAttribute xattr in field.Editor.AnyAttr)
                            {
                                values.Add(xattr.Name, xattr.Value);
                            }
                        }
                        ((IAttributesConfigurable)editorInstance).Configure(values);
                    }
                    ((ArgumentPanelTypeEditor)argumentPanel).EditorInstance = editorInstance;
                }
                ((ArgumentPanelTypeEditor)argumentPanel).ConverterInstance = argument.Converter;
            }
            argumentPanel.FieldConfig = field;
            this.Arguments[argument]  = argumentPanel;
            return(argumentPanel);
        }