public void Init(Context context, object obj, string AttrName, bool isVENeeded = true, bool isBrowseNeeded = false, eBrowserType browserType = eBrowserType.File, string fileType = "*", RoutedEventHandler extraBrowserSelectionHandler = null) { this.obj = obj; this.AttrName = AttrName; mContext = context; GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ValueTextBox, TextBox.TextProperty, obj, AttrName); if (isBrowseNeeded) { mBrowserType = browserType; LastCol.Width = new GridLength(55); BrowseButton.Visibility = Visibility.Visible; this.fileType = fileType; BrowseButton.AddHandler(Button.ClickEvent, new RoutedEventHandler(BrowseButton_Click)); if (extraBrowserSelectionHandler != null) { BrowseButton.Click += extraBrowserSelectionHandler; } } if (!isVENeeded) { MidCol.Width = new GridLength(0); OpenExpressionEditorButton.Visibility = Visibility.Collapsed; } }
/// <summary> /// Initiate and Bind the UCValue Expression Control, manage the Browse and VE buttons and configure the Extra functionality Handler. /// </summary> /// <param name="AIV">ActInputValue related to the Param configured under the Fields of the Action</param> /// <param name="isVENeeded">Determine whether the VE Button will be appeared or not</param> /// <param name="isBrowseNeeded">Determine whether the Browse Button will be appeared or not</param> /// <param name="browserType">Can be eBrowserType.File or eBrowserType.Folder</param> /// <param name="fileType">Type of the files for filter the Browser Dialog</param> /// <param name="extraBrowserSelectionHandler">To be used whenever extra functionality is needed after clicking OK or cancel at the Dialog window</param> public void Init(Context context, ActInputValue AIV, bool isVENeeded = true, bool isBrowseNeeded = false, eBrowserType browserType = eBrowserType.File, string fileType = "*", RoutedEventHandler extraBrowserSelectionHandler = null, string initialDirectory = null) { // If the VE is on stand alone form: this.obj = AIV; this.AttrName = nameof(ActInputValue.Value); mContext = context; GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ValueTextBox, TextBox.TextProperty, obj, AttrName); if (isBrowseNeeded) { mBrowserType = browserType; LastCol.Width = new GridLength(55); BrowseButton.Visibility = Visibility.Visible; this.fileType = fileType; this.initialDirectory = initialDirectory; BrowseButton.AddHandler(Button.ClickEvent, new RoutedEventHandler(BrowseButton_Click)); if (extraBrowserSelectionHandler != null) { BrowseButton.Click += extraBrowserSelectionHandler; } } if (!isVENeeded) { MidCol.Width = new GridLength(0); OpenExpressionEditorButton.Visibility = Visibility.Collapsed; } }