public void CreateLocationRecord()
        {
            PlaceObj pObj = fView.PlacesList.GetSelectedData() as PlaceObj;

            if (pObj == null)
            {
                return;
            }

            if (pObj.Name.IndexOf("[*]") == 0)
            {
                AppHost.StdDialogs.ShowMessage(LangMan.LS(LSID.LSID_PlaceAlreadyInBook));
            }
            else
            {
                GEDCOMLocationRecord loc = fBase.Context.SelectRecord(GEDCOMRecordType.rtLocation, new object[] { pObj.Name }) as GEDCOMLocationRecord;
                if (loc == null)
                {
                    return;
                }

                int num = pObj.Facts.Count;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMCustomEvent evt = pObj.Facts[i];
                    evt.Place.StringValue    = loc.LocationName;
                    evt.Place.Location.Value = loc;
                }

                CheckPlaces();
                fBase.RefreshLists(false);
            }
        }
        public EventEditDlgController(IEventEditDlg view) : base(view)
        {
            fTempLocation = null;

            int num = GKData.DateKinds.Length;

            for (int i = 0; i < num; i++)
            {
                fView.EventDateType.Add(LangMan.LS(GKData.DateKinds[i].Name));
            }

            for (GEDCOMCalendar gc = GEDCOMCalendar.dcGregorian; gc <= GEDCOMCalendar.dcLast; gc++)
            {
                GKData.CalendarStruct cdr = GKData.DateCalendars[(int)gc];
                if (!cdr.HasSupport)
                {
                    continue;
                }

                fView.Date1Calendar.AddItem(LangMan.LS(cdr.Name), gc);
                fView.Date2Calendar.AddItem(LangMan.LS(cdr.Name), gc);
            }

            fView.Date1Calendar.SelectedIndex = 0;
            fView.Date2Calendar.SelectedIndex = 0;

            fView.EventType.Activate();
        }
Esempio n. 3
0
        public int gt_get_location_usages(object recPtr)
        {
            GEDCOMLocationRecord loc = recPtr as GEDCOMLocationRecord;

            if (loc == null)
            {
                return(-1);
            }

            int usages;

            StringList linkList = null;

            try
            {
                linkList = GKUtils.GetLocationLinks(fBase.Context.Tree, loc);
                usages   = linkList.Count;
            }
            finally
            {
                if (linkList != null)
                {
                    linkList.Dispose();
                }
            }

            return(usages);
        }
Esempio n. 4
0
        public EventEditDlg()
        {
            InitializeComponent();

            btnAccept.Image      = GKResources.iBtnAccept;
            btnCancel.Image      = GKResources.iBtnCancel;
            btnPlaceAdd.Image    = GKResources.iRecNew;
            btnPlaceDelete.Image = GKResources.iRecDelete;

            int num = GKData.DateKinds.Length;

            for (int i = 0; i < num; i++)
            {
                cmbEventDateType.Items.Add(LangMan.LS(GKData.DateKinds[i].Name));
            }

            for (GEDCOMCalendar gc = GEDCOMCalendar.dcGregorian; gc <= GEDCOMCalendar.dcLast; gc++)
            {
                GKData.CalendarStruct cdr = GKData.DateCalendars[(int)gc];
                if (!cdr.HasSupport)
                {
                    continue;
                }

                cmbDate1Calendar.Items.Add(new GKComboItem(LangMan.LS(cdr.Name), gc));
                cmbDate2Calendar.Items.Add(new GKComboItem(LangMan.LS(cdr.Name), gc));
            }

            cmbDate1Calendar.SelectedIndex = 0;
            cmbDate2Calendar.SelectedIndex = 0;

            fLocation = null;

            fNotesList   = new GKSheetList(pageNotes);
            fMediaList   = new GKSheetList(pageMultimedia);
            fSourcesList = new GKSheetList(pageSources);

            // SetLang()
            Text                = LangMan.LS(LSID.LSID_Event);
            btnAccept.Text      = LangMan.LS(LSID.LSID_DlgAccept);
            btnCancel.Text      = LangMan.LS(LSID.LSID_DlgCancel);
            btnAddress.Text     = LangMan.LS(LSID.LSID_Address) + @"...";
            pageCommon.Text     = LangMan.LS(LSID.LSID_Common);
            pageNotes.Text      = LangMan.LS(LSID.LSID_RPNotes);
            pageMultimedia.Text = LangMan.LS(LSID.LSID_RPMultimedia);
            pageSources.Text    = LangMan.LS(LSID.LSID_RPSources);
            lblEvent.Text       = LangMan.LS(LSID.LSID_Event);
            lblAttrValue.Text   = LangMan.LS(LSID.LSID_Value);
            lblPlace.Text       = LangMan.LS(LSID.LSID_Place);
            lblDate.Text        = LangMan.LS(LSID.LSID_Date);
            lblCause.Text       = LangMan.LS(LSID.LSID_Cause);
            lblOrg.Text         = LangMan.LS(LSID.LSID_Agency);

            toolTip1.SetToolTip(btnPlaceAdd, LangMan.LS(LSID.LSID_PlaceAddTip));
            toolTip1.SetToolTip(btnPlaceDelete, LangMan.LS(LSID.LSID_PlaceDeleteTip));
        }
