Example #1
0
        void ShowItemSuperTip(BarItemLink item)
        {
            var args = new ToolTipControllerShowEventArgs {
                ToolTipType = ToolTipType.SuperTip,
                SuperTip    = new SuperToolTip()
            };

            foreach (var choiceActionItem in _newObjectAction.Items)
            {
                var formatTestAction = EasyTestTagHelper.FormatTestAction(_newObjectAction.Caption + '.' + choiceActionItem.GetItemPath());
                if (formatTestAction == item.Item.Tag as string)
                {
                    var data = choiceActionItem.Data;
                    if (data != null)
                    {
                        var newObjectActionTooltip =
                            ((IModelClassNewObjectActionTooltip)
                             _newObjectAction.Application.Model.BOModel.GetClass((Type)data)).NewObjectActionTooltip;
                        if (!string.IsNullOrEmpty(newObjectActionTooltip))
                        {
                            args.SuperTip.Items.Add(newObjectActionTooltip);
                            ToolTipController.DefaultController.ShowHint(args);
                        }
                    }
                }
            }
        }
 void IFrameTemplate.SetView(DevExpress.ExpressApp.View view)
 {
     viewSiteManager.SetView(view);
     if (view != null)
     {
         Tag = EasyTestTagHelper.FormatTestContainer(view.Caption);
     }
     RaiseViewChanged(view);
 }
        /// <inheritdoc/>
        protected override Control CreateControl()
        {
            ButtonEdit tempControl = null;
            ButtonEdit control = null;
            try
            {
                var type = GetType().BaseType;
#pragma warning disable CC0009 // Use object initializer
                tempControl = new ComboBoxEdit();
#pragma warning restore CC0009 // Use object initializer
                tempControl.AutoSizeInLayoutControl = false;
                tempControl.MinimumSize = new Size(150, 20);
                tempControl.Properties.NullValuePrompt = Action.NullValuePrompt;
                tempControl.Properties.NullValuePromptShowForEmptyValue = true;
                if (ShowExecuteButton)
                {
                    goButton = new EditorButton
                    {
                        Kind = ButtonPredefines.Glyph,
                        Tag = ParametrizedActionItemControlFactory.GoButtonID,
                        ImageLocation = ImageLocation.TopLeft
                    };
                    var imageInfo = default(ImageInfo);
                    if (!string.IsNullOrEmpty(Action.ImageName))
                    {
                        imageInfo = ImageLoader.Instance.GetImageInfo(Action.ImageName);
                    }
                    if (!imageInfo.IsEmpty && Action.PaintStyle != ActionItemPaintStyle.Caption)
                    {
                        goButton.Image = imageInfo.Image;
                        goButton.ImageLocation = ImageLocation.MiddleCenter;
                        goButton.Caption = string.Empty;
                    }
                    else
                    {
                        goButton.Image = null;
                        goButton.Caption = Action.ShortCaption;
                    }
                    tempControl.Properties.Buttons.Add(goButton);
                    var goButtonField = type.GetField(nameof(goButton), BindingFlags.Instance | BindingFlags.NonPublic);
                    goButtonField.SetValue(this, goButton);
                }

                var eventInfo = tempControl.GetType().GetEvent("PreviewKeyDown");
                var methodInfo = type.GetMethod("result_PreviewKeyDown", BindingFlags.NonPublic | BindingFlags.Instance);
                var handler = Delegate.CreateDelegate(eventInfo.EventHandlerType, this, methodInfo);
                eventInfo.AddEventHandler(tempControl, handler);

                tempControl.ButtonClick += ControlButtonClick;

                tempControl.KeyDown += ControlKeyDown;
                tempControl.Leave += ControlKeyLeave;

                tempControl.Tag = EasyTestTagHelper.FormatTestAction(Action.Caption);
                tempControl.Name = "Control_" + Guid.NewGuid();
                tempControl.EditValue = Action.Value;
                var controlCreatedField = type.GetField("controlCreated", BindingFlags.Instance | BindingFlags.NonPublic);
                controlCreatedField.SetValue(this, true);
                control = tempControl;
                tempControl = null;
            }
            finally
            {
                if (tempControl != null)
                {
                    tempControl.Dispose();
                }
            }
            return control;
        }