Esempio n. 1
0
        public async Task <IList <T> > GetCommitTypesAsync <T>() where T : class
        {
            string cacheKey = await GetCacheKeyAsync();

            lock (@lock)
            {
                var commitTypes = cache.GetCacheItem(cacheKey);
                if (commitTypes != null)
                {
                    return((IList <T>)commitTypes.Value);
                }
            }

            try
            {
                var configStr = await GetConfigAsync();

                T[] commitTypes = JsonConvert.DeserializeObject <T[]>(configStr).Where(c => !string.IsNullOrEmpty(c.ToString())).ToArray();
                lock (@lock)
                {
                    cache.Set(cacheKey, commitTypes, new CacheItemPolicy());
                }
                return(commitTypes);
            }
            catch (InvalidConfigurationFileException ex)
            {
                popupManager.Show($"Failed to read configuration file, using default values.{Environment.NewLine}{Environment.NewLine}{ex}", "Error");
                throw;
            }
        }
        public async Task ExecuteAsync(Func <string, Task> openFunc)
        {
            try
            {
                var localConfigPath = await this.configFileProvider.TryGetLocalConfigAsync();

                if (string.IsNullOrWhiteSpace(localConfigPath))
                {
                    return;
                }

                if (fileAccessor.Exists(localConfigPath))
                {
                    await openFunc(localConfigPath);
                }
                else
                {
                    if (popupManager.Confirm("There is no local configuration file yet, do you want to create it for this repository ?", "Init local config file"))
                    {
                        fileAccessor.CopyFile(ConfigFileProvider.ConfigPathUserProfile, localConfigPath);
                        await openFunc(localConfigPath);
                    }
                }
            }
            catch (Exception ex)
            {
                popupManager.Show(ex.ToString(), "An error occured");
            }
        }
Esempio n. 3
0
 public void StartNewGame()
 {
     Debug.Log("Trying to find new opponent");
     popupManager.Show(PopupType.SearchOpponent);
     networkService.FindOpponent();
 }