示例#1
0
		protected virtual void OnSelectMasterSourceButton_Click(object sender, System.EventArgs e)
		{
			if (SelectMasterSource != null)
			{
				SourceArgs args = new SourceArgs();
				SelectMasterSource(this, args);
				if (args.Source != null)
				{
					if (_masterSource != null)
					{
						_masterSource.Citations.Remove((GedcomSourceCitation)_record);
					}
					_masterSource = args.Source;
					_masterSource.Citations.Add((GedcomSourceCitation)_record);
					MasterSourceEntry.Text = _masterSource.Title;
				}
			}
		}
		protected void OnSelectMasterSource(object sender, SourceArgs e)
		{
			SourceListDialog listDialog = new SourceListDialog();
		
			listDialog.Database = Database;
			listDialog.Record = Record;
			
			int response = listDialog.Run();
			
			switch (response)
			{
				case (int)Gtk.ResponseType.Apply:
					e.Source = listDialog.Record as GedcomSourceRecord;
					break;
				case (int)Gtk.ResponseType.Ok:
					// Create new source
					e.Source = new GedcomSourceRecord(Database);								
					break;
			}
			
			listDialog.Destroy();
		}