Esempio n. 5
0
        private void SetLocationRecord(GEDCOMLocationRecord value)
        {
            fLocationRecord   = value;
            txtName.Text      = fLocationRecord.LocationName;
            txtLatitude.Text  = PlacesLoader.CoordToStr(fLocationRecord.Map.Lati);
            txtLongitude.Text = PlacesLoader.CoordToStr(fLocationRecord.Map.Long);

            fNotesList.ListModel.DataOwner = fLocationRecord;
            fMediaList.ListModel.DataOwner = fLocationRecord;

            txtName.Focus();
        }
Esempio n. 6
0
        private void AddPlace(GEDCOMPlace place, GEDCOMCustomEvent placeEvent)
        {
            try
            {
                GEDCOMLocationRecord locRec = place.Location.Value as GEDCOMLocationRecord;

                string placeName = (locRec != null) ? locRec.LocationName : place.StringValue;

                var      node = FindTreeNode(placeName);
                MapPlace mapPlace;

                if (node == null)
                {
                    mapPlace      = new MapPlace();
                    mapPlace.Name = placeName;
                    fPlaces.Add(mapPlace);

                    node = new GKTreeNode(placeName, mapPlace);
                    fBaseRoot.Children.Add(node);

                    if (locRec == null)
                    {
                        AppHost.Instance.RequestGeoCoords(placeName, mapPlace.Points);

                        int num = mapPlace.Points.Count;
                        for (int i = 0; i < num; i++)
                        {
                            GeoPoint pt      = mapPlace.Points[i];
                            string   ptTitle = pt.Hint + string.Format(" [{0:0.000000}, {1:0.000000}]", pt.Latitude, pt.Longitude);
                            node.Children.Add(new GKTreeNode(ptTitle, pt));
                        }
                    }
                    else
                    {
                        GeoPoint pt = new GeoPoint(locRec.Map.Lati, locRec.Map.Long, placeName);
                        mapPlace.Points.Add(pt);

                        string ptTitle = pt.Hint + string.Format(" [{0:0.000000}, {1:0.000000}]", pt.Latitude, pt.Longitude);
                        node.Children.Add(new GKTreeNode(ptTitle, pt));
                    }
                }
                else
                {
                    mapPlace = (((GKTreeNode)node).Tag as MapPlace);
                }

                mapPlace.PlaceRefs.Add(new PlaceRef(placeEvent));
            } catch (Exception ex) {
                Logger.LogWrite("MapsViewerWin.AddPlace(): " + ex.Message);
            }
        }
Esempio n. 7
0
        public static bool ModifyLocation(IBaseWindow baseWin, ref GEDCOMLocationRecord locRec)
        {
            bool result;

            try {
                baseWin.Context.BeginUpdate();
                GEDCOMTree tree = baseWin.Context.Tree;

                using (var dlg = AppHost.Container.Resolve <ILocationEditDlg>())
                {
                    dlg.InitDialog(baseWin);

                    bool exists = locRec != null;
                    if (!exists)
                    {
                        locRec = new GEDCOMLocationRecord(tree, tree, "", "");
                        locRec.InitNew();
                    }

                    try {
                        baseWin.Context.LockRecord(locRec);

                        dlg.LocationRecord = locRec;
                        result             = AppHost.Instance.ShowModalX(dlg, false);
                    } finally {
                        baseWin.Context.UnlockRecord(locRec);
                    }

                    if (!exists)
                    {
                        if (result)
                        {
                            tree.AddRecord(locRec);
                        }
                        else
                        {
                            locRec.Dispose();
                            locRec = null;
                        }
                    }
                }
            } finally {
                baseWin.Context.EndUpdate();
            }

            return(result);
        }
