Exemplo n.º 1
0
        public override bool Accept()
        {
            try {
                fBase.Context.Tree.Header.Language = GEDCOMUtils.GetLanguageVal(fView.Language.Text);

                GDMSubmitterRecord submitter = fBase.Context.Tree.GetSubmitter();
                submitter.Name.StringValue = fView.Name.Text;
                submitter.Address.SetAddressArray(fView.Address.Lines);

                if (submitter.Address.PhoneNumbers.Count > 0)
                {
                    submitter.Address.PhoneNumbers[0].StringValue = fView.Tel.Text;
                }
                else
                {
                    submitter.Address.AddPhoneNumber(fView.Tel.Text);
                }

                fBase.NotifyRecord(submitter, RecordAction.raEdit);

                return(true);
            } catch (Exception ex) {
                Logger.WriteError("FilePropertiesDlgController.Accept()", ex);
                return(false);
            }
        }
Exemplo n.º 2
0
        public void Test_EnterDataAndApply()
        {
            var txtName = new TextBoxTester("txtName");

            txtName.Enter("sample text");
            Assert.AreEqual("sample text", txtName.Text);

            ClickButton("btnAccept", fDialog);

            GDMSubmitterRecord submitter = fBase.Context.Tree.GetPtrValue <GDMSubmitterRecord>(fBase.Context.Tree.Header.Submitter);

            Assert.AreEqual("sample text", submitter.Name.StringValue);
        }
Exemplo n.º 3
0
        public static void FilePropertiesDlg_btnAccept_Handler(string name, IntPtr ptr, Form form)
        {
            FilePropertiesDlg dlg         = (FilePropertiesDlg)form;
            IBaseContext      baseContext = dlg.Base.Context;

            EnterText("txtName", form, "sample text");

            SetModalFormHandler(fFormTest, LanguageEditDlgTests.LanguageEditDlg_Handler);
            ClickButton("btnLangEdit", form);

            ClickButton("btnAccept", form);

            GDMSubmitterRecord submitter = baseContext.Tree.GetPtrValue <GDMSubmitterRecord>(baseContext.Tree.Header.Submitter);

            Assert.AreEqual("sample text", submitter.Name.StringValue);
        }
Exemplo n.º 4
0
        public void Test_GedML()
        {
            using (BaseContext ctx = new BaseContext(null)) {
                using (Stream stmGed1 = TestUtils.LoadResourceStream("test_gedml.xml")) {
                    var gedmlProvider = new GedMLProvider(ctx.Tree);
                    gedmlProvider.LoadFromStreamExt(stmGed1, stmGed1);
                }

                GDMSubmitterRecord submRec = ctx.Tree.XRefIndex_Find("SUB1") as GDMSubmitterRecord;
                Assert.IsNotNull(submRec);
                Assert.AreEqual("Michael Kay", submRec.Name.FullName);

                GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord;
                Assert.IsNotNull(iRec1);
                //Assert.AreEqual("John Smith", iRec1.GetPrimaryFullName());
            }
        }
Exemplo n.º 5
0
        public override void UpdateView()
        {
            fView.Language.Text = GEDCOMUtils.GetLanguageStr(fBase.Context.Tree.Header.Language);

            GDMSubmitterRecord submitter = fBase.Context.Tree.GetSubmitter();

            fView.Name.Text    = submitter.Name.FullName;
            fView.Address.Text = submitter.Address.Lines.Text;

            if (submitter.Address.PhoneNumbers.Count > 0)
            {
                fView.Tel.Text = submitter.Address.PhoneNumbers[0].StringValue;
            }

            // update stats
            int[] stats = fBase.Context.Tree.GetRecordStats();
            fView.RecordStats.ClearItems();
            for (int i = 1; i < stats.Length; i++)
            {
                fView.RecordStats.AddItem(null, LangMan.LS(GKData.RecordTypes[i]), stats[i].ToString());
            }
        }