Exemplo n.º 1
0
	protected void OnSpouseSelect(object sender, SpouseSelectArgs e)
	{
		IndividualListDialog listDialog = new IndividualListDialog();
		
		SpouseListModel listModel = new SpouseListModel();
		
		if (sender is Gtk.Dialog)
		{
			listDialog.TransientFor = (Gtk.Window)sender;
		}
		else
		{
			listDialog.TransientFor = this;
		}
				
		listModel.Database = _database;
		listModel.Record = e.Indi;
		
		listDialog.Title = "Select Spouse";
		listDialog.List.ListModel = listModel;
		listDialog.Database = _database;
		listDialog.Record = e.Indi;
		
		listDialog.Modal = true;
		
		int response = listDialog.Run();
		
		if (response == (int)Gtk.ResponseType.Apply)
		{
			if (listDialog.Record != e.Indi)
			{
				e.SelectedSpouse = listDialog.Record as GedcomIndividualRecord;
				e.Family = listModel.GetFamily(e.SelectedSpouse.XRefID);
			}
		}
		else if (response == (int)Gtk.ResponseType.Ok)
		{
			// Create new indi
			GedcomIndividualRecord indi = new GedcomIndividualRecord(_database);
			GedcomFamilyRecord fam = new GedcomFamilyRecord(_database, e.Indi, indi);
	
			e.SelectedSpouse = indi;
			e.Family = fam;
		}
		
		listDialog.Destroy();
	}
Exemplo n.º 2
0
		protected virtual void OnWifeFamiliesButton_Clicked(object sender, System.EventArgs e)
		{
			SpouseSelectArgs args = new SpouseSelectArgs();
			args.Indi = _wife;
			args.Spouse = _husband;
			
			SaveView();
			
			if (SpouseSelect != null)
			{
				SpouseSelect(this,args);
				
				if (args.SelectedSpouse != null)
				{
					if (_record == _husband)
					{
						_record = args.SelectedSpouse;	
					}
					
					_famRecord = args.Family;
					_husband = args.SelectedSpouse;
					FillView();
				}
			}
		}