public void AddParents()
        {
            AcceptTempData();

            GEDCOMFamilyRecord family = fBase.Context.SelectFamily(fPerson);

            if (family != null && family.IndexOfChild(fPerson) < 0)
            {
                fLocalUndoman.DoOrdinaryOperation(OperationType.otIndividualParentsAttach, fPerson, family);
            }
            UpdateControls();
        }
Пример #2
0
        private void btnParentsAdd_Click(object sender, EventArgs e)
        {
            AcceptTempData();

            GEDCOMFamilyRecord family = fBase.Context.SelectFamily(fPerson);

            if (family == null)
            {
                return;
            }

            if (family.IndexOfChild(fPerson) < 0)
            {
                fLocalUndoman.DoOrdinaryOperation(OperationType.otIndividualParentsAttach, fPerson, family);
            }
            UpdateControls();
        }
Пример #3
0
        public override void Modify(object sender, ModifyEventArgs eArgs)
        {
            var iRec = fDataOwner as GEDCOMIndividualRecord;

            if (fBaseWin == null || fSheetList == null || iRec == null)
            {
                return;
            }

            GEDCOMChildToFamilyLink cfLink = eArgs.ItemData as GEDCOMChildToFamilyLink;

            bool result = false;

            switch (eArgs.Action)
            {
            case RecordAction.raAdd:
                GEDCOMFamilyRecord family = fBaseWin.Context.SelectFamily(iRec);
                if (family != null && family.IndexOfChild(iRec) < 0)
                {
                    result = fUndoman.DoOrdinaryOperation(OperationType.otIndividualParentsAttach, iRec, family);
                }
                break;

            case RecordAction.raEdit:
                if (cfLink != null)
                {
                    using (var dlg = AppHost.Container.Resolve <IParentsEditDlg>(fBaseWin)) {
                        dlg.Person = iRec;
                        dlg.Link   = cfLink;
                        result     = AppHost.Instance.ShowModalX(dlg, false);
                    }
                }
                break;

            case RecordAction.raDelete:
                if (AppHost.StdDialogs.ShowQuestionYN(LangMan.LS(LSID.LSID_DetachParentsQuery)))
                {
                    result = fUndoman.DoOrdinaryOperation(OperationType.otIndividualParentsDetach, iRec, cfLink.Family);
                }
                break;

            case RecordAction.raMoveUp:
            case RecordAction.raMoveDown:
                int idx = iRec.ChildToFamilyLinks.IndexOf(cfLink);
                switch (eArgs.Action)
                {
                case RecordAction.raMoveUp:
                    iRec.ChildToFamilyLinks.Exchange(idx - 1, idx);
                    break;

                case RecordAction.raMoveDown:
                    iRec.ChildToFamilyLinks.Exchange(idx, idx + 1);
                    break;
                }
                result = true;
                break;
            }

            if (result)
            {
                fBaseWin.Context.Modified = true;
                eArgs.IsChanged           = true;
            }
        }