private Person CreateMartha(PlaceDescription birthPlace, PlaceDescription deathPlace) { Person person = new Person(); person.SetGender(new Gender(GenderType.Male)); Fact fact = new Fact(); fact.SetId("321"); fact.SetType(FactType.Birth); fact.SetDate(new DateInfo()); fact.Date.SetOriginal("June 2, 1731"); fact.Date.SetFormal("+1731-06-02"); fact.SetPlace(new PlaceReference()); fact.Place.SetOriginal(birthPlace.Names[0].Value.ToLower()); fact.Place.DescriptionRef = "#" + birthPlace.Id; person.AddFact(fact); fact = new Fact(); fact.SetId("654"); fact.SetType(FactType.Death); fact.SetDate(new DateInfo()); fact.Date.SetOriginal("May 22, 1802"); fact.Date.SetFormal("+1802-05-22"); fact.SetPlace(new PlaceReference()); fact.Place.SetOriginal(deathPlace.Names[0].Value.ToLower()); fact.Place.DescriptionRef = "#" + deathPlace.Id; person.AddFact(fact); List <Name> names = new List <Name>(); Name name = new Name(); NameForm nameForm = new NameForm(); nameForm.SetFullText("Martha Dandridge Custis"); List <NamePart> parts = new List <NamePart>(); NamePart part = new NamePart(); part.SetType(NamePartType.Given); part.SetValue("Martha Dandridge"); parts.Add(part); part = new NamePart(); part.SetType(NamePartType.Surname); part.SetValue("Custis"); parts.Add(part); nameForm.Parts = parts; name.SetNameForm(nameForm); name.SetId("987"); names.Add(name); person.Names = names; person.SetId("CCC-CCCC"); return(person); }
private Person CreateGeorge(PlaceDescription birthPlace, PlaceDescription deathPlace) { Person person = new Person(); person.SetGender(new Gender(GenderType.Male)); Fact fact = new Fact(); fact.SetId("123"); fact.SetType(FactType.Birth); fact.SetDate(new DateInfo()); fact.Date.SetOriginal("February 22, 1732"); fact.Date.SetFormal("+1732-02-22"); fact.SetPlace(new PlaceReference()); fact.Place.SetOriginal(birthPlace.Names[0].Value.ToLower()); fact.Place.DescriptionRef = "#" + birthPlace.Id; person.AddFact(fact); fact = new Fact(); fact.SetId("456"); fact.SetType(FactType.Death); fact.SetDate(new DateInfo()); fact.Date.SetOriginal("December 14, 1799"); fact.Date.SetFormal("+1799-12-14T22:00:00"); fact.SetPlace(new PlaceReference()); fact.Place.SetOriginal(deathPlace.Names[0].Value.ToLower()); fact.Place.DescriptionRef = "#" + deathPlace.Id; person.AddFact(fact); List <Name> names = new List <Name>(); Name name = new Name(); NameForm nameForm = new NameForm(); nameForm.SetFullText("George Washington"); List <NamePart> parts = new List <NamePart>(); NamePart part = new NamePart(); part.SetType(NamePartType.Given); part.SetValue("George"); parts.Add(part); part = new NamePart(); part.SetType(NamePartType.Surname); part.SetValue("Washington"); parts.Add(part); nameForm.Parts = parts; name.SetNameForm(nameForm); name.SetId("789"); names.Add(name); person.Names = names; person.SetId("BBB-BBBB"); return(person); }
public void EndGame(bool win) { OpenMinedCells(); var endGame = new EndGame(); var time = view.EndGame(); endGame.SetTime(time); endGame.SetGameResult(win); var result = endGame.ShowDialog(); var lastResult = highScores.GetLastResult(settings.Level); if (win && settings.Level != Settings.Levels.Special && (lastResult >= time || lastResult == -1)) { var nameForm = new NameForm(); var name = nameForm.GetName(); WriteToFile(Convert.ToString(time) + '—' + DateTime.Now.ToShortDateString() + '—' + name, $"..\\..\\Resources\\highScores{settings.Level}.txt"); } if (result == DialogResult.Yes) { SetSettings(Settings.Levels.This); } else if (result == DialogResult.No) { Application.Exit(); } }
public void TestPatronymic() { NameForm nameForm = new NameForm("Björk Guðmundsdóttir") .SetLang("is") .SetPart(NamePartType.Given, "Björk") .SetPart(new NamePart().SetValue("Guðmundsdóttir").SetQualifier(new Qualifier(NamePartQualifierType.Patronymic))); Name name = new Name().SetNameForm(nameForm); Gx.Gedcomx gx = new Gx.Gedcomx().SetPerson(new Person().SetName(name)); xmlSerializer.Deserialize <Gx.Gedcomx>(xmlSerializer.Serialize(gx)); jsonSerializer.Deserialize <Gx.Gedcomx>(jsonSerializer.Serialize(gx)); }
public void TestMultipleNamePartsOnePartPerType() { NameForm nameForm = new NameForm("José Eduardo Santos Tavares Melo Silva") .SetLang("pt-BR") .SetPart(NamePartType.Given, "José Eduardo") .SetPart(NamePartType.Surname, "Santos Tavares Melo Silva"); Name name = new Name().SetNameForm(nameForm); Gx.Gedcomx gx = new Gx.Gedcomx().SetPerson(new Person().SetName(name)); xmlSerializer.Deserialize <Gx.Gedcomx>(xmlSerializer.Serialize(gx)); jsonSerializer.Deserialize <Gx.Gedcomx>(jsonSerializer.Serialize(gx)); }
public void TestBasicWesternName() { NameForm nameForm = new NameForm("John Fitzgerald Kennedy") .SetLang("en") .SetPart(NamePartType.Given, "John") .SetPart(NamePartType.Given, "Fitzgerald") .SetPart(NamePartType.Surname, "Kennedy"); Name name = new Name().SetNameForm(nameForm); Gx.Gedcomx gx = new Gx.Gedcomx().SetPerson(new Person().SetName(name)); xmlSerializer.Deserialize <Gx.Gedcomx>(xmlSerializer.Serialize(gx)); jsonSerializer.Deserialize <Gx.Gedcomx>(jsonSerializer.Serialize(gx)); }
public AdvReportSectionFiltersForm() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // this.Load += new EventHandler(CustomSectionFiltersForm_Load); this._SaveFileDialog = new NameForm(); this._PropertyForm = new PropertyForm(); }
/// <summary> /// Visits the name form. /// </summary> /// <param name="form">The name form to visit.</param> public virtual void VisitNameForm(NameForm form) { this.contextStack.Push(form); if (form.Parts != null) { foreach (NamePart part in form.Parts) { VisitNamePart(part); } } if (form.Fields != null) { foreach (Field field in form.Fields) { VisitField(field); } } this.contextStack.Pop(); }
public void TestMultipleJapaneseForms() { NameForm kanji = new NameForm("山田太郎") .SetLang("ja-Hani") .SetPart(NamePartType.Surname, "山田") .SetPart(NamePartType.Given, "太郎"); NameForm katakana = new NameForm("ヤマダタロー") .SetLang("ja-Kana") .SetPart(NamePartType.Surname, "ヤマダ") .SetPart(NamePartType.Given, "タロー"); NameForm romanized = new NameForm("Yamada Tarō") .SetLang("ja-Latn") .SetPart(NamePartType.Surname, "Tarō") .SetPart(NamePartType.Given, "Yamada"); Name name = new Name().SetNameForm(kanji).SetNameForm(katakana).SetNameForm(romanized); Gx.Gedcomx gx = new Gx.Gedcomx().SetPerson(new Person().SetName(name)); xmlSerializer.Deserialize <Gx.Gedcomx>(xmlSerializer.Serialize(gx)); jsonSerializer.Deserialize <Gx.Gedcomx>(jsonSerializer.Serialize(gx)); }
public CustomSectionFiltersForm(SectionFilterCollection sections, WebbDBTypes webbDBTypes) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // _InitSectionFilters = sections; _WebbDBTypes = webbDBTypes; this.Load += new EventHandler(CustomSectionFiltersForm_Load); this._SaveFileDialog = new NameForm(); //this._PropertyForm = new PropertyForm(); }
//Event that triggers to start the game. Cannot be used if game is already running private void newGameToolStripMenuItem_Click(object sender, EventArgs e) { if (_gameRunning) { return; } var frm = new NameForm(); if (frm.ShowDialog() != DialogResult.OK) { return; } _gameRunning = true; _playerName = frm.PlayerName; preview.Visible = true; Initialize(); SetCurrent(); timerGame.Start(); timerDrop.Start(); Grid.Instance.AddShape(_currentShape); Refresh(); }
public virtual void VisitNameForm(NameForm form) { this.contextStack.Push(form); List <NamePart> parts = form.Parts; if (parts != null) { foreach (NamePart part in parts) { part.Accept(this); } } List <Field> fields = form.Fields; if (fields != null) { foreach (Field field in fields) { field.Accept(this); } } this.contextStack.Pop(); }
// Method to show NameForm private void InsertScore() { nameForm = new NameForm(); this.nameForm.ShowDialog(); game.SaveScore(nameForm.Name, game.Score); }
public override void VisitNameForm(NameForm form) { BindIfNeeded(form); base.VisitNameForm(form); }