public async void InitialisePluginComponents()
        {
            await OctaneServices.GetInstance().Connect();

            await OctaneMyItemsViewModel.Instance.LoadMyItemsAsync();

            await EntityTypeRegistry.Init();
        }
        public async Task <string> TestConnection()
        {
            try
            {
                AuthenticationStrategy authenticationStrategy = null;
                if (credentialLogin)
                {
                    authenticationStrategy = new LwssoAuthenticationStrategy(new UserPassConnectionInfo(OctaneConfiguration.Username,
                                                                                                        OctaneConfiguration.Password));
                }
                else if (ssologin)
                {
                    authenticationStrategy = new SsoAuthenticationStrategy();
                }

                await authenticationStrategy.TestConnection(url);

                // Don't do advanced test connection with sso login, will cause deadlock
                if (credentialLogin)
                {
                    // reset and thus require a new octane service obj
                    Run(async() => { return(await OctaneServices.Reset()); }).Wait();

                    // hotfix for first time installing the plugin and clicking test connection
                    if (OctaneConfiguration.CredentialLogin == false)
                    {
                        OctaneConfiguration.CredentialLogin = true;
                    }

                    // create a new service object
                    OctaneServices.Create(OctaneConfiguration.Url,
                                          OctaneConfiguration.SharedSpaceId,
                                          OctaneConfiguration.WorkSpaceId);

                    await OctaneServices.GetInstance().Connect();

                    // try to get the work item root
                    await OctaneServices.GetInstance().GetAsyncWorkItemRoot();
                }

                return(ConnectionSuccessful);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        protected override void OnClosed(EventArgs e)
        {
            if (credentialLogin)
            {
                if ("".Equals(OctaneConfiguration.Url))
                {
                    if (OctaneMyItemsViewModel.Instance != null)
                    {
                        OctaneMyItemsViewModel.Instance.Mode = MainWindowMode.FirstTime;
                    }
                }
                else
                {
                    Run(async() => { return(await OctaneServices.Reset()); }).Wait();

                    OctaneConfiguration.Username = oldUserPassConnectionInfo.user;
                    OctaneConfiguration.Password = oldUserPassConnectionInfo.password;
                    ssid = oldSsid;
                    wsid = oldWsid;
                    OctaneServices.Create(oldUrl, oldSsid, oldWsid);

                    try
                    {
                        Run(async() => { await OctaneServices.GetInstance().Connect(); }).Wait();
                    }
                    catch
                    {
                        clearUserPassTextBoxes();
                    }
                    finally
                    {
                        page.SetInfoLabelText("");
                    }

                    base.OnClosed(e);
                }
            }
        }