コード例 #1
0
        protected override void Execute(NativeActivityContext context)
        {
            //get data from context
            bool   getAllProperties  = GetAllProperties;
            string formXAMLPath      = FormXAMLPath.Get(context);
            string styleSheetPath    = StyleSheetPath.Get(context);
            string submitElementName = SubmitElementName.Get(context);
            string submitEventName   = SubmitEventName.Get(context);
            Dictionary <string, Dictionary <string, object> > input = InputDictionary.Get(context);

            string[] elementsToRetrieve = ElementsToRetrieve.Get(context);


            //launch form and get result data
            Dictionary <string, Dictionary <string, object> > results = FormsCreator.LaunchForm(
                formXAMLPath,
                styleSheetPath,
                submitElementName,
                submitEventName,
                input,
                AlwaysTop,
                GetAllProperties,
                elementsToRetrieve
                );

            //set output value
            OutputDictionary.Set(context, results);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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;
             */
        }