Esempio n. 1
0
 public CacheImageMiddleware(RequestDelegate next, IImageSourceService imageSource,
                             ILogger <CacheImageMiddleware> logger)
 {
     _next        = next;
     _imageSource = imageSource;
     _logger      = logger;
 }
#pragma warning restore 0169

		HexViewBackgroundImageService(WpfHexView wpfHexView, IImageSourceService imageSourceService)
			: base(imageSourceService) {
			if (wpfHexView == null)
				throw new ArgumentNullException(nameof(wpfHexView));
			this.wpfHexView = wpfHexView;
			wpfHexView.Closed += WpfHexView_Closed;
		}
		public static void InstallService(WpfHexView wpfHexView, IImageSourceService imageSourceService) {
			if (wpfHexView == null)
				throw new ArgumentNullException(nameof(wpfHexView));
			if (imageSourceService == null)
				throw new ArgumentNullException(nameof(imageSourceService));
			wpfHexView.Properties.GetOrCreateSingletonProperty(typeof(BackgroundImageService), () => new HexViewBackgroundImageService(wpfHexView, imageSourceService));
		}
Esempio n. 4
0
 public ImageCacheFilter(IImageSourceService imageSource, ILogger <ImageCacheFilter> logger,
                         IETagGenerator eTagGenerator)
 {
     _imageSource   = imageSource;
     _logger        = logger;
     _eTagGenerator = eTagGenerator;
 }
Esempio n. 5
0
#pragma warning restore CS0169

        TextViewBackgroundImageService(IWpfTextView wpfTextView, IImageSourceService imageSourceService)
            : base(imageSourceService)
        {
            this.wpfTextView = wpfTextView ?? throw new ArgumentNullException(nameof(wpfTextView));
            Initialize();
            wpfTextView.Closed += WpfTextView_Closed;
        }
Esempio n. 6
0
 protected BackgroundImageService(IImageSourceService imageSourceService)
 {
     if (imageSourceService == null)
     {
         throw new ArgumentNullException(nameof(imageSourceService));
     }
     this.imageSourceService = imageSourceService;
 }
Esempio n. 7
0
        async Task <Drawable> GetDrawable(IImageSourceService service, IImageSource imageSource)
        {
            var tcsDrawable = new TaskCompletionSource <Drawable>();

            // get an image
            var result1 = await service.GetDrawableAsync(imageSource, MauiProgram.DefaultContext).ConfigureAwait(false);

            return(await tcsDrawable.Task.ConfigureAwait(false));
        }
#pragma warning restore 0169

        HexViewBackgroundImageService(WpfHexView wpfHexView, IImageSourceService imageSourceService)
            : base(imageSourceService)
        {
            if (wpfHexView == null)
            {
                throw new ArgumentNullException(nameof(wpfHexView));
            }
            this.wpfHexView    = wpfHexView;
            wpfHexView.Closed += WpfHexView_Closed;
        }
Esempio n. 9
0
 public static void InstallService(IWpfTextView wpfTextView, IImageSourceService imageSourceService)
 {
     if (wpfTextView is null)
     {
         throw new ArgumentNullException(nameof(wpfTextView));
     }
     if (imageSourceService is null)
     {
         throw new ArgumentNullException(nameof(imageSourceService));
     }
     wpfTextView.Properties.GetOrCreateSingletonProperty(typeof(BackgroundImageService), () => new TextViewBackgroundImageService(wpfTextView, imageSourceService));
 }
