public static void SetPublishAll(DataGrid webResourceGrid) { CheckBox publishAll = DataGridHelpers.FindVisualChildren <CheckBox>(webResourceGrid).FirstOrDefault(t => t.Name == "PublishSelectAll"); if (publishAll == null) { return; } int allowPublish = 0; int publish = 0; foreach (WebResourceItem webResourceItem in webResourceGrid.Items) { if (webResourceItem.AllowPublish) { allowPublish++; } if (webResourceItem.Publish) { publish++; } } publishAll.IsChecked = allowPublish == publish; }
private void LoadSettings(AcmSettings settings) { txtLogin.Text = settings.Login; txtTenantId.Text = settings.TenantId; txtApiEndpoint.Text = settings.ApiEndpoint; txtClientId.Text = settings.ClientId; txtRedirectUri.Text = settings.RedirectUri; txtFileZillaLocation.Text = settings.FileZillaLocation; DataGridHelpers.FillDataGridFromDictionary(gridSubscriptions, settings.Subscriptions); }
private void SaveSettings() { var settings = new AcmSettings { Login = txtLogin.Text, TenantId = txtTenantId.Text, ApiEndpoint = txtApiEndpoint.Text, ClientId = txtClientId.Text, RedirectUri = txtRedirectUri.Text, Subscriptions = DataGridHelpers.DataGridToDictionary(gridSubscriptions), FileZillaLocation = txtFileZillaLocation.Text }; AcmSettings.Save(settings); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DepartmentsDataGrid_PreviewKeyDown(object sender, KeyEventArgs e) { DataGridRow row = DataGridHelpers.GetRow(DepartmentsDataGrid, DepartmentsDataGrid.Items.IndexOf(DepartmentsDataGrid.CurrentItem)); if (row == null) { return; } if (row.IsEditing && e.Key == Key.Enter) { // only 'Enter' key on an editing row will allow a commit to occur IsInEditMode = false; } }
private async void BtnCommit_Click(object sender, EventArgs e) { DisableButtons(); var name = lstApps.SelectedItem.ToString(); var app = _apps.Single(a => a.Name == name); app.AppSettings = DataGridHelpers.SettingsFromDataGrid(appSettingsGrid); app.ConnectionStrings = DataGridHelpers.SettingsFromDataGrid(connectionStringsGrid); statusLabel.Text = "Connecting to Azure..."; var subscriptionId = comboSubscription.SelectedItem.ToString().Split('=')[1]; _azure.Connect(subscriptionId); statusLabel.Text = "Setting data..."; await _azure.SaveWebApp(app); EnableButtons(); await RefreshWebApps(); lstApps.SelectedItem = name; }