コード例 #1
0
		public override void AwakeFromNib ()
		{
			base.AwakeFromNib ();
			IsUpdated = false;

			//Events
			this.BtnAdd.Activated += (object sender, EventArgs e) => {
				if(string.IsNullOrEmpty(TxtName.StringValue))
				{
					UIErrorHelper.ShowAlert ("Name has invalid value", "Alert");
				} else if(string.IsNullOrEmpty(TxtBinding.StringValue))
				{
					UIErrorHelper.ShowAlert ("Binding has invalid value", "Alert");
				} else if(string.IsNullOrEmpty(TxtEndpoint.StringValue))
				{
					UIErrorHelper.ShowAlert ("Endpoint has invalid value", "Alert");
				} 
				else
				{
					ServiceEndpointDto = new ServiceEndpointDto
					{
						Name = TxtName.StringValue,
						Binding = TxtBinding.StringValue,
						Endpoint = TxtEndpoint.StringValue
					};
					IsUpdated = true;
					this.Close ();
					NSApplication.SharedApplication.StopModalWithCode (0);
				}
			};
			this.BtnClose.Activated += (object sender, EventArgs e) => {
				this.Close ();
				NSApplication.SharedApplication.StopModalWithCode (0);
			};

			if (ServiceEndpointDto != null) {
				TxtName.StringValue = ServiceEndpointDto.Name;
				TxtEndpoint.StringValue = ServiceEndpointDto.Endpoint;
				TxtBinding.StringValue = ServiceEndpointDto.Binding;
			}
		}
		private void OnAddSloServices (object sender, EventArgs e)
		{
			if (IsSloServiceValid ()) {
				var endpointDto = new ServiceEndpointDto {
					Name = TxtSloName.StringValue,
					Endpoint = TxtSloEndpoint.StringValue,
					Binding = TxtSloBinding.StringValue
				};
				ExternalIdentityProviderDto.SloServices.Add(endpointDto);
				var datasource = new ServiceEndpointDataSource { Entries = ExternalIdentityProviderDto.SloServices };
				LstSlo.DataSource = datasource;
				LstSlo.ReloadData ();
				TxtSloName.StringValue = (NSString)string.Empty;
				TxtSloEndpoint.StringValue = (NSString)string.Empty;
				TxtSloBinding.StringValue = (NSString)string.Empty;
			}
		}