#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously public async Task Disconnect() #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously { connected = false; Applications.Clear(); StateChanged?.Invoke(); }
/// <summary> /// 永続化されているアプリケーション構成情報を非同期で読み込みます。 /// </summary> /// <returns>この操作を待機するための <see cref="Task"/> 。</returns> public async Task LoadAsync() { Applications.Clear(); await _repository.LoadAsync(this).ConfigureAwait(false); if (String.IsNullOrEmpty(Settings.ApplicationInformationServiceUrl)) { Settings.SetDefaultService(); } RegisterMeIfNotRegistered(); var httpClient = new HttpClient(); // アプリケーションの日本語名、説明と更新情報の URL はサービスから取得 var response = await httpClient.GetAsync(Settings.ApplicationInformationServiceUrl).ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.OK) { return; } var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false); _appInfo = JsonConvert.DeserializeObject <ApplicationJson>(json); foreach (var application in Applications) { await application.InitializeAsync(_appInfo).ConfigureAwait(false); } }
private void LoadApplications() { Applications.Clear(); try { var dir = new DirectoryInfo(applicationsPath.Value); if (dir.Exists) { foreach (var file in dir.EnumerateFiles()) { try { Applications.Add(UnrealApplicationSettings.ReadFromFile(file.FullName)); } catch (Exception ex) { Program.ShowException(ex); } } } } catch (DirectoryNotFoundException) { // ignore } }
protected async override Task OnEnumChildren(bool deep) { Applications.Clear(); var applications = await _fabricClient.QueryManager.GetApplicationListAsync(); foreach (var application in applications) { var sfApplication = new SFApplication(_fabricClient, this, application); Applications.Add(sfApplication); if (deep) { await sfApplication.EnumChildren(deep); } } Nodes.Clear(); var nodes = await _fabricClient.QueryManager.GetNodeListAsync(); foreach (var node in nodes) { var sfNode = new SFNode(_fabricClient, this, node); Nodes.Add(sfNode); if (deep) { await sfNode.EnumChildren(deep); } } LoadInformation = await _fabricClient.QueryManager.GetClusterLoadInformationAsync(); }
public void ClearAll(LoginatorViewModel loginator) { DispatcherHelper.CheckBeginInvokeOnUI(() => { lock (ViewModelConstants.SYNC_OBJECT) { Logs.Clear(); Namespaces.Clear(); Applications.Clear(); } }); }
private async Task Fetch() { Applications.Clear(); var client = await IoTCentral.Current.GetServiceClient(); var apps = await client.ListApps(); Applications.AddRange(apps); IsBusy = false; OnPropertyChanged("Applications"); }
/// <summary>Runs when the search for updates has completed for an auto update.</summary> /// <param name="sender">The object that called the event.</param> /// <param name="e">The <c>SearchCompletedEventArgs</c> instance containing the event data.</param> static void SearchCompleted(object sender, SearchCompletedEventArgs e) { IsInstalling = false; Applications = e.Applications as Collection <Sui>; if (Applications == null) { return; } if (Applications.Count > 0) { if (Applications[0].AppInfo.SuiUrl == @"http://apps.sevenupdate.com/SevenUpdate.sui" || Applications[0].AppInfo.SuiUrl == @"http://apps.sevenupdate.com/SevenUpdate-dev.sui") { Sui sevenUpdate = Applications[0]; Applications.Clear(); Applications.Add(sevenUpdate); e.OptionalCount = 0; e.ImportantCount = 1; } Utilities.Serialize(Applications, Path.Combine(AllUserStore, "updates.sui")); Utilities.StartProcess( @"cacls.exe", "\"" + Path.Combine(AllUserStore, "updates.sui") + "\" /c /e /g Users:F"); if (Settings.AutoOption == AutoUpdateOption.Notify) { Application.Current.Dispatcher.BeginInvoke(UpdateNotifyIcon, NotifyType.SearchComplete); } else { Application.Current.Dispatcher.BeginInvoke(UpdateNotifyIcon, NotifyType.DownloadStarted); Download.DownloadUpdates(Applications, "SevenUpdate", Path.Combine(AllUserStore, "downloads")); // Task.Factory.StartNew(() => Download.DownloadUpdates(Applications, "SevenUpdate", // Path.Combine(AllUserStore, "downloads"))); IsInstalling = true; } } else { ShutdownApp(); } }
public async Task UpdateApplicationsAsync() { if (_devicePortal == null || !IsConnected) { Message = "Update app list failed."; return; } Applications.Clear(); // インストールされているアプリを取得 var appPackages = await _devicePortal.GetInstalledAppPackagesAsync(); var apps = appPackages.Packages.Select(x => new HoloLensApplication(x.AppId, x.Name, x.FullName)); foreach (var app in apps) { Applications.Add(app); } }
async Task ExecuteLoadApplicationsCommand() { IsBusy = true; try { Applications.Clear(); var applicatoins = await Database.GetApplicationAsync(LoginPage.CurrentUserId); foreach (var application in Applications) { Applications.Add(application); } IsBusy = false; } catch (Exception e) { Debug.WriteLine(e); } }
/// <summary> /// Změna Dne/Měsíce/Roku a načtění odpovídajících souborů z databáze /// </summary> /// <param name="date"></param> private void ChangeDay(DateTime date) { selectedDate = date; Applications.Clear(); try { wholeTime = 0; if (mode == 0) { Applications = fileOp.loadFile(date, ref wholeTime); } else if (mode == 1) { Applications = fileOp.loadMonth(date, ref wholeTime); } else if (mode == 2) { Applications = fileOp.loadYear(date, ref wholeTime); } foreach (Application item in Applications) { if (knownCategories.ContainsKey(item.name)) { setCategoryIcon(item, knownCategories[item.name]); } else { setCategoryIcon(item, item.Category.name); } } recountThePercentage(); Messenger.Default.Send(new TimeSpan(0, 0, wholeTime)); } catch { Messenger.Default.Send(new TimeSpan(0, 0, wholeTime)); return; } }
public async Task RefreshApplications() { using (HttpClientHandler clientHandler = new HttpClientHandler()) { clientHandler.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; using (HttpClient client = new HttpClient(clientHandler)) { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, Url); request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json")); HttpResponseMessage response = await client.SendAsync(request); string responseText = await response.Content.ReadAsStringAsync(); JsonSerializer ser = new JsonSerializer(); EurekaApplicationsJson apps = ser.Deserialize <EurekaApplicationsJson>(new JsonTextReader(new StringReader(responseText))); Applications.Clear(); foreach (EurekaApplicationJson appJson in apps.ApplicationList.Applications) { EurekaApplication app = new EurekaApplication(); Applications.Add(app); app.Name = appJson.Name; foreach (EurekaApplicationInstanceJson instanceJson in appJson.Instances) { EurekaApplicationInstance instance = new EurekaApplicationInstance(); app.Instances.Add(instance); instance.InstanceId = instanceJson.InstanceId; instance.HostName = instanceJson.HostName; instance.Status = instanceJson.Status; } } await RefreshDeregisteredInstances(); StateChanged?.Invoke(); } } }
public MainViewModel(INavigationService navigationService) : base(navigationService) { Title = "Azure IoT Central"; IsBusy = true; Add = new Command(CreateNewApplication); ReloadApplications = new Command(async() => { IsBusy = true; await Fetch(); }); //LoginCommand = new Command(Fetch); OnApplicationTapped = new Command(() => { Application tappedApp = LastTappedItem as Application; if (tappedApp != null) { IoTCentral.Current.Application = tappedApp; Navigation.NavigateTo(new ModelsViewModel(Navigation)); } }); Applications.Clear(); }
public void RemoveAllApplication() { Applications.Clear(); CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); }