public void SetKeyValuesGrid() { FormDataGrid.Title = "Request Key Values"; FormDataGrid.SetTitleStyle((Style)TryFindResource("@ucGridTitleLightStyle")); //View with Browse and Combobox -->Form Data GridViewDef FormDataView = new GridViewDef("FormData"); FormDataView.GridColsView = new ObservableList <GridColView>(); FormDataView.GridColsView.Add(new GridColView() { Field = nameof(APIModelBodyKeyValue.Param), Header = "Key", WidthWeight = 100 }); List <GingerCoreNET.GeneralLib.General.ComboEnumItem> valueTypes = GingerCoreNET.GeneralLib.General.GetEnumValuesForCombo(typeof(APIModelBodyKeyValue.eValueType)); FormDataView.GridColsView.Add(new GridColView() { Field = APIModelBodyKeyValue.Fields.ValueType, Header = "Value Type", WidthWeight = 30, StyleType = GridColView.eGridColStyleType.ComboBox, CellValuesList = valueTypes }); FormDataView.GridColsView.Add(new GridColView() { Field = nameof(APIModelBodyKeyValue.Value), Header = "Value/File Path", WidthWeight = 100 }); //Define URLEncoded GridView GridViewDef UrlEncodedView = new GridViewDef("UrlEncoded"); UrlEncodedView.GridColsView = new ObservableList <GridColView>(); ObservableList <GridColView> UrlViewCols = new ObservableList <GridColView>(); UrlEncodedView.GridColsView.Add(new GridColView() { Field = APIModelBodyKeyValue.Fields.ValueType, Visible = false }); FormDataGrid.SetAllColumnsDefaultView(FormDataView); FormDataGrid.AddCustomView(UrlEncodedView); FormDataGrid.InitViewItems(); FormDataGrid.DataSourceList = mApplicationAPIModel.APIModelBodyKeyValueHeaders; FormDataGrid.ShowRefresh = Visibility.Collapsed; FormDataGrid.ShowUpDown = Visibility.Collapsed; FormDataGrid.ShowEdit = Visibility.Collapsed; FormDataGrid.ShowViewCombo = Visibility.Collapsed; FormDataGrid.btnAdd.RemoveHandler(Button.ClickEvent, new RoutedEventHandler(AddFormDataGridRow)); FormDataGrid.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddFormDataGridRow)); if ((mApplicationAPIModel.APIType == ApplicationAPIUtils.eWebApiType.REST) && mApplicationAPIModel.ContentType == ApplicationAPIUtils.eContentType.XwwwFormUrlEncoded) { //switch combobox & browse button off FormDataGrid.ChangeGridView("UrlEncoded"); } else if ((mApplicationAPIModel.APIType == ApplicationAPIUtils.eWebApiType.REST) && mApplicationAPIModel.ContentType == ApplicationAPIUtils.eContentType.FormData) { //switch combobox & browse button on FormDataGrid.ChangeGridView("FormData"); } }
public void SetKeyValuesGrid(ObservableList <WebAPIKeyBodyValues> RequestKeyValues) { FormDataGrid.Title = "Request Key Values"; FormDataGrid.SetTitleStyle((Style)TryFindResource("@ucGridTitleLightStyle")); //View with Browse and Combobox -->Form Data GridViewDef FormDataView = new GridViewDef("FormData"); FormDataView.GridColsView = new ObservableList <GridColView>(); FormDataView.GridColsView.Add(new GridColView() { Field = nameof(ActInputValue.Param), Header = "Key", WidthWeight = 100 }); List <ComboEnumItem> valueTypes = GingerCore.General.GetEnumValuesForCombo(typeof(WebAPIKeyBodyValues.eValueType)); FormDataView.GridColsView.Add(new GridColView() { Field = nameof(WebAPIKeyBodyValues.ValueType), Header = "Value Type", WidthWeight = 30, StyleType = GridColView.eGridColStyleType.ComboBox, CellValuesList = valueTypes }); FormDataView.GridColsView.Add(new GridColView() { Field = nameof(ActInputValue.Value), Header = "Value/File Path", WidthWeight = 100 }); FormDataView.GridColsView.Add(new GridColView() { Field = "...", WidthWeight = 20, StyleType = GridColView.eGridColStyleType.Template, CellTemplate = (DataTemplate)this.controlGrid.Resources["VEGridValueExpressionButton"] }); FormDataView.GridColsView.Add(new GridColView() { Field = "Browse", WidthWeight = 30, StyleType = GridColView.eGridColStyleType.Template, CellTemplate = (DataTemplate)this.controlGrid.Resources["BrowseValueFilesButton"] }); //Define URLEncoded GridView GridViewDef UrlEncodedView = new GridViewDef("UrlEncoded"); UrlEncodedView.GridColsView = new ObservableList <GridColView>(); ObservableList <GridColView> UrlViewCols = new ObservableList <GridColView>(); UrlEncodedView.GridColsView.Add(new GridColView() { Field = nameof(WebAPIKeyBodyValues.ValueType), Visible = false }); UrlEncodedView.GridColsView.Add(new GridColView() { Field = "Browse", Visible = false }); FormDataGrid.SetAllColumnsDefaultView(FormDataView); FormDataGrid.AddCustomView(UrlEncodedView); FormDataGrid.InitViewItems(); FormDataGrid.DataSourceList = RequestKeyValues; FormDataGrid.ShowRefresh = Visibility.Collapsed; FormDataGrid.ShowUpDown = Visibility.Collapsed; FormDataGrid.ShowEdit = Visibility.Collapsed; FormDataGrid.ShowViewCombo = Visibility.Collapsed; FormDataGrid.btnAdd.AddHandler(Button.ClickEvent, new RoutedEventHandler(AddRow)); if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.XwwwFormUrlEncoded.ToString()) { //switch combobox & browse button off FormDataGrid.ChangeGridView("UrlEncoded"); } else if (mAct.GetInputParamValue(ActWebAPIRest.Fields.ContentType) == ApplicationAPIUtils.eContentType.FormData.ToString()) { //switch combobox & browse button on FormDataGrid.ChangeGridView("FormData"); } }