Ejemplo n.º 1
0
        public override bool Accept()
        {
            try {
                ExtRect selectRegion = fView.ImageCtl.SelectionRegion;

                if (!selectRegion.IsEmpty())
                {
                    fMultimediaLink.IsPrimaryCutout      = true;
                    fMultimediaLink.CutoutPosition.Value = selectRegion;
                }
                else
                {
                    fMultimediaLink.IsPrimaryCutout      = false;
                    fMultimediaLink.CutoutPosition.Value = ExtRect.CreateEmpty();
                }

                var uid = fMultimediaLink.GetUID(fBase.Context.Tree);
                PortraitsCache.Instance.RemoveObsolete(uid);

                return(true);
            } catch (Exception ex) {
                Logger.WriteError("PortraitSelectDlgController.Accept()", ex);
                return(false);
            }
        }
Ejemplo n.º 2
0
        public void RemoveObsolete(GDMMultimediaLink mmLink)
        {
            if (mmLink == null)
            {
                return;
            }

            try {
                string imageUID   = mmLink.GetUID();
                string cachedFile = GetCachedFilename(imageUID);

                if (fMemoryCache.ContainsKey(cachedFile))
                {
                    fMemoryCache.Remove(cachedFile);
                }

                if (File.Exists(cachedFile))
                {
                    File.Delete(cachedFile);
                }
            } catch (Exception ex) {
                Logger.LogWrite("PortraitsCache.RemoveObsolete(): " + ex.Message);
            }
        }