Ejemplo n.º 1
0
        public static bool AddIndividualPortrait(IBaseWindow baseWin, ChangeTracker localUndoman, GDMIndividualRecord iRec)
        {
            bool result = false;

            GDMMultimediaRecord mmRec = baseWin.Context.SelectRecord(GDMRecordType.rtMultimedia, null) as GDMMultimediaRecord;

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

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

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

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

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

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

            return(result);
        }