private async Task GetRepositories() { try { Loading = true; string q = "language:JavaScript"; if (!string.IsNullOrEmpty(Search)) { q = $"{Search}+in:name+{q}"; } var response = await Apis.GitHub.GetRepositories(q, "Repositories", "stars", Page); var rep = response.Content; if (rep != null) { rep.Items.ForEach((item) => { if (Repositories.Count <= RepositoriesListLimit) { Repositories.Add(item); } }); await RaisePropertyChanged(() => Repositories); } } catch (Exception e) { Console.WriteLine(e.Message); } Loading = false; ShowEmptyState = Repositories.Count == 0; }
public IApiRepositoryConfig RegisterRepository <TEntity, TMappedEntity, TRepository>() where TEntity : class, IEntity where TMappedEntity : class where TRepository : IRepository { var fullType = typeof(ApiMappedRepository <TEntity, TMappedEntity, TRepository>); var alias = AliasHelper.GetRepositoryAlias(fullType); if (Repositories.Any(x => x.Alias == alias)) { throw new NotUniqueException(nameof(TRepository)); } var config = new ApiRepositoryConfig { Alias = alias, EntityType = typeof(TEntity), DatabaseType = typeof(TMappedEntity), RepositoryType = typeof(TRepository) }; Repositories.Add(config); return(config); }
void UpdateRepositoriesFromCustomRepo() { Repositories.Clear(); Repositories.Add(CustomRepoUrl.ToUri().ProcessRepoUrl()); }
public void AddRepository(IRepositoryConfiguration repositoryConfiguration) { Repositories.Add(repositoryConfiguration); }
internal void AddNewRepository(string displayName, string id, int updateInterval) { Repositories.Add(new RepositorySettings(displayName, id, updateInterval)); Save(); RepositoriesChanged?.Invoke(this, EventArgs.Empty); }
private void Window_Loaded(object sender, RoutedEventArgs e) { Repositories.Add(new Repository("G:\\Anime")); }
public new LookupCrudRepositoryFactory Add <TEntity>([NotNull] ICrudRepository <TEntity> repository) where TEntity : class, IEntity, new() { Repositories.Add(typeof(TEntity), repository); return(this); }
public void Register(IRepository repository) => Repositories.Add(repository);
private void AddGitCafeRepository(GitCafeRepository repository) { Repositories.Add(repository); }
private static void Main(string[] args) { Console.WriteLine(@"----Welcome to human resource management program---- Choice one in all function below: 1. Enter staffs’ information. 2. Search officers and professors. 3. Display list of officers and professors. 4. Method to insert, edit and delete staff. 5. Save information into a *.cvs file. 6. Read information from a *.cvs file. 7. Work with Database. 8. Exit. "); var listStaff = new Repositories<Staff>(); Console.Write("Your number you choice: "); var inputNumber = Convert.ToInt32(Console.ReadLine()); // menu1 if (inputNumber == 1) { Console.WriteLine( @"Choice 1 to enter office staff's information, or 2 to enter professor staff's information."); var inputMenu1 = Convert.ToInt32(Console.ReadLine()); int typeStaff; if (inputMenu1 == 1) { typeStaff = 1; var staffEntity = AddStaff(typeStaff); listStaff.Add(staffEntity); return; } if (inputMenu1 == 2) { typeStaff = 2; var staffEntity = AddStaff(typeStaff); listStaff.Add(staffEntity); return; } Console.WriteLine("Error"); } // menu2 if (inputNumber == 2) { Console.WriteLine( "Choice 1 to search office staff's information, or 2 to search professor staff's information."); var inputMenu2 = Convert.ToInt32(Console.ReadLine()); int typeStaff; if (inputMenu2 == 1) { typeStaff = 1; return; } if (inputMenu2 == 2) { typeStaff = 2; return; } Console.WriteLine("Error"); return; } // menu3 if (inputNumber == 3) { Console.WriteLine("List staff's information."); return; } // menu4 if (inputNumber == 4) { Console.WriteLine("Choice 1 to insert staff, 2 to edit staff, 3 to delete staff"); return; } // menu5 if (inputNumber == 5) { Console.WriteLine("Save information into a *.cvs file."); return; } // menu6 if (inputNumber == 6) { Console.WriteLine("Read information from *.cvs file."); return; } // menu7 if (inputNumber == 7) { Console.WriteLine("Work with database."); return; } // menu8 if (inputNumber == 8) { Console.WriteLine("Bye!"); Console.ReadKey(); } else { Console.WriteLine("Error."); Console.ReadKey(); } }
/// <summary> /// This routine scans module.ifo for a campaign GUID. If found, a /// campaign.cam file with the same GUID is searched for and its /// containing directory is added to the directory resource list. /// </summary> /// <param name="ModuleIfo">Supplies the module.ifo GFF reader.</param> /// <param name="HomeDirectory">Supplies the NWN2 home directory.</param> /// <param name="InstallDirectory">Supplies the NWN2 install directory.</param> private void AddModuleCampaign(GFFFile ModuleIfo, string HomeDirectory, string InstallDirectory) { byte[] GUIDData = ModuleIfo.TopLevelStruct.GetVoidDataSafe("Campaign_ID", null); if (GUIDData == null || GUIDData.Length != 16) { return; } Guid CampaignGUID = new Guid(GUIDData); string[] SearchDirs = new string[] { HomeDirectory, InstallDirectory }; // // Attempt to locate a campaign.cam file with the same GUID as the // module. // foreach (string PathName in SearchDirs) { string CampaignFolder = String.Format("{0}\\Campaigns", PathName); if (!Directory.Exists(CampaignFolder)) { continue; } foreach (string CampaignDir in Directory.EnumerateDirectories(CampaignFolder)) { using (DirectoryResourceRepository Repository = new DirectoryResourceRepository(CampaignDir)) { Repository.PopulateRepository(); IResourceEntry ResEntry = Repository.FindResource(new OEIResRef("campaign"), ResCAM); if (ResEntry == null) { continue; } GFFFile CampaignCAM = new GFFFile(ResEntry.GetStream(false)); GUIDData = CampaignCAM.TopLevelStruct.GetVoidDataSafe("GUID", null); if (GUIDData == null || GUIDData.Length != 16) { continue; } Guid ID = new Guid(GUIDData); if (!CampaignGUID.Equals(ID)) { continue; } Repositories.Add(new DirectoryResourceRepository(CampaignDir)); return; } } } }