Esempio n. 8
0
        private void ListPlaces_DblClick(object sender, EventArgs e)
        {
            GKListItem item = ListPlaces.GetSelectedItem();

            if (item == null)
            {
                return;
            }

            PlaceObj pObj = item.Data as PlaceObj;

            if (pObj == null)
            {
                return;
            }

            if (pObj.Name.IndexOf("[*]") == 0)
            {
                AppHost.StdDialogs.ShowMessage(LangMan.LS(LSID.LSID_PlaceAlreadyInBook));
            }
            else
            {
                GEDCOMLocationRecord loc = fBase.Context.SelectRecord(GEDCOMRecordType.rtLocation, new object[] { pObj.Name }) as GEDCOMLocationRecord;
                if (loc == null)
                {
                    return;
                }

                int num = pObj.Facts.Count;
                for (int i = 0; i < num; i++)
                {
                    GEDCOMCustomEvent evt = pObj.Facts[i];
                    evt.Place.StringValue    = loc.LocationName;
                    evt.Place.Location.Value = loc;
                }

                CheckPlaces();
                Base.RefreshLists(false);
            }
        }
Esempio n. 9
0
        public void Test_LMLocation()
        {
            var listManager = new LocationListMan(fContext);

            Assert.IsNotNull(listManager);

            GEDCOMLocationRecord locRec = fContext.Tree.XRefIndex_Find("L1") as GEDCOMLocationRecord;

            listManager.Fetch(locRec);

            listManager.QuickFilter = "*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*locat*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*xxxx*";
            Assert.IsFalse(listManager.CheckFilter());

            var lvMock = new ListViewMock();

            listManager.UpdateColumns(lvMock);
            var listItem = new GKListItem("", null);

            listManager.UpdateItem(0, listItem, locRec);
        }
Esempio n. 10
0
 public override void Fetch(GEDCOMRecord aRec)
 {
     fRec = (aRec as GEDCOMLocationRecord);
 }
Esempio n. 11
0
        public static bool EditRecord(IBaseWindow baseWin, GEDCOMRecord rec)
        {
            bool result = false;

            switch (rec.RecordType)
            {
            case GEDCOMRecordType.rtIndividual:
                GEDCOMIndividualRecord ind = rec as GEDCOMIndividualRecord;
                result = ModifyIndividual(baseWin, ref ind, null, TargetMode.tmNone, GEDCOMSex.svNone);
                break;

            case GEDCOMRecordType.rtFamily:
                GEDCOMFamilyRecord fam = rec as GEDCOMFamilyRecord;
                result = ModifyFamily(baseWin, ref fam, TargetMode.tmNone, null);
                break;

            case GEDCOMRecordType.rtNote:
                GEDCOMNoteRecord note = rec as GEDCOMNoteRecord;
                result = ModifyNote(baseWin, ref note);
                break;

            case GEDCOMRecordType.rtMultimedia:
                GEDCOMMultimediaRecord mmRec = rec as GEDCOMMultimediaRecord;
                result = ModifyMedia(baseWin, ref mmRec);
                break;

            case GEDCOMRecordType.rtSource:
                GEDCOMSourceRecord src = rec as GEDCOMSourceRecord;
                result = ModifySource(baseWin, ref src);
                break;

            case GEDCOMRecordType.rtRepository:
                GEDCOMRepositoryRecord rep = rec as GEDCOMRepositoryRecord;
                result = ModifyRepository(baseWin, ref rep);
                break;

            case GEDCOMRecordType.rtGroup:
                GEDCOMGroupRecord grp = rec as GEDCOMGroupRecord;
                result = ModifyGroup(baseWin, ref grp);
                break;

            case GEDCOMRecordType.rtResearch:
                GEDCOMResearchRecord rsr = rec as GEDCOMResearchRecord;
                result = ModifyResearch(baseWin, ref rsr);
                break;

            case GEDCOMRecordType.rtTask:
                GEDCOMTaskRecord tsk = rec as GEDCOMTaskRecord;
                result = ModifyTask(baseWin, ref tsk);
                break;

            case GEDCOMRecordType.rtCommunication:
                GEDCOMCommunicationRecord comm = rec as GEDCOMCommunicationRecord;
                result = ModifyCommunication(baseWin, ref comm);
                break;

            case GEDCOMRecordType.rtLocation:
                GEDCOMLocationRecord loc = rec as GEDCOMLocationRecord;
                result = ModifyLocation(baseWin, ref loc);
                break;
            }

            return(result);
        }
