public async Task InitializeAsync() { try { await _userInterfaceService.ShowBusyIndicatorAsync(); InstalledModel = await _restService.GetAsync <AppsModel>(new Uri("api/appx/packagemanager/packages", UriKind.Relative)); var processesModel = await _restService.GetAsync <ProcessesModel>(new Uri("api/resourcemanager/processes", UriKind.Relative)); RunningModel = new AppsModel(); foreach (var process in processesModel.Processes) { var app = InstalledModel.InstalledPackages.FirstOrDefault(p => p.PackageFullName == process.PackageFullName); if (app != null) { RunningModel.InstalledPackages.Add(app); } } // for each running process await _userInterfaceService.HideBusyIndicatorAsync(); } catch (Exception ex) { await _userInterfaceService.ShowFeedbackAsync(ex); } }
private async void Timer_Tick(object sender, object e) { try { _timer.Stop(); _timer.Interval = TimeSpan.FromSeconds(1); SystemPerfModel = await _restService.GetAsync <SystemPerfModel>(new Uri("api/resourcemanager/systemperf", UriKind.Relative)); TotalMemory = SystemPerfModel.TotalPages * SystemPerfModel.PageSize; AvailableMemory = SystemPerfModel.AvailablePages * SystemPerfModel.PageSize; InUseMemory = TotalMemory - AvailableMemory; var networkIn = SystemPerfModel.NetworkingData.NetworkInBytes; NetworkInMaximum = Math.Max(NetworkInMaximum, networkIn); NetworkInCurrent = networkIn; var networkOut = SystemPerfModel.NetworkingData.NetworkOutBytes; NetworkOutMaximum = Math.Max(NetworkOutMaximum, networkOut); NetworkOutCurrent = networkOut; _timer.Start(); await _userInterfaceService.HideBusyIndicatorAsync(); } catch (Exception ex) { await _userInterfaceService.ShowFeedbackAsync(ex); } }
public async void ShowFeedback(Exception ex) { if (ex is IotException) { FeedbackText = String.Format("{0} {1}", ex.Message, ex.InnerException == null ? String.Empty : ex.InnerException.Message).Replace("\n", " ").Replace("\r", " "); } else { _restService.TelemetryClient.TrackException(ex); FeedbackText = String.Format("Uh oh it looks like something bad has happened. Here are the cryptic details: {0} {1}", ex.Message, ex.InnerException == null ? String.Empty : ex.InnerException.Message).Replace("\n", " ").Replace("\r", " "); } FeedbackButtonVisibility = String.IsNullOrEmpty(FeedbackText) ? Visibility.Collapsed : Visibility.Visible; await _userInterfaceService.HideBusyIndicatorAsync(); }
public async Task InitializeAsync() { try { await _userInterfaceService.ShowBusyIndicatorAsync(); Model = await _restService.GetAsync <DevicesModel>(new Uri("api/devicemanager/devices", UriKind.Relative)); var sortedModel = new DevicesModel(); BuildHierarchy(Model, sortedModel, Model.DeviceList.Where(d => d.ParentID == null).Select(d => d.ID).FirstOrDefault(), 0); Model = sortedModel; await _userInterfaceService.HideBusyIndicatorAsync(); } catch (Exception ex) { await _userInterfaceService.ShowFeedbackAsync(ex); } }
public async Task InitializeAsync() { try { await _userInterfaceService.ShowBusyIndicatorAsync(); IpConfigModel = await _restService.GetAsync <IpConfigModel>(new Uri("api/networking/ipconfig", UriKind.Relative)); WifiAdapterModel = await _restService.GetAsync <WifiAdapterModel>(new Uri("api/wifi/interfaces", UriKind.Relative)); if (WifiAdapterModel.Interfaces.Length > 0) { WifiNetworksModel = await _restService.GetAsync <WifiNetworksModel>(new Uri(String.Format("api/wifi/networks?interface={0}", WifiAdapterModel.Interfaces[0].GUID.ToString("D")), UriKind.Relative)); } await _userInterfaceService.HideBusyIndicatorAsync(); } catch (Exception ex) { await _userInterfaceService.ShowFeedbackAsync(ex); } }
private async void Timer_Tick(object sender, object e) { try { _timer.Stop(); _timer.Interval = TimeSpan.FromSeconds(1); var processModel = await _restService.GetAsync <ProcessesModel>(new Uri("api/resourcemanager/processes", UriKind.Relative)); if (ProcessesModel == null || ProcessesModel.Count <= 1) { ProcessesModel = new ObservableCollection <ProcessViewModel>(); foreach (var process in processModel.Processes) { ProcessesModel.Add(ProcessViewModel.FromProcessModel(this, process)); } } else { // Update displayed processes. Ignore any processes that were starter or terminated until the next page transition. foreach (var process in processModel.Processes) { var displayProcess = ProcessesModel.Where(p => p.ProcessId == process.ProcessId).FirstOrDefault(); if (displayProcess == null) { continue; } displayProcess.Update(process); } // for each process } _timer.Start(); await _userInterfaceService.HideBusyIndicatorAsync(); } catch (Exception ex) { await _userInterfaceService.ShowFeedbackAsync(ex); } }