private async Task <IEnumerable <Instance> > GetAllWindowsInstances() { var dataSource = new GceDataSource( CredentialsStore.Default.CurrentProjectId, CredentialsStore.Default.CurrentGoogleCredential, GoogleCloudExtensionPackage.ApplicationName); var instances = await dataSource.GetInstanceListAsync(); return(instances.Where(x => x.IsRunning() && x.IsWindowsInstance()).OrderBy(x => x.Name)); }
private async Task AddGceInstanceSubMenu(IEnumerable <string> instanceIds) { var dataSource = new GceDataSource( CredentialsStore.Default.CurrentProjectId, CredentialsStore.Default.CurrentGoogleCredential, GoogleCloudExtensionPackage.ApplicationName); var allInstances = await dataSource.GetInstanceListAsync(); // Left join instanceIds to allInstances on Id. // Select instance name if id is found in allInstances. var menuItems = from id in instanceIds join instance in allInstances on id equals instance.Id?.ToString() into joined from subInstance in joined.DefaultIfEmpty() orderby subInstance?.Name descending select new ResourceValueItemViewModel(id, this, subInstance == null ? id : subInstance.Name); menuItems.ToList().ForEach(x => MenuItems.Add(x)); }
private async Task<IEnumerable<Instance>> GetAllWindowsInstances() { var dataSource = new GceDataSource( CredentialsStore.Default.CurrentProjectId, CredentialsStore.Default.CurrentGoogleCredential, GoogleCloudExtensionPackage.ApplicationName); var instances = await dataSource.GetInstanceListAsync(); return instances.Where(x => x.IsRunning() && x.IsWindowsInstance()).OrderBy(x => x.Name); }