private async Task PerformTestConnectionAsync()
        {
            try
            {
                if (!txtBoxServer.Text.EndsWith("/"))
                {
                    txtBoxServer.Text += "/";
                }
                HttpUtils.InitClient(txtBoxServer.Text, txtBoxUser.Text, txtBoxPassword.Text);
                XrayStatus xrayStatus = await HttpUtils.GetPingAsync();

                if (xrayStatus == null)
                {
                    testConnectionField.Text = "Failed to perform ping.";
                    return;
                }
                XrayVersion xrayVersion = await HttpUtils.GetVersionAsync();

                if (!isCompatibleVersion(xrayVersion))
                {
                    testConnectionField.Text = XrayUtil.GetMinimumXrayVersionErrorMessage(xrayVersion.xray_version);
                    return;
                }

                // Check components permissions.
                String message = await HttpUtils.PostComponentToXrayAsync(new Components("", Util.PREFIX + "testComponent"));

                if (String.IsNullOrEmpty(message))
                {
                    testConnectionField.Text = "Received Xray version: " + xrayVersion.xray_version;
                }
                else
                {
                    testConnectionField.Text = message;
                }
            }
            catch (IOException ioe)
            {
                testConnectionField.Text = ioe.Message;
                await OutputLog.ShowMessageAsync("Caught exception when performing test connection: " + ioe);
            }
        }
        public async Task LoadAsync(RefreshType refreshType, HashSet <Severity> severities)
        {
            this.EnableRefreshButton = false;
            DataService dataService = DataService.Instance;

            RaisePropertyChanged("SelectedKey");
            try
            {
                String solutionDir = await GetSolutionDirAsync();

                if (String.IsNullOrWhiteSpace(solutionDir))
                {
                    return;
                }

                XrayVersion xrayVersion = await HttpUtils.GetVersionAsync();

                if (!XrayUtil.IsXrayVersionCompatible(xrayVersion.xray_version))
                {
                    String errorMessage = XrayUtil.GetMinimumXrayVersionErrorMessage(xrayVersion.xray_version);
                    await OutputLog.ShowMessageAsync(errorMessage);

                    return;
                }
                // Steps to run:
                // 1. Trigger CLI to collect json info to a file.
                // 2. Read the info.
                // 3. Send dependencies to Xray.
                // 4. Get response and build the dependencies tree.

                // Running CLI - this is the returned output.
                String returnedText = await Task.Run(() => Util.GetCLIOutputAsync(solutionDir));

                // Load projects from output.
                Projects projects = Util.LoadNugetProjects(returnedText);

                if (projects.projects == null || projects.projects.Length == 0)
                {
                    await OutputLog.ShowMessageAsync("No projects were found.");

                    return;
                }
                Artifacts artifacts = null;
                switch (refreshType)
                {
                case RefreshType.Hard:
                {
                    // Get information for all dependencies. Ignore the cache.
                    artifacts = await dataService.RefreshArtifactsAsync(true, projects);

                    break;
                }

                case RefreshType.Soft:
                {
                    // Get information only for the delta. Means only new dependencies will be added.
                    artifacts = await dataService.RefreshArtifactsAsync(false, projects);

                    break;
                }
                }
                dataService.Severities = severities;
                dataService.populateRootElements(projects);

                this.Artifacts = new ObservableCollection <ArtifactViewModel>();

                foreach (string key in dataService.RootElements)
                {
                    Artifacts.Add(new ArtifactViewModel(key));
                }
            }
            catch (Exception e)
            {
                dataService.ClearAllComponents();
                await OutputLog.ShowMessageAsync(e.Message);

                await OutputLog.ShowMessageAsync(e.StackTrace);
            }
            finally
            {
                this.EnableRefreshButton = true;
            }
        }