/// <summary> /// This callback is called when the catalog combobox is deployed. /// </summary> private void DeployCatalogCommandExecute() { if (_taskRetrieveDataBasesIsLaunched) { return; } var context = TaskScheduler.FromCurrentSynchronizationContext(); Catalogs.Clear(); Catalogs.Add("(loading databases ...)"); var connectionString = CreateConnectionStringWithoutCatalog(); _taskRetrieveDataBasesIsLaunched = true; GetDatabases(connectionString).ContinueWith(taskResult => { try { var databases = taskResult.Result; Catalogs.Clear(); databases.ForEach(s => Catalogs.Add(s)); } finally { _taskRetrieveDataBasesIsLaunched = false; } }, context); }
private void PrintCatalogs() { Catalogs.Clear(); foreach (var item in GetCatalogs()) { Catalogs.Add(item); } }
private void ResetCatalog(CultureInfo cultureInfo) { if (Catalogs == null) { Catalogs = new List <ICatalog>(); } else { Catalogs.Clear(); } foreach (var domainName in mDomainNames) { Catalogs.Add(GetCatalog(cultureInfo, domainName)); } }
async public Task LoadCatalogs() { if (IsCatalogsLoading || !IsUserViewModelLoaded) { return; } IsCatalogsLoading = true; hasCatalogs = null; var options = new EtaApiQueryStringParameterOptions(); options.AddParm(EtaApiConstants.EtaApi_Latitude, UserViewModel.Location.Latitude.ToString("0.00000")); options.AddParm(EtaApiConstants.EtaApi_Longitude, UserViewModel.Location.Longitude.ToString("0.00000")); options.AddParm(EtaApiConstants.EtaApi_LocationDetermined, UNIXTime.GetTimestamp(DateTime.Now)); options.AddParm(EtaApiConstants.EtaApi_Geocoded, UserViewModel.Location.IsGeoCoded ? "0" : "0"); options.AddParm(EtaApiConstants.EtaApi_Accuracy, "0");//userModel.Location.Accuracy.ToString()); options.AddParm(EtaApiConstants.EtaApi_Ditance, UserViewModel.Distance.ToString()); var response = await Api.GetCatalogListAsync(options); Deployment.Current.Dispatcher.BeginInvoke(() => { if (Catalogs.Any()) { Catalogs.Clear(); } if (response.HasErrors) { IsCatalogsLoaded = false; } else { foreach (var catalog in response.Result) { Catalogs.Add(catalog); } IsCatalogsLoaded = true; } HasCatalogs = Catalogs.Any(); IsCatalogsLoading = false; }); }
private void ExecuteCommand(Func <Catalog, bool> apiMethod, object obj) { if (obj != null) { Catalog catalog = obj as Catalog; bool response = apiMethod(catalog); Catalogs?.Clear(); MarketAPI.GetCatalog(out List <Catalog> catalogs, out bool result); if (result && catalogs != null) { catalogs.ForEach(x => Catalogs.Add(x)); } MessageBox.Show ( response ? MarketAPI.SuccessMessage : MarketAPI.FailMessage ); } }