コード例 #1
0
        public static bool AddIndividualPortrait(IBaseWindow baseWin, ChangeTracker localUndoman, GEDCOMIndividualRecord iRec)
        {
            bool result = false;

            GEDCOMMultimediaRecord mmRec = baseWin.Context.SelectRecord(GEDCOMRecordType.rtMultimedia, null) as GEDCOMMultimediaRecord;

            if (mmRec == null)
            {
                return(false);
            }

            // remove previous portrait link
            GEDCOMMultimediaLink mmLink = iRec.GetPrimaryMultimediaLink();

            if (mmLink != null)
            {
                mmLink.IsPrimary = false;
            }

            // set new portrait link
            mmLink = iRec.SetPrimaryMultimediaLink(mmRec);

            // select portrait area
            using (var selectDlg = AppHost.Container.Resolve <IPortraitSelectDlg>(baseWin)) {
                selectDlg.MultimediaLink = mmLink;
                result = AppHost.Instance.ShowModalX(selectDlg, false);
            }

            if (result)
            {
                result = localUndoman.DoOrdinaryOperation(OperationType.otIndividualPortraitAttach, iRec, mmLink);
            }

            return(result);
        }
コード例 #2
0
ファイル: BaseController.cs プロジェクト: fire-eggs/GEDKeeper
        public static bool AddIndividualPortrait(IBaseWindow baseWin, GEDCOMIndividualRecord iRec)
        {
            bool result = false;

            GEDCOMMultimediaRecord mmRec = baseWin.Context.SelectRecord(GEDCOMRecordType.rtMultimedia, null) as GEDCOMMultimediaRecord;

            if (mmRec == null)
            {
                return(false);
            }

            // remove previous portrait link
            GEDCOMMultimediaLink mmLink = iRec.GetPrimaryMultimediaLink();

            if (mmLink != null)
            {
                mmLink.IsPrimary = false;
            }

            // set new portrait link
            mmLink = iRec.SetPrimaryMultimediaLink(mmRec);

            // select portrait area
            using (var selectDlg = AppHost.Container.Resolve <IPortraitSelectDlg>())
            {
                selectDlg.InitDialog(baseWin);
                selectDlg.MultimediaLink = mmLink;
                result = AppHost.Instance.ShowModalX(selectDlg, false);
            }

            return(result);
        }
コード例 #3
0
        public static bool DeleteIndividualPortrait(IBaseWindow baseWin, ChangeTracker localUndoman, GEDCOMIndividualRecord iRec)
        {
            GEDCOMMultimediaLink mmLink = iRec.GetPrimaryMultimediaLink();

            if (mmLink != null)
            {
                return(localUndoman.DoOrdinaryOperation(OperationType.otIndividualPortraitDetach, iRec, mmLink));
            }
            return(false);
        }
コード例 #4
0
ファイル: BaseController.cs プロジェクト: fire-eggs/GEDKeeper
        public static bool DeleteIndividualPortrait(IBaseWindow baseWin, GEDCOMIndividualRecord iRec)
        {
            GEDCOMMultimediaLink mmLink = iRec.GetPrimaryMultimediaLink();

            if (mmLink == null)
            {
                return(false);
            }

            mmLink.IsPrimary = false;
            return(true);
        }