/// <summary> /// Updates the display. /// </summary> private void Update() { if (this.addingOpen) { // Enable the inputs. this.inputs.IsVisible = true; this.cancelButton.IsVisible = true; // Update the button depending on if the inputs are populated and the name isn't a duplicate. var serverName = this.serverNameInput.Text?.Trim(); var serverAddress = this.serverAddressInput.Text?.Trim(); if (!string.IsNullOrEmpty(serverName) && !string.IsNullOrEmpty(serverAddress) && PersistentState.GetServerEntry(serverName) == null) { this.addButton.Active = true; this.addButton.Color = new SolidColorBrush(ButtonEnabledColor); } else { this.addButton.Active = false; this.addButton.Color = new SolidColorBrush(ButtonDisabledColor); } } else { // Hide the inputs and enable the button. this.inputs.IsVisible = false; this.cancelButton.IsVisible = false; this.addButton.Active = true; this.addButton.Color = new SolidColorBrush(ButtonEnabledColor); } }