Esempio n. 12
0
 private void btnPlaceDelete_Click(object sender, EventArgs e)
 {
     fLocation = null;
     ControlsRefresh();
 }
Esempio n. 13
0
 private void btnPlaceAdd_Click(object sender, EventArgs e)
 {
     fLocation = (fBase.Context.SelectRecord(GEDCOMRecordType.rtLocation, null) as GEDCOMLocationRecord);
     ControlsRefresh();
 }
Esempio n. 14
0
        private void SetEvent(GEDCOMCustomEvent value)
        {
            fEvent = value;

            if (fEvent is GEDCOMFamilyEvent)
            {
                int num = GKData.FamilyEvents.Length;
                for (int i = 0; i < num; i++)
                {
                    cmbEventType.Items.Add(LangMan.LS(GKData.FamilyEvents[i].Name));
                }

                int idx = GKUtils.GetFamilyEventIndex(fEvent.Name);
                if (idx < 0)
                {
                    idx = 0;
                }
                cmbEventType.SelectedIndex = idx;
            }
            else
            {
                int num = GKData.PersonEvents.Length;
                for (int i = 0; i < num; i++)
                {
                    cmbEventType.Items.Add(LangMan.LS(GKData.PersonEvents[i].Name));
                }

                int idx = GKUtils.GetPersonEventIndex(fEvent.Name);
                if (idx < 0)
                {
                    idx = 0;
                }
                cmbEventType.SelectedIndex = idx;

                if (idx >= 0 && GKData.PersonEvents[idx].Kind == PersonEventKind.ekFact)
                {
                    txtAttribute.Text = fEvent.StringValue;
                }
            }

            EditEventType_SelectedIndexChanged(null, null);

            GEDCOMCustomDate date = fEvent.Date.Value;

            if (date is GEDCOMDateRange)
            {
                GEDCOMDateRange dtRange = date as GEDCOMDateRange;

                if (dtRange.After.StringValue == "" && dtRange.Before.StringValue != "")
                {
                    cmbEventDateType.SelectedIndex = 1;
                }
                else if (dtRange.After.StringValue != "" && dtRange.Before.StringValue == "")
                {
                    cmbEventDateType.SelectedIndex = 2;
                }
                else if (dtRange.After.StringValue != "" && dtRange.Before.StringValue != "")
                {
                    cmbEventDateType.SelectedIndex = 3;
                }

                txtEventDate1.Text = dtRange.After.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                txtEventDate2.Text = dtRange.Before.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                SetComboCalendar(cmbDate1Calendar, dtRange.After.DateCalendar);
                SetComboCalendar(cmbDate2Calendar, dtRange.Before.DateCalendar);
                btnBC1.Checked = dtRange.After.YearBC;
                btnBC2.Checked = dtRange.Before.YearBC;
            }
            else if (date is GEDCOMDatePeriod)
            {
                GEDCOMDatePeriod dtPeriod = date as GEDCOMDatePeriod;

                if (dtPeriod.DateFrom.StringValue != "" && dtPeriod.DateTo.StringValue == "")
                {
                    cmbEventDateType.SelectedIndex = 4;
                }
                else if (dtPeriod.DateFrom.StringValue == "" && dtPeriod.DateTo.StringValue != "")
                {
                    cmbEventDateType.SelectedIndex = 5;
                }
                else if (dtPeriod.DateFrom.StringValue != "" && dtPeriod.DateTo.StringValue != "")
                {
                    cmbEventDateType.SelectedIndex = 6;
                }

                txtEventDate1.Text = dtPeriod.DateFrom.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                txtEventDate2.Text = dtPeriod.DateTo.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                SetComboCalendar(cmbDate1Calendar, dtPeriod.DateFrom.DateCalendar);
                SetComboCalendar(cmbDate2Calendar, dtPeriod.DateTo.DateCalendar);
                btnBC1.Checked = dtPeriod.DateFrom.YearBC;
                btnBC2.Checked = dtPeriod.DateTo.YearBC;
            }
            else if (date is GEDCOMDate)
            {
                GEDCOMApproximated approximated = (date as GEDCOMDate).Approximated;

                switch (approximated)
                {
                case GEDCOMApproximated.daExact:
                    cmbEventDateType.SelectedIndex = 0;
                    break;

                case GEDCOMApproximated.daAbout:
                    cmbEventDateType.SelectedIndex = 7;
                    break;

                case GEDCOMApproximated.daCalculated:
                    cmbEventDateType.SelectedIndex = 8;
                    break;

                case GEDCOMApproximated.daEstimated:
                    cmbEventDateType.SelectedIndex = 9;
                    break;
                }

                txtEventDate1.Text = (date as GEDCOMDate).GetDisplayString(DateFormat.dfDD_MM_YYYY);
                SetComboCalendar(cmbDate1Calendar, (date as GEDCOMDate).DateCalendar);
                btnBC1.Checked = (date as GEDCOMDate).YearBC;
            }
            else
            {
                cmbEventDateType.SelectedIndex = 0;
                txtEventDate1.Text             = "";
                cmbDate1Calendar.SelectedIndex = 0;
                btnBC1.Checked = false;
            }

            EditEventDateType_SelectedIndexChanged(null, null);
            txtEventName.Text  = fEvent.Classification;
            txtEventCause.Text = fEvent.Cause;
            txtEventOrg.Text   = fEvent.Agency;
            fLocation          = (fEvent.Place.Location.Value as GEDCOMLocationRecord);

            fNotesList.ListModel.DataOwner   = fEvent;
            fMediaList.ListModel.DataOwner   = fEvent;
            fSourcesList.ListModel.DataOwner = fEvent;

            ControlsRefresh();

            ActiveControl = cmbEventType;
        }
