public void OnAssertUpdate(object sender, EventArgs e)
 {
     if (AssertTableView.SelectedRows != null && (int)AssertTableView.SelectedRows.Count > 0)
     {
         var row = (int)AssertTableView.SelectedRows.FirstIndex;
         var dto = RelyingPartyDto.AssertionConsumerServices [row];
         NSApplication.SharedApplication.StopModal();
         var defaultExists = RelyingPartyDto.AssertionConsumerServices.Exists(x => x.IsDefault);
         var form          = new AddNewAssertionConsumerServiceController()
         {
             DefaultSet = defaultExists, AssertionConsumerServiceDto = dto
         };
         NSApplication.SharedApplication.RunModalForWindow(form.Window);
         if (form.IsUpdated != null)
         {
             RelyingPartyDto.AssertionConsumerServices.RemoveAt(row);
             RelyingPartyDto.AssertionConsumerServices.Add(form.AssertionConsumerServiceDto);
             var datasource = new AssertionConsumerServiceDataSource {
                 Entries = RelyingPartyDto.AssertionConsumerServices
             };
             AssertTableView.DataSource = datasource;
             AssertTableView.ReloadData();
         }
     }
 }
        public void OnAddAssertServices(object sender, EventArgs e)
        {
            NSApplication.SharedApplication.StopModal();
            var defaultExists = RelyingPartyDto.AssertionConsumerServices.Exists(x => x.IsDefault);
            var form          = new AddNewAssertionConsumerServiceController()
            {
                DefaultSet = defaultExists
            };

            NSApplication.SharedApplication.RunModalForWindow(form.Window);
            if (form.AssertionConsumerServiceDto != null)
            {
                RelyingPartyDto.AssertionConsumerServices.Add(form.AssertionConsumerServiceDto);
                var datasource = new AssertionConsumerServiceDataSource {
                    Entries = RelyingPartyDto.AssertionConsumerServices
                };
                AssertTableView.DataSource = datasource;
                AssertTableView.ReloadData();
            }
        }
		public void OnAddAssertServices (object sender, EventArgs e)
		{
			NSApplication.SharedApplication.StopModal ();
			var defaultExists = RelyingPartyDto.AssertionConsumerServices.Exists (x => x.IsDefault);
			var form = new AddNewAssertionConsumerServiceController (){ DefaultSet = defaultExists };
			NSApplication.SharedApplication.RunModalForWindow (form.Window);
			if (form.AssertionConsumerServiceDto != null) {
				RelyingPartyDto.AssertionConsumerServices.Add (form.AssertionConsumerServiceDto);
				var datasource = new AssertionConsumerServiceDataSource { Entries = RelyingPartyDto.AssertionConsumerServices };
				AssertTableView.DataSource = datasource;
				AssertTableView.ReloadData ();
			}
		}
		public void OnAssertUpdate (object sender, EventArgs e)
		{
			if (AssertTableView.SelectedRows != null && (int)AssertTableView.SelectedRows.Count > 0) {
				var row = (int)AssertTableView.SelectedRows.FirstIndex;
				var dto = RelyingPartyDto.AssertionConsumerServices [row];
				NSApplication.SharedApplication.StopModal ();
				var defaultExists = RelyingPartyDto.AssertionConsumerServices.Exists (x => x.IsDefault);
				var form = new AddNewAssertionConsumerServiceController (){ DefaultSet = defaultExists, AssertionConsumerServiceDto = dto };
				NSApplication.SharedApplication.RunModalForWindow (form.Window);
				if (form.IsUpdated != null) {
					RelyingPartyDto.AssertionConsumerServices.RemoveAt (row);
					RelyingPartyDto.AssertionConsumerServices.Add (form.AssertionConsumerServiceDto);
					var datasource = new AssertionConsumerServiceDataSource { Entries = RelyingPartyDto.AssertionConsumerServices };
					AssertTableView.DataSource = datasource;
					AssertTableView.ReloadData ();
				}
			}
		}