private void EditName_Click(object sender, RoutedEventArgs e) { ItemViewModel.IsNameEditMode = true; EditName.Focus(); }
private void MainViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "SelectedItem") { // show status tab for existing managed certs var showStatus = ItemViewModel.SelectedItem?.Id != null && ItemViewModel.SelectedItem.DateLastRenewalAttempt != null; if (showStatus) { TabStatusInfo.Visibility = Visibility.Visible; } else { TabStatusInfo.Visibility = Visibility.Collapsed; } if (_lastSelectedItemId != ItemViewModel.SelectedItem?.Id) { // switch tab to defaultif the selected item has changed _lastSelectedItemId = ItemViewModel.SelectedItem?.Id; if (showStatus) { SettingsTab.SelectedItem = TabStatusInfo; } else { SettingsTab.SelectedItem = TabDomains; } } ItemViewModel.RaiseSelectedItemChanges(); if (ItemViewModel.SelectedItem?.Id == null) { // show name in edit mode when starting a new item ItemViewModel.IsNameEditMode = true; EditName.Focus(); } else { if (!ItemViewModel.IsEditable) { this.TabDeployment.Visibility = Visibility.Collapsed; this.TabDomains.Visibility = Visibility.Collapsed; this.TabAuthorization.Visibility = Visibility.Collapsed; this.TabTasks.Visibility = Visibility.Collapsed; this.TabPreview.Visibility = Visibility.Collapsed; } else { this.TabDeployment.Visibility = Visibility.Visible; this.TabDomains.Visibility = Visibility.Visible; this.TabAuthorization.Visibility = Visibility.Visible; this.TabTasks.Visibility = Visibility.Visible; this.TabPreview.Visibility = Visibility.Visible; } } AppViewModel.IsChanged = false; } }