示例#1
0
        private static void ExportAll(string destinationFolder)
        {
            if (!Directory.Exists(destinationFolder))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error: Invlaid path argument: folder not found");
                return;
            }

            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("Getting list of processes from account: ");

            Processes process = new Processes(_appConfig);

            ProcessesListViewModel vm = process.GetListOfProcessessRESTCall();

            if (vm == null)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("Failed to get list of processes");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Success");

                foreach (var item in vm.value)
                {
                    ExportOne(item.id, destinationFolder, item.name);
                }
            }

            vm      = null;
            process = null;
        }
示例#2
0
        public ProcessesListViewModel GetListOfProcessessRESTCall()
        {
            ProcessesListViewModel vm = null;

            using (var client = new HttpClient())
            {
                // New code:
                client.BaseAddress = new Uri(_apiurl);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _login);

                HttpResponseMessage response = client.GetAsync("_apis/process/processes?api-version=1.0").Result;

                if (response.IsSuccessStatusCode)
                {
                    vm = response.Content.ReadAsAsync <ProcessesListViewModel>().Result;
                }

                response.Dispose();

                return(vm);
            }
        }
示例#3
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new ProcessesListViewModel();
 }
示例#4
0
 internal ProcessesListView()
 {
     InitializeComponent();
     DataContext = new ProcessesListViewModel();
 }
示例#5
0
 public ProcessesListView(Action showProcessDetailsWindow, Action <bool> showLoader)
 {
     InitializeComponent();
     DataContext = new ProcessesListViewModel(showProcessDetailsWindow, showLoader);
 }