Esempio n. 15
0
        public static GEDCOMRecord AddRecord(IBaseWindow baseWin, GEDCOMRecordType rt, Target target)
        {
            bool         result = false;
            GEDCOMRecord rec    = null;

            switch (rt)
            {
            case GEDCOMRecordType.rtIndividual:
            {
                // FIXME: legacy code, checkit
                if (target == null)
                {
                    target            = new Target();
                    target.TargetMode = TargetMode.tmParent;
                }

                GEDCOMIndividualRecord indivRec = null;
                result = ModifyIndividual(baseWin, ref indivRec, target.TargetIndividual, target.TargetMode, target.NeedSex);
                rec    = indivRec;
                break;
            }

            case GEDCOMRecordType.rtFamily:
            {
                if (target == null)
                {
                    target = new Target();
                }

                TargetMode famTarget = (target.TargetMode != TargetMode.tmFamilyChild) ? TargetMode.tmNone : target.TargetMode;

                GEDCOMFamilyRecord fam = null;
                result = ModifyFamily(baseWin, ref fam, famTarget, target.TargetIndividual);
                rec    = fam;
                break;
            }

            case GEDCOMRecordType.rtNote:
            {
                GEDCOMNoteRecord note = null;
                result = ModifyNote(baseWin, ref note);
                rec    = note;
                break;
            }

            case GEDCOMRecordType.rtMultimedia:
            {
                GEDCOMMultimediaRecord mmRec = null;
                result = ModifyMedia(baseWin, ref mmRec);
                rec    = mmRec;
                break;
            }

            case GEDCOMRecordType.rtSource:
            {
                GEDCOMSourceRecord src = null;
                result = ModifySource(baseWin, ref src);
                rec    = src;
                break;
            }

            case GEDCOMRecordType.rtRepository:
            {
                GEDCOMRepositoryRecord rep = null;
                result = ModifyRepository(baseWin, ref rep);
                rec    = rep;
                break;
            }

            case GEDCOMRecordType.rtGroup:
            {
                GEDCOMGroupRecord grp = null;
                result = ModifyGroup(baseWin, ref grp);
                rec    = grp;
                break;
            }

            case GEDCOMRecordType.rtResearch:
            {
                GEDCOMResearchRecord rsr = null;
                result = ModifyResearch(baseWin, ref rsr);
                rec    = rsr;
                break;
            }

            case GEDCOMRecordType.rtTask:
            {
                GEDCOMTaskRecord tsk = null;
                result = ModifyTask(baseWin, ref tsk);
                rec    = tsk;
                break;
            }

            case GEDCOMRecordType.rtCommunication:
            {
                GEDCOMCommunicationRecord comm = null;
                result = ModifyCommunication(baseWin, ref comm);
                rec    = comm;
                break;
            }

            case GEDCOMRecordType.rtLocation:
            {
                GEDCOMLocationRecord loc = null;
                result = ModifyLocation(baseWin, ref loc);
                rec    = loc;
                break;
            }
            }

            return((result) ? rec : null);
        }
        public override void UpdateView()
        {
            fView.NotesList.ListModel.DataOwner   = fEvent;
            fView.MediaList.ListModel.DataOwner   = fEvent;
            fView.SourcesList.ListModel.DataOwner = fEvent;

            if (fEvent is GEDCOMFamilyEvent)
            {
                SetEventTypes(GKData.FamilyEvents);
                int idx = GKUtils.GetFamilyEventIndex(fEvent.Name);
                if (idx < 0)
                {
                    idx = 0;
                }
                fView.EventType.SelectedIndex = idx;
            }
            else
            {
                SetEventTypes(GKData.PersonEvents);
                int idx = GKUtils.GetPersonEventIndex(fEvent.Name);
                if (idx < 0)
                {
                    idx = 0;
                }
                fView.EventType.SelectedIndex = idx;

                if (idx >= 0 && GKData.PersonEvents[idx].Kind == PersonEventKind.ekFact)
                {
                    fView.Attribute.Text = fEvent.StringValue;
                }
            }

            ChangeEventType();

            GEDCOMCustomDate date = fEvent.Date.Value;

            if (date is GEDCOMDateRange)
            {
                GEDCOMDateRange dtRange = date as GEDCOMDateRange;

                if (dtRange.After.StringValue == "" && dtRange.Before.StringValue != "")
                {
                    fView.EventDateType.SelectedIndex = 1;
                }
                else if (dtRange.After.StringValue != "" && dtRange.Before.StringValue == "")
                {
                    fView.EventDateType.SelectedIndex = 2;
                }
                else if (dtRange.After.StringValue != "" && dtRange.Before.StringValue != "")
                {
                    fView.EventDateType.SelectedIndex = 3;
                }

                fView.Date1.Text = dtRange.After.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date2.Text = dtRange.Before.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date1Calendar.SelectedTag = dtRange.After.DateCalendar;
                fView.Date2Calendar.SelectedTag = dtRange.Before.DateCalendar;
                fView.Date1BC.Checked           = dtRange.After.YearBC;
                fView.Date2BC.Checked           = dtRange.Before.YearBC;
            }
            else if (date is GEDCOMDatePeriod)
            {
                GEDCOMDatePeriod dtPeriod = date as GEDCOMDatePeriod;

                if (dtPeriod.DateFrom.StringValue != "" && dtPeriod.DateTo.StringValue == "")
                {
                    fView.EventDateType.SelectedIndex = 4;
                }
                else if (dtPeriod.DateFrom.StringValue == "" && dtPeriod.DateTo.StringValue != "")
                {
                    fView.EventDateType.SelectedIndex = 5;
                }
                else if (dtPeriod.DateFrom.StringValue != "" && dtPeriod.DateTo.StringValue != "")
                {
                    fView.EventDateType.SelectedIndex = 6;
                }

                fView.Date1.Text = dtPeriod.DateFrom.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date2.Text = dtPeriod.DateTo.GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date1Calendar.SelectedTag = dtPeriod.DateFrom.DateCalendar;
                fView.Date2Calendar.SelectedTag = dtPeriod.DateTo.DateCalendar;
                fView.Date1BC.Checked           = dtPeriod.DateFrom.YearBC;
                fView.Date2BC.Checked           = dtPeriod.DateTo.YearBC;
            }
            else if (date is GEDCOMDate)
            {
                GEDCOMApproximated approximated = (date as GEDCOMDate).Approximated;

                switch (approximated)
                {
                case GEDCOMApproximated.daExact:
                    fView.EventDateType.SelectedIndex = 0;
                    break;

                case GEDCOMApproximated.daAbout:
                    fView.EventDateType.SelectedIndex = 7;
                    break;

                case GEDCOMApproximated.daCalculated:
                    fView.EventDateType.SelectedIndex = 8;
                    break;

                case GEDCOMApproximated.daEstimated:
                    fView.EventDateType.SelectedIndex = 9;
                    break;
                }

                fView.Date1.Text = (date as GEDCOMDate).GetDisplayString(DateFormat.dfDD_MM_YYYY);
                fView.Date1Calendar.SelectedTag = (date as GEDCOMDate).DateCalendar;
                fView.Date1BC.Checked           = (date as GEDCOMDate).YearBC;
            }
            else
            {
                fView.EventDateType.SelectedIndex = 0;
                fView.Date1.Text = "";
                fView.Date1Calendar.SelectedTag = GEDCOMCalendar.dcGregorian;
                fView.Date1BC.Checked           = false;
            }

            ChangeDateType();
            fView.EventName.Text = fEvent.Classification;
            fView.Cause.Text     = fEvent.Cause;
            fView.Agency.Text    = fEvent.Agency;

            fTempLocation = (fEvent.Place.Location.Value as GEDCOMLocationRecord);
            UpdatePlace();

            fView.NotesList.UpdateSheet();
            fView.MediaList.UpdateSheet();
            fView.SourcesList.UpdateSheet();
        }
 public void AddPlace()
 {
     fTempLocation = (fBase.Context.SelectRecord(GEDCOMRecordType.rtLocation, null) as GEDCOMLocationRecord);
     UpdatePlace();
 }
 public void RemovePlace()
 {
     fTempLocation = null;
     UpdatePlace();
 }
