Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public async Task InitializeAsync()
        {
            try
            {
                await _userInterfaceService.ShowBusyIndicatorAsync();

                DeviceInfoModel = await _restService.GetAsync <DeviceInfoModel>(new Uri("api/iot/device/information", UriKind.Relative));

                _timer       = new DispatcherTimer();
                _timer.Tick += Timer_Tick;
                _timer.Start();
            }
            catch (Exception ex)
            {
                await _userInterfaceService.ShowFeedbackAsync(ex);
            }
        }
 public async Task TerminateProcesAsync(int processId)
 {
     var process  = ProcessesModel.FirstOrDefault(p => p.ProcessId == processId);
     var commands = new List <UICommand>
     {
         new UICommand("Yes, kill it", async(cmd) =>
         {
             try
             {
                 await _restService.DeleteAsync(new Uri(String.Format("api/taskmanager/process?pid={0}", processId), UriKind.Relative));
                 ProcessesModel.Remove(process);
             }
             catch (Exception ex)
             {
                 await _userInterfaceService.ShowFeedbackAsync(ex);
             }
         }),
         new UICommand("No, be nice")
     };
     await _userInterfaceService.ShowDialogAsync("Terminate Process Confirmation",
                                                 String.Format("Are you sure you want to terminate the '{0}' process?", process.ImageName), commands, 1);
 }
 public NetworkingViewModel(IRestService restService, IUserInterfaceService userInterfaceSerive)
 {
     _restService = restService;
     _userInterfaceService = userInterfaceSerive;
     Messenger.Default.Register<WifiAdapterModel.Interface>(this, UserInterfaceService.Commands.WifiAdapterSelectionChanged, async m =>
     {
         try
         {
             WifiNetworksModel = await _restService.GetAsync<WifiNetworksModel>(new Uri(String.Format("api/wifi/networks?interface={0}",
                 m.GUID.ToString("D")), UriKind.Relative));
         }
         catch (Exception ex)
         {
             await _userInterfaceService.ShowFeedbackAsync(ex);
         }
     });
 }
 public NetworkingViewModel(IRestService restService, IUserInterfaceService userInterfaceSerive)
 {
     _restService          = restService;
     _userInterfaceService = userInterfaceSerive;
     Messenger.Default.Register <WifiAdapterModel.Interface>(this, UserInterfaceService.Commands.WifiAdapterSelectionChanged, async m =>
     {
         try
         {
             WifiNetworksModel = await _restService.GetAsync <WifiNetworksModel>(new Uri(String.Format("api/wifi/networks?interface={0}",
                                                                                                       m.GUID.ToString("D")), UriKind.Relative));
         }
         catch (Exception ex)
         {
             await _userInterfaceService.ShowFeedbackAsync(ex);
         }
     });
 }
        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);
            }
        }