public Form1() { InitializeComponent(); string tenantLogicalName = ConfigurationManager.AppSettings["TenantLogicalName"]; string clientId = ConfigurationManager.AppSettings["ClientId"]; string refreshToken = ConfigurationManager.AppSettings["UserKey"]; _uiPathOrchestrator = new UiPathCloudAPI(tenantLogicalName, clientId, refreshToken, BehaviorMode.AutoInitiation); _uiPathOrchestrator.JobManager.WaitReadyJobCompleted += JobManager_WaitReadyJobCompleted; var bindingSourceRobots = new BindingSource(); bindingSourceRobots.DataSource = _uiPathOrchestrator.RobotManager.GetCollection().ToList(); cbRobot.DataSource = bindingSourceRobots.DataSource; cbRobot.DisplayMember = "Name"; cbRobot.ValueMember = "Name"; var bindingSourceProcesses = new BindingSource(); bindingSourceProcesses.DataSource = _uiPathOrchestrator.ProcessManager.GetCollection(); cbProcess.DataSource = bindingSourceProcesses.DataSource; cbProcess.DisplayMember = "Name"; cbProcess.ValueMember = "Name"; }
static void MenuLoop(UiPathCloudAPI uiPath) { while (true) { Console.Clear(); //Console.WriteLine("Welcome, {0}!", uiPath.TargetAccount.Name); Console.WriteLine("Select number:"); Console.WriteLine("0. Exit."); Console.WriteLine("1. Robots."); Console.WriteLine("2. Processes."); Console.WriteLine("3. Jobs."); Console.WriteLine("4. Assets."); Console.Write("Enter number: "); int number = -1; try { number = Convert.ToInt32(Console.ReadLine()); } catch (Exception) { } switch (number) { case -1: case 0: return; case 1: RobotsMenuLoop(uiPath); break; case 2: ProccessesMenuLoop(uiPath); break; case 3: JobsMenuLoop(uiPath); break; case 4: AssetsMenuLoop(uiPath); break; default: Console.WriteLine("Incorrected number. Repeat?"); string answer = Console.ReadLine().ToLower(); if (answer == "n" || answer == "no") { return; } break; } } }
public void Init() { uiPath = Config.CommonUiPathApi; TestFolderOrigin = uiPath.DefaultFolder; TestFolder = uiPath.FolderManager.GetInstance("Default"); TestFolderFail = new Folder { DisplayName = "Lol lel kek", Id = int.MaxValue }; }
static void Main(string[] args) { Console.WriteLine("Authentication..."); string tenantLogicalName = ConfigurationManager.AppSettings["TenantLogicalName"]; string clientId = ConfigurationManager.AppSettings["ClientId"]; string refreshToken = ConfigurationManager.AppSettings["UserKey"]; UiPathCloudAPI uiPath = new UiPathCloudAPI(tenantLogicalName, clientId, refreshToken, BehaviorMode.AutoInitiation); Folder folder = new Folder(); uiPath.SessionManager.GetCollection(); MenuLoop(uiPath); }
static void RobotsMenuLoop(UiPathCloudAPI uiPath) { while (true) { Console.Clear(); Console.WriteLine("Robots menu."); Console.WriteLine("Select number:"); Console.WriteLine("0. Exit."); Console.WriteLine("1. Print list."); Console.Write("Enter number: "); int number = -1; try { number = Convert.ToInt32(Console.ReadLine()); } catch (Exception) { } switch (number) { case -1: case 0: return; case 1: PrintRobots(uiPath.RobotManager.GetCollection()); Console.ReadKey(); break; default: Console.WriteLine("Incorrected number. Repeat?"); string answer = Console.ReadLine().ToLower(); if (answer == "n" || answer == "no") { return; } break; } } }
public void InitTest() { UiPathCloudAPI uiPath1 = new UiPathCloudAPI(); uiPath1.Initialization(_configuration["TenantLogicalName"], _configuration["ClientId"], _configuration["UserKey"]); Assert.IsFalse(uiPath1.IsAuthorized); uiPath1.Authorization(); Assert.IsTrue(uiPath1.IsAuthorized); UiPathCloudAPI uiPath2 = new UiPathCloudAPI(_configuration["TenantLogicalName"], _configuration["ClientId"], _configuration["UserKey"]); Assert.IsFalse(uiPath2.IsAuthorized); uiPath2.Authorization(); Assert.IsTrue(uiPath2.IsAuthorized); UiPathCloudAPI uiPath3 = new UiPathCloudAPI(_configuration["TenantLogicalName"], _configuration["ClientId"], _configuration["UserKey"], BehaviorMode.AutoInitiation); if (uiPath3.TryConfigureDefaultFolder("Default")) { var robots = uiPath3.RobotManager.GetCollection(); Assert.IsNotNull(robots); } }
public void Init() { uiPath = Config.CommonUiPathApi; }
static void AssetsMenuLoop(UiPathCloudAPI uiPath) { while (true) { Console.Clear(); Console.WriteLine("Assets menu."); Console.WriteLine("Select number:"); Console.WriteLine("0. Exit."); Console.WriteLine("1. Get assets."); Console.WriteLine("2. Get asset by Robot name."); Console.WriteLine("3. Create asset."); Console.Write("Enter number: "); int number = -1; try { number = Convert.ToInt32(Console.ReadLine()); } catch (Exception) { } switch (number) { case -1: case 0: return; case 1: try { PrintConcreteAssets(uiPath.AssetManager.GetConcreteCollection()); } catch (WebException) { Console.WriteLine(uiPath.LastErrorMessage); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); break; case 2: try { Console.Write("Enter robot name: "); string robotName = Console.ReadLine(); uiPath.RobotManager.UseSession = true; var robot = uiPath.RobotManager.GetCollection(new Filter("Robot/Name", robotName)).FirstOrDefault(); Console.Write("Enter asset name: "); string assetName = Console.ReadLine(); Asset asset = uiPath.AssetManager.GetInstanceByRobot(assetName, robot); var sinpledAsset = GetSimpledAsset(asset); Console.WriteLine("{0} = {1}", sinpledAsset.Key, sinpledAsset.Value); } catch (WebException) { Console.WriteLine(uiPath.LastErrorMessage); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); break; case 3: try { } catch (WebException) { Console.WriteLine(uiPath.LastErrorMessage); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); break; default: Console.WriteLine("Incorrected number. Repeat?"); string answer = Console.ReadLine().ToLower(); if (answer == "n" || answer == "no") { return; } break; } } }
static void JobsMenuLoop(UiPathCloudAPI uiPath) { while (true) { Console.Clear(); Console.WriteLine("Jobs menu."); Console.WriteLine("Select number:"); Console.WriteLine("0. Exit."); Console.WriteLine("1. Print list."); Console.WriteLine("2. Start new job."); Console.Write("Enter number: "); int number = -1; try { number = Convert.ToInt32(Console.ReadLine()); } catch (Exception) { } switch (number) { case -1: case 0: return; case 1: PrintJobs(uiPath.JobManager.GetCollection()); Console.ReadKey(); break; case 2: try { Console.Write("Enter robot name: "); string robotName = Console.ReadLine(); Console.Write("Enter proccess name: "); string proccessName = Console.ReadLine(); var newJob = uiPath.JobManager.StartJob(robotName, proccessName); PrintJobs(new List <JobWithArguments> { (JobWithArguments)newJob }, "New Job:"); } catch (WebException) { Console.WriteLine(uiPath.LastErrorMessage); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); break; default: Console.WriteLine("Incorrected number. Repeat?"); string answer = Console.ReadLine().ToLower(); if (answer == "n" || answer == "no") { return; } break; } } }
public void Init() { uiPath = Config.CommonUiPathApi; _isReady = false; }