// Deployment list public async Task <List <DeploymentModel> > GetDeploymentModels(TenantModel tenantModel, DeviceGroupModel deviceGroupModel) { List <DeploymentModel> deploymentModels; if (deviceGroupModel == null) { return(null); } try { deploymentModels = await GetDeploymentsAsync(tenantModel.Context, deviceGroupModel.Context); } catch (Exception ex) { Console.Error.WriteLine(ex.ToString()); return(null); } return(deploymentModels); }
public async Task <bool> DeleteDeviceGroup(TenantModel tenantModel, DeviceGroupModel deviceGroupModel) { bool ret = false; try { if (await DeleteDeviceGroupAsync(tenantModel.Context, deviceGroupModel.Context)) { ret = true; this.DeviceGroupModels = await GetDeviceGroupsAsync(tenantModel.Context); NotificationChangeDeviceGroup?.Invoke(this, null); } } catch (Exception ex) { Console.Error.WriteLine(ex.ToString()); return(false); } return(ret); }
public async Task <bool> CreateDeviceGroup(TenantModel tenantModel, string json) { bool ret = false; try { HttpContent jsonContent = new StringContent(json, System.Text.Encoding.UTF8, "application/json"); if (await Api.PostCreateDeviceGroupAsync(tenantModel.Context, jsonContent, cancellationTokenSource.Token)) { this.DeviceGroupModels = await GetDeviceGroupsAsync(tenantModel.Context); NotificationChangeDeviceGroup?.Invoke(this, null); ret = true; } } catch (Exception ex) { Console.Error.WriteLine(ex.ToString()); return(ret); } return(ret); }
private void gridTenants_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var element = e.MouseDevice.DirectlyOver as FrameworkElement; if (element == null) { return; } var cell = element.Parent as DataGridCell; if (cell == null) { cell = element.TemplatedParent as DataGridCell; } if (cell == null) { return; } this.SelectedTenantModel = (TenantModel)cell.DataContext; this.DialogResult = true; }