public static async Task <DataStore> SetUp(bool getUserToken = false)
        {
            DataStore dataStore = null;

            if (getUserToken)
            {
                tempDataStore = null;
                Thread newThread = new Thread(GetUserTokenThreadSafe);
                newThread.SetApartmentState(ApartmentState.STA);
                newThread.Start();
                while (newThread.ThreadState != ThreadState.Stopped)
                {
                    await Task.Delay(3000);
                }
                dataStore = tempDataStore;
            }
            else
            {
                dataStore = AAD.GetTokenWithDataStore().Result;
            }

            dataStore = await SetupDatastore(dataStore);

            return(dataStore);
        }
 public static void GetUserTokenThreadSafe()
 {
     tempDataStore = AAD.GetUserTokenFromPopup().Result;
 }