public ExecutionContext(string _contentPath, string _stylePath, string _submitElementName, string _submitEventName, string[] _elementsToRetrieve, Dictionary <string, Dictionary <string, object> > _input, bool _getAllProperties) { if ((_elementsToRetrieve == null || _elementsToRetrieve.Length == 0) && (_input == null || _input.Count == 0)) { throw new Exception(WpfFormCreatorResources.ErrorMessage_EmptyInput); } contentPath = _contentPath; stylePath = _stylePath; submitElementName = _submitElementName; submitEventName = _submitEventName; getAllProperties = _getAllProperties; input = _input; elementsToRetrieve = _elementsToRetrieve; MainElement = FormsCreator.GetGridFromFile(contentPath); if (!String.IsNullOrEmpty(_stylePath)) { MainDictionary = FormsCreator.GetResourceDictionaryFromFile(stylePath); } }
public ExecutionContext(string contentPath, string stylePath, string submitElementName, string submitEventName, string[] elementsToRetrieve, Dictionary <string, Dictionary <string, object> > input, bool getAllProperties, bool topMost = false) { if ((elementsToRetrieve == null || elementsToRetrieve.Length == 0) && (input == null || input.Count == 0)) { throw new Exception(WpfFormCreatorResources.ErrorMessage_EmptyInput); } ContentPath = contentPath; StylePath = stylePath; SubmitElementName = submitElementName; SubmitEventName = submitEventName; GetAllProperties = getAllProperties; Input = input; ElementsToRetrieve = elementsToRetrieve; TopMost = topMost; MainElement = FormsCreator.GetGridFromFile(ContentPath); if (!String.IsNullOrEmpty(stylePath)) { MainDictionary = FormsCreator.GetResourceDictionaryFromFile(StylePath); } }
static void LogicTest() { Grid mainGrid = FormsCreator.GetGridFromFile("HelperFiles\\ParentForm.xaml"); ResourceDictionary mainDictionary = FormsCreator.GetResourceDictionaryFromFile("HelperFiles\\DemoDictionary.xaml"); //initialize input for the dictionary Dictionary <string, Dictionary <string, object> > input = new Dictionary <string, Dictionary <string, object> > { //{ "ComboBox2", new Dictionary<string, object>{ { "IsSelected", true } } }, { "cmbBudgetYear", new Dictionary <string, object> { { "SelectedValuePath", "Content" }, { "SelectedValue", "2011" } } }, { "test123", new Dictionary <string, object> { { "SelectedValue", "ComboBox Item #2" }, { "SelectedValuePath", "Text" } } }, { "nameInput", new Dictionary <string, object> { { "Text", "blabla" } } }, { "McCheckBox", new Dictionary <string, object> { { "IsChecked", true } } }, { "testCheckBox", new Dictionary <string, object> { { "IsChecked", true } } }, { "tatae", new Dictionary <string, object> { { "IsChecked", true } } }, { "namerino123", new Dictionary <string, object> { { "Text", "Papa Don't Preach \n lalalaalalla" } } } //, }; Dictionary <string, Dictionary <string, object> > input1 = new Dictionary <string, Dictionary <string, object> > { //{ "ComboBox2", new Dictionary<string, object>{ { "IsSelected", true } } }, { "tb1", new Dictionary <string, object> { { "Text", "blabla" } } }, { "tb2", new Dictionary <string, object> { { "Text", "blabla2" } } }, { "tb3", new Dictionary <string, object> { { "Text", "blabla3" } } } }; Dictionary <string, Dictionary <string, object> > input2 = new Dictionary <string, Dictionary <string, object> > { //{ "ComboBox2", new Dictionary<string, object>{ { "IsSelected", true } } }, { "employee", new Dictionary <string, object> { { "Source", new BitmapImage(new Uri("C:\\UiPath\\CustomActivities\\Community.Activities\\WpfFormCreator\\UiPath.Team.WPFFormCreator.TestProject\\TestFiles\\albertcamus.jpg", UriKind.Absolute)) } } }, { "hireDate", new Dictionary <string, object> { { "Value", DateTime.Now } } }, { "firstName", new Dictionary <string, object> { { "Text", "Albert" } } } }; Dictionary <string, Dictionary <string, object> > Results; Results = FormsCreator.LaunchForm( //"TestFiles\\ParentForm_6.xaml", "C:\\Users\\raduBucur\\Documents\\UiPath\\testWPFFormCreator\\Example2\\TestFiles\\ParentForm_6.xml", "HelperFiles\\DemoDictionary.xaml", "submitButton", "Click", input2, false); /*Results = * FormsCreator.LaunchForm( * "TestFiles\\ParentForm.xaml", * "HelperFiles\\DemoDictionary.xaml", * "tatae", "Click", * input, * * true);*/ /*Results = * FormsCreator.LaunchForm( * "HelperFiles\\ParentForm_2.xaml", * "HelperFiles\\DemoDictionary.xaml", * "buttonClickClick", "Click", * input1, * false);*/ Console.WriteLine(Results.Count + String.Join(Environment.NewLine, Results.Select(x => x.Key + ":" + Environment.NewLine + String.Join(";" + Environment.NewLine, x.Value.Select( y => y.Key + "->" + (y.Value == null?"":y.Value.ToString()))) + Environment.NewLine))); Console.ReadLine(); /* * //initialize execution * //CustomFormWindow customWindow = new CustomFormWindow(mainGrid, mainDictionary,"Button", "testButton", "Click"); * CustomFormWindow customWindow = new CustomFormWindow(mainGrid, mainDictionary, "tatae", "Click", input); * customWindow.ShowDialog(); * * Dictionary<string, Dictionary<string, object>> Results = customWindow.Results; */ }