Esempio n. 19
0
        public static void FillContext(IBaseContext context)
        {
            // a null result if the record is not defined
            GEDCOMCustomEvent evt = context.CreateEventEx(null, "BIRT", "xxxxx", "xxxxx");

            Assert.IsNull(evt);

            // first individual
            GEDCOMIndividualRecord iRec = context.CreatePersonEx("Ivan", "Ivanovich", "Ivanov", GEDCOMSex.svMale, true);

            Assert.IsNotNull(iRec);

            evt = iRec.FindEvent("BIRT");
            Assert.IsNotNull(evt);
            evt.Date.ParseString("28 DEC 1990");
            evt.Place.StringValue = "Ivanovo";

            GEDCOMCustomEvent evtd = context.CreateEventEx(iRec, "DEAT", "28 DEC 2010", "Ivanovo");

            Assert.IsNotNull(evtd);

            // second individual, wife
            GEDCOMIndividualRecord iRec2 = context.CreatePersonEx("Maria", "Petrovna", "Ivanova", GEDCOMSex.svFemale, true);

            evt = iRec2.FindEvent("BIRT");
            Assert.IsNotNull(evt);
            evt.Date.ParseString("17 MAR 1990");
            evt.Place.StringValue = "Ivanovo";

            iRec.AddAssociation("spouse", iRec2);

            // third individual, child
            GEDCOMIndividualRecord iRec3 = context.CreatePersonEx("Anna", "Ivanovna", "Ivanova", GEDCOMSex.svFemale, true);

            evt = iRec3.FindEvent("BIRT");
            Assert.IsNotNull(evt);
            evt.Date.ParseString("11 FEB 2010");
            evt.Place.StringValue = "Ivanovo";

            // their family
            GEDCOMFamilyRecord famRec = context.Tree.CreateFamily();

            Assert.IsNotNull(famRec);
            famRec.AddSpouse(iRec);
            famRec.AddSpouse(iRec2);
            famRec.AddChild(iRec3);

            context.CreateEventEx(famRec, "MARR", "01 JAN 2000", "unknown");

            // individual outside the family
            GEDCOMIndividualRecord iRec4 = context.CreatePersonEx("Alex", "", "Petrov", GEDCOMSex.svMale, true);

            evt = iRec4.FindEvent("BIRT");
            Assert.IsNotNull(evt);
            evt.Date.ParseString("15 JUN 1989");
            evt.Place.StringValue = "Far Forest";

            evt = context.CreateEventEx(iRec4, "RESI", "12 FEB", "Far Forest");
            Assert.IsNotNull(evt);

            // fifth
            GEDCOMIndividualRecord iRec5 = context.CreatePersonEx("Anna", "", "Jones", GEDCOMSex.svFemale, false);

            Assert.IsNotNull(iRec5);

            // group for tests
            GEDCOMGroupRecord groupRec = context.Tree.CreateGroup();

            groupRec.GroupName = "GroupTest";
            Assert.IsNotNull(groupRec, "group1 != null");
            groupRec.AddMember(iRec);

            // location for tests
            GEDCOMLocationRecord locRec = context.Tree.CreateLocation();

            locRec.LocationName = "Test Location";
            locRec.Map.Lati     = 5.11111;
            locRec.Map.Long     = 7.99999;
            Assert.IsNotNull(locRec, "locRec != null");

            // repository for tests
            GEDCOMRepositoryRecord repoRec = context.Tree.CreateRepository();

            repoRec.RepositoryName = "Test repository";
            Assert.IsNotNull(repoRec, "repoRec != null");

            // research for tests
            GEDCOMResearchRecord resRec = context.Tree.CreateResearch();

            resRec.ResearchName = "Test research";
            Assert.IsNotNull(resRec, "resRec != null");

            // source for tests
            GEDCOMSourceRecord srcRec = context.Tree.CreateSource();

            srcRec.FiledByEntry = "Test source";
            Assert.IsNotNull(srcRec, "srcRec != null");
            iRec.AddSource(srcRec, "p1", 0);

            // note for tests
            GEDCOMNoteRecord noteRec = context.Tree.CreateNote();

            noteRec.SetNoteText("Test note");
            Assert.IsNotNull(noteRec, "noteRec != null");
            iRec.AddNote(noteRec);

            // task for tests
            GEDCOMTaskRecord tskRec = context.Tree.CreateTask();

            tskRec.Goal = "Test task";
            Assert.IsNotNull(tskRec, "tskRec != null");

            // media for tests
            GEDCOMMultimediaRecord mediaRec = context.Tree.CreateMultimedia();

            mediaRec.AddTag("FILE", "", null);
            GEDCOMFileReferenceWithTitle fileRef = mediaRec.FileReferences[0];

            fileRef.Title = "Test multimedia";
            fileRef.LinkFile("sample.png");
            Assert.IsNotNull(mediaRec, "mediaRec != null");
            iRec.AddMultimedia(mediaRec);

            // communication for tests
            GEDCOMCommunicationRecord commRec = context.Tree.CreateCommunication();

            commRec.CommName = "Test communication";
            Assert.IsNotNull(commRec, "commRec != null");
        }
