/// <summary> /// Initializes a new instance of the <see cref="ManageAppsDialog" /> class. /// </summary> /// <param name="monitor">The HoloLensMonitor that is responsible for communication with the HoloLens.</param> /// <param name="monitorControl">The HoloLensMonitor control that launched this dialog.</param> public ManageAppsDialog( HoloLensMonitor monitor, HoloLensMonitorControl monitorControl) { this.DataContext = new ManageAppsDialogViewModel( monitor, monitorControl); this.InitializeComponent(); }
/// <summary> /// Removes the specified HoloLens from monitoring. /// </summary> /// <param name="monitorControl">The HoloLensMonitorControl tracking the HoloLens to be removed.</param> /// <returns>Task object used for tracking method completion.</returns> private async Task UnregisterHoloLensAsync(HoloLensMonitorControl monitorControl) { this.RegisteredDevices.Remove(monitorControl); if (this.RegisteredDevices.Count == 0) { this.HaveRegisteredDevices = false; } await this.SaveConnectionsAsync(); }
/// <summary> /// Initializes a new instance of the <see cref="HoloLensMonitorControlViewModel" /> class. /// </summary> /// <param name="control">The HoloLensMonitorControl to which this object is registered.</param> /// <param name="monitor">The HoloLensMonitor responsible for communication with this HoloLens.</param> public HoloLensMonitorControlViewModel( HoloLensMonitorControl control, HoloLensMonitor monitor) { this.holoLensMonitorControl = control; this.RegisterCommands(); this.holoLensMonitor = monitor; this.holoLensMonitor.HeartbeatLost += HoloLens_HeartbeatLost; this.holoLensMonitor.HeartbeatReceived += HoloLens_HeartbeatReceived; this.holoLensMonitor.AppInstallStatus += HoloLensMonitor_AppInstallStatus; this.IsConnected = true; this.Address = holoLensMonitor.Address; this.IsSelected = true; }
/// <summary> /// Initializes a new instance of the <see cref="ManageAppsDialogViewModel" /> class. /// </summary> /// <param name="monitor">The HoloLensMonitor responsible for communication with this HoloLens.</param> /// <param name="monitorControl">Instance of the control that launched this dialog.</param> public ManageAppsDialogViewModel( HoloLensMonitor monitor, HoloLensMonitorControl monitorControl) { this.holoLensMonitor = monitor; this.holoLensMonitorControl = monitorControl; this.holoLensMonitor.AppInstallStatus += HoloLensMonitor_AppInstallStatus; this.InstalledApps = new ObservableCollection <string>(); this.RunningApps = new ObservableCollection <string>(); this.RegisterCommands(); // Assigning the return value of the following methods to a Task object to avoid // warning 4014 (call is not awaited). Task t = this.RefreshInstalledAppsAsync(); t = this.RefreshRunningAppsAsync(); }
/// <summary> /// Registers the HoloLensMonitor with the application. /// </summary> /// <param name="monitor">HoloLens to register.</param> /// <param name="name">Descriptive name of the HoloLens.</param> /// <returns>Task object used for tracking method completion.</returns> private async Task RegisterHoloLensAsync( HoloLensMonitor monitor, string name) { HoloLensMonitorControl holoLensMonitorControl = new HoloLensMonitorControl(monitor); holoLensMonitorControl.Disconnected += HoloLensMonitorControl_Disconnected; holoLensMonitorControl.TagChanged += HoloLensMonitorControl_TagChanged; HoloLensMonitorControlViewModel viewModel = holoLensMonitorControl.DataContext as HoloLensMonitorControlViewModel; viewModel.Name = name; this.RegisteredDevices.Add(holoLensMonitorControl); if (this.RegisteredDevices.Count > 0) { this.HaveRegisteredDevices = true; } await this.SaveConnectionsAsync(); }
/// <summary> /// Handles the TagChanged event. /// </summary> /// <param name="sender">The object which sent this event.</param> private void HoloLensMonitorControl_TagChanged(HoloLensMonitorControl sender) { // Assigning the return value of SaveConnectionsAsync to a Task object to avoid // warning 4014 (call is not awaited). Task t = this.SaveConnectionsAsync(); }
/// <summary> /// Handles the Disconnected event. /// </summary> /// <param name="sender">The object which sent this event.</param> private void HoloLensMonitorControl_Disconnected(HoloLensMonitorControl sender) { // Assigning the return value of UnregisterHoloLensAsync to a Task object to avoid // warning 4014 (call is not awaited). Task t = this.UnregisterHoloLensAsync(sender); }
/// <summary> /// Handles the AppUninstalled event. /// </summary> /// <param name="sender">The object which sent this event.</param> private void HoloLensMonitorControl_AppUninstalled(HoloLensMonitorControl sender) { // Assigning the return value of RefreshCommonAppsAsync to a Task object to avoid // warning 4014 (call is not awaited). Task t = this.RefreshCommonAppsAsync(); }