Exemplo n.º 1
0
        public void SetUp()
        {
            WFAppHost.ConfigureBootstrap(false);

            fBase        = new BaseWindowStub();
            fAssociation = new GEDCOMAssociation(fBase.Context.Tree, null, "", "");
        }
Exemplo n.º 2
0
        public override void Modify(object sender, ModifyEventArgs eArgs)
        {
            var person = fDataOwner as GEDCOMIndividualRecord;

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

            bool result = false;

            GEDCOMAssociation ast = eArgs.ItemData as GEDCOMAssociation;

            switch (eArgs.Action)
            {
            case RecordAction.raAdd:
            case RecordAction.raEdit:
                using (var dlg = AppHost.Container.Resolve <IAssociationEditDlg>())
                {
                    dlg.InitDialog(fBaseWin);

                    bool exists = (ast != null);
                    if (!exists)
                    {
                        ast = new GEDCOMAssociation(fBaseWin.Context.Tree, person, "", "");
                    }

                    dlg.Association = ast;
                    result          = AppHost.Instance.ShowModalX(dlg, false);

                    if (!exists)
                    {
                        if (result)
                        {
                            result = fUndoman.DoOrdinaryOperation(OperationType.otIndividualAssociationAdd, person, ast);
                        }
                        else
                        {
                            ast.Dispose();
                        }
                    }
                }
                break;

            case RecordAction.raDelete:
                if (AppHost.StdDialogs.ShowQuestionYN(LangMan.LS(LSID.LSID_RemoveAssociationQuery)))
                {
                    result = fUndoman.DoOrdinaryOperation(OperationType.otIndividualAssociationRemove, person, ast);
                }
                break;
            }

            if (result)
            {
                fBaseWin.Context.Modified = true;
                eArgs.IsChanged           = true;
            }
        }
Exemplo n.º 3
0
        private void ModifyAssociationsSheet(object sender, ModifyEventArgs eArgs)
        {
            GEDCOMAssociation ast = eArgs.ItemData as GEDCOMAssociation;

            if (eArgs.Action == RecordAction.raJump && ast != null)
            {
                fController.JumpToRecord(ast.Individual);
            }
        }
Exemplo n.º 4
0
        private void ModifyAssociationsSheet(object sender, ModifyEventArgs eArgs)
        {
            GEDCOMAssociation ast = eArgs.ItemData as GEDCOMAssociation;

            if (eArgs.Action == RecordAction.raJump && ast != null)
            {
                AcceptChanges();
                fBase.SelectRecordByXRef(ast.Individual.XRef);
                Close();
            }
        }
        public override void Setup()
        {
            base.Setup();

            fBase        = new BaseWindowStub();
            fAssociation = new GEDCOMAssociation(fBase.Context.Tree, null, "", "");

            fDialog             = new AssociationEditDlg(fBase);
            fDialog.Association = fAssociation;
            fDialog.Show();
        }
Exemplo n.º 6
0
        public object gt_get_person_association(object recPtr, int idx)
        {
            GEDCOMIndividualRecord iRec = recPtr as GEDCOMIndividualRecord;

            if (iRec == null)
            {
                return(null);
            }

            GEDCOMAssociation asso = iRec.Associations[idx];

            return(asso);
        }
Exemplo n.º 7
0
        public object gt_add_person_association(object recPtr, string rel, object assoPtr)
        {
            GEDCOMIndividualRecord iRec = recPtr as GEDCOMIndividualRecord;

            if (iRec == null)
            {
                return(null);
            }

            GEDCOMIndividualRecord assoRec = assoPtr as GEDCOMIndividualRecord;

            if (assoRec == null)
            {
                return(null);
            }

            GEDCOMAssociation asso = iRec.AddAssociation(rel, assoRec);

            return(asso);
        }
Exemplo n.º 8
0
        private bool ProcessIndividualAssociation(bool redo)
        {
            GEDCOMIndividualRecord iRec = fObj as GEDCOMIndividualRecord;
            GEDCOMAssociation      asso = fNewVal as GEDCOMAssociation;

            if (iRec == null || asso == null)
            {
                return(false);
            }

            if (fType == OperationType.otIndividualAssociationRemove)
            {
                redo = !redo;
            }
            if (redo)
            {
                iRec.Associations.Add(asso);
            }
            else
            {
                iRec.Associations.Extract(asso);
            }
            return(true);
        }