Esempio n. 20
0
        public void Test_ShowXInfo()
        {
            StringList summary = new StringList();

            summary.Clear();
            GKUtils.ShowFamilyInfo(fContext, null, null);
            GEDCOMFamilyRecord famRec = fContext.Tree.XRefIndex_Find("F1") as GEDCOMFamilyRecord;

            GKUtils.ShowFamilyInfo(fContext, famRec, summary);

            summary.Clear();
            GKUtils.ShowGroupInfo(null, null);
            GEDCOMGroupRecord grpRec = fContext.Tree.XRefIndex_Find("G1") as GEDCOMGroupRecord;

            GKUtils.ShowGroupInfo(grpRec, summary);

            summary.Clear();
            GKUtils.ShowMultimediaInfo(null, null);
            GEDCOMMultimediaRecord mmRec = fContext.Tree.XRefIndex_Find("O1") as GEDCOMMultimediaRecord;

            GKUtils.ShowMultimediaInfo(mmRec, summary);

            summary.Clear();
            GKUtils.ShowNoteInfo(null, null);
            GEDCOMNoteRecord noteRec = fContext.Tree.XRefIndex_Find("N1") as GEDCOMNoteRecord;

            GKUtils.ShowNoteInfo(noteRec, summary);

            summary.Clear();
            GKUtils.ShowPersonInfo(fContext, null, null);
            GEDCOMIndividualRecord indRec = fContext.Tree.XRefIndex_Find("I1") as GEDCOMIndividualRecord;

            GKUtils.ShowPersonInfo(fContext, indRec, summary);

            summary.Clear();
            GKUtils.ShowSourceInfo(null, null);
            GEDCOMSourceRecord srcRec = fContext.Tree.XRefIndex_Find("S1") as GEDCOMSourceRecord;

            GKUtils.ShowSourceInfo(srcRec, summary);

            summary.Clear();
            GKUtils.ShowRepositoryInfo(null, null);
            GEDCOMRepositoryRecord repRec = fContext.Tree.XRefIndex_Find("R1") as GEDCOMRepositoryRecord;

            GKUtils.ShowRepositoryInfo(repRec, summary);

            summary.Clear();
            GKUtils.ShowResearchInfo(null, null);
            GEDCOMResearchRecord resRec = fContext.Tree.XRefIndex_Find("RS1") as GEDCOMResearchRecord;

            GKUtils.ShowResearchInfo(resRec, summary);

            summary.Clear();
            GKUtils.ShowTaskInfo(null, null);
            GEDCOMTaskRecord taskRec = fContext.Tree.XRefIndex_Find("TK1") as GEDCOMTaskRecord;

            GKUtils.ShowTaskInfo(taskRec, summary);

            summary.Clear();
            GKUtils.ShowCommunicationInfo(null, null);
            GEDCOMCommunicationRecord commRec = fContext.Tree.XRefIndex_Find("CM1") as GEDCOMCommunicationRecord;

            GKUtils.ShowCommunicationInfo(commRec, summary);

            summary.Clear();
            GKUtils.ShowLocationInfo(null, null);
            GEDCOMLocationRecord locRec = fContext.Tree.XRefIndex_Find("L1") as GEDCOMLocationRecord;

            GKUtils.ShowLocationInfo(locRec, summary);
        }