private void SetSelectedEndpoint(MacEndpoint item) { _currentEndpoint = item; //TODO update textfields if (_isSecureText) { stfApplicationId.StringValue = item.ClientId; stfAuthority.StringValue = item.Authority; stfRedirectUri.StringValue = item.RedirectUri; stfResourceId.StringValue = item.ResourceId; tfExtraParameters.StringValue = item.ExtraParameters; } else { tfApplicationId.StringValue = item.ClientId; tfAuthority.StringValue = item.Authority; tfRedirectUri.StringValue = item.RedirectUri; tfResourceId.StringValue = item.ResourceId; } var index = MacEndpointService.Instance.GetEnvironments().IndexOf(_currentEndpoint.Title); cbEnvironments.SelectItem(index); tfName.StringValue = item.Name; tfExtraParameters.StringValue = item.ExtraParameters; }
partial void SaveForm(NSObject sender) { try { if (_currentEndpoint == null || _currentEndpoint?.Environment == null && !string.IsNullOrEmpty(tfName.StringValue)) { //var selectedEnvironment = cbEnvironments.SelectedValue; //if (selectedEnvironment != null) //{ MacEndpoint newEndpoint = new MacEndpoint() { Environment = CoreLib.Authentication.Environment.Dev }; newEndpoint.Name = tfName.StringValue; newEndpoint.ExtraParameters = tfExtraParameters.StringValue; if (_isSecureText) { newEndpoint.ClientId = stfApplicationId.StringValue; newEndpoint.Authority = stfAuthority.StringValue; newEndpoint.EnableLogging = true; newEndpoint.RedirectUri = stfRedirectUri.StringValue; newEndpoint.ResourceId = stfResourceId.StringValue; } else { newEndpoint.ClientId = tfApplicationId.StringValue; newEndpoint.Authority = tfAuthority.StringValue; newEndpoint.EnableLogging = true; newEndpoint.RedirectUri = tfRedirectUri.StringValue; newEndpoint.ResourceId = tfResourceId.StringValue; } Messaging.Instance.Publish <MacEndpoint>(Messages.SaveMacendpoint, newEndpoint); _currentEndpoint = newEndpoint; } else { //todo update existing endpoint } //} } catch (Exception ex) { Console.WriteLine($"Message: {ex.Message} Stacktrace: {ex.StackTrace}"); } }
partial void ClearForm(NSObject sender) { this.tfName.StringValue = string.Empty; this.stfApplicationId.StringValue = string.Empty; this.tfApplicationId.StringValue = string.Empty; this.stfAuthority.StringValue = string.Empty; this.tfAuthority.StringValue = string.Empty; this.tfExtraParameters.StringValue = string.Empty; this.stfRedirectUri.StringValue = string.Empty; this.stfResourceId.StringValue = string.Empty; this.tfName.StringValue = string.Empty; this.tfRedirectUri.StringValue = string.Empty; this.tfResourceId.StringValue = string.Empty; _currentEndpoint = null; Messaging.Instance.Publish(Messages.DeselectEndpoint); }
private void SaveEndpoint(MacEndpoint macEndpoint) { MacEndpointService.Instance.AddEndpoint(macEndpoint); ovEnvironments.ReloadData(); }