Esempio n. 10
0
        public static Task <T> CheckAbsolutePathName <T>(this IImageSourceService image, string imageName,
                                                         Func <string, Task <T> > imageAction)
        {
            var imageNameWithExtension = ImageNameWithExtension(image, imageName);
            var imagePath = Directory.Exists(image.DirPath)
                ? Path.Combine(image.DirPath, imageNameWithExtension)
                : string.Empty;

            if (string.IsNullOrEmpty(imagePath))
            {
                throw new FileNotFoundException(imageNameWithExtension);
            }
            return(imageAction(imagePath));
        }
        public void ProcessRequest(HttpContext context)
        {
            Size size = Get <Size>("chartSize");
            IImageSourceService dataProvider = Get <IImageSourceService>("activityManagerService");

            byte[] bytImage = dataProvider.GetImage(size);
            context.Response.ContentType = "image/png";
            context.Response.Expires     = 0;
            context.Response.Buffer      = true;
            context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            context.Response.Clear();
            context.Response.BinaryWrite(bytImage);
            context.Response.End();
        }
#pragma warning restore 0169

        BackgroundImageService(IWpfTextView wpfTextView, IImageSourceService imageSourceService)
        {
            if (wpfTextView == null)
            {
                throw new ArgumentNullException(nameof(wpfTextView));
            }
            if (imageSourceService == null)
            {
                throw new ArgumentNullException(nameof(imageSourceService));
            }
            this.wpfTextView        = wpfTextView;
            this.imageSourceService = imageSourceService;
            wpfTextView.Closed     += WpfTextView_Closed;
            imageSourceService.Register(this);
        }
Esempio n. 13
0
        public static Task <IImageSourceServiceResult <NativeImage>?> GetNativeImageAsync(this IImageSourceService imageSourceService, IImageSource?imageSource, IMauiContext mauiContext)
        {
            if (imageSource == null)
            {
                return(Task.FromResult <IImageSourceServiceResult <NativeImage>?>(null));
            }

#if __IOS__ || MACCATALYST
            return(imageSourceService.GetImageAsync(imageSource));
#elif MONOANDROID
            return(imageSourceService.GetDrawableAsync(imageSource, mauiContext.Context !));
#elif WINDOWS
            return(imageSourceService.GetImageSourceAsync(imageSource));
#else
            throw new NotImplementedException();
#endif
        }
Esempio n. 14
0
 protected BackgroundImageService(IImageSourceService imageSourceService) =>
 this.imageSourceService = imageSourceService ?? throw new ArgumentNullException(nameof(imageSourceService));
Esempio n. 15
0
 public FakePhotoController(IFakePhotoService fakePhotoService, IImageSourceService imageSourceService)
 {
     _fakePhotoService   = fakePhotoService;
     _imageSourceService = imageSourceService;
 }
Esempio n. 16
0
 public SourceController(IImageSourceService imageSourceService)
 {
     _imageSourceService = imageSourceService;
 }
Esempio n. 17
0
        public static Task <IImageSourceServiceResult <PlatformImage>?> GetPlatformImageAsync(this IImageSourceService imageSourceService, IImageSource?imageSource, IMauiContext mauiContext)
        {
            if (imageSource == null)
            {
                return(Task.FromResult <IImageSourceServiceResult <PlatformImage>?>(null));
            }

#if IOS || MACCATALYST
            return(imageSourceService.GetImageAsync(imageSource));
#elif ANDROID
            return(imageSourceService.GetDrawableAsync(imageSource, mauiContext.Context !));
#elif WINDOWS
            return(imageSourceService.GetImageSourceAsync(imageSource));
#elif TIZEN
            var platformImage = new PlatformImage(mauiContext.GetNativeParent());
            return(imageSourceService.GetImageAsync(imageSource, platformImage));
#else
            throw new NotImplementedException();
#endif
        }
Esempio n. 18
0
		protected BackgroundImageService(IImageSourceService imageSourceService) {
			if (imageSourceService == null)
				throw new ArgumentNullException(nameof(imageSourceService));
			this.imageSourceService = imageSourceService;
			imageSourceService.Register(this);
		}
Esempio n. 19
0
 public static string ImageNameWithExtension(this IImageSourceService image, string imageName)
 {
     return(string.Join('.', imageName, image.ImageType.ToString().ToLower()));
 }