public ProductController(ICatalogService service, IImageStorageService imageService, ITopListService topService, IMapper <Product, ProductModel> listMapper, IMapper <Product, EditProductModel> editMapper)
 {
     this.service      = service;
     this.imageService = imageService;
     this.topService   = topService;
     this.listMapper   = listMapper;
     this.editMapper   = editMapper;
 }
 public ProductController(ICatalogService service, IImageStorageService imageService, ITopListService topService, IMapper<Product, ProductModel> listMapper, IMapper<Product, EditProductModel> editMapper)
 {
     this.service = service;
     this.imageService = imageService;
     this.topService = topService;
     this.listMapper = listMapper;
     this.editMapper = editMapper;
 }
Esempio n. 3
0
 public AddItemViewModel(ILocationService locationService, IMvxMessenger messenger, IMvxPictureChooserTask pictureChooserTask, IItemService itemService, IImageStorageService imageStore)
 {
     _locationService    = locationService;
     _pictureChooserTask = pictureChooserTask;
     _itemService        = itemService;
     _imageStore         = imageStore;
     _token = messenger.SubscribeOnMainThread <LocationMessage>(OnLocationMessage);
     GetInitialLocation();
 }
        //private string predictionEndpoint2;

        public PlantsController(ApplicationDbContext context, IImageStorageService imageStorageService, IConfiguration configuration)
        {
            _context             = context;
            _imageStorageService = imageStorageService;
            _configuration       = configuration;

            trainingKey   = configuration["trainingKey"];
            predictionKey = configuration["predictionKey"];
            projectID     = Guid.Parse(configuration["projectID"]);

            endpoint = new CustomVisionPredictionClient()
            {
                ApiKey   = predictionKey,
                Endpoint = configuration["WestEuropeEndpoint"]
            };
        }
Esempio n. 5
0
        public static void TransformImageUrls(this User user, IImageStorageService imageStorageService, IDevice device)
        {
            if (user.OperatorListings != null)
            {
                foreach (var listing in user.OperatorListings)
                {
                    listing.ImageUrls = imageStorageService.TransformImageUrls(listing.ImageUrls, ImageType.ListingCard, device);
                }
            }

            if (user.GuestListings != null)
            {
                foreach (var listing in user.GuestListings)
                {
                    listing.ImageUrls = imageStorageService.TransformImageUrls(listing.ImageUrls, ImageType.ListingCard, device);
                }
            }
        }
Esempio n. 6
0
        public ImageController(
            ApplicationDbContext context,
            UserManager <ApplicationUser> userManager,
            IConfiguration configuration,
            IImageStorageService imageStorageService)
        {
            _context             = context;
            _userManager         = userManager;
            _configuration       = configuration;
            _imageStorageService = imageStorageService;

            trainingKey = configuration["trainingKey"];
            trainingApi = new CustomVisionTrainingClient()
            {
                ApiKey   = trainingKey,
                Endpoint = configuration["WestEuropeEndpoint"]
            };
        }
Esempio n. 7
0
 public UserController(IUserService userService, IEmailService emailService, IHostingEnvironment hostingEnv,
                       IMapper mapper, ILogger <UserController> logger, IAuthorizationService authorizationService,
                       ISecurityTokenService securityTokenService, IHttpContextAccessor httpContextAccessor,
                       IOptions <AppSettings> appSettings, IImageService imageService,
                       IImageStorageService imageStorageService, IDeviceResolver deviceResolver)
 {
     _userService          = userService;
     _emailService         = emailService;
     _hostingEnv           = hostingEnv;
     _mapper               = mapper;
     _logger               = logger;
     _authorizationService = authorizationService;
     _securityTokenService = securityTokenService;
     _httpContextAccessor  = httpContextAccessor;
     _imageService         = imageService;
     _imageStorageService  = imageStorageService;
     _appSettings          = appSettings.Value;
     _device               = deviceResolver.Device;
 }
Esempio n. 8
0
        private async void SaveCanvas(SKSurface surface)
        {
            try
            {
                var data = surface.Snapshot().Encode(SKEncodedImageFormat.Png, 100);

                var skBitmap = SKBitmap.Decode(data.AsStream(true));

                DateTime dt       = DateTime.Now;
                string   filename = String.Format("Collage-{0:D4}{1:D2}{2:D2}-{3:D2}{4:D2}.png", dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute);

                var scaled = skBitmap.Resize(new SKImageInfo(_width * 2, _height * 2),
                                             SKBitmapResizeMethod.Lanczos3);
                SKImage image = SKImage.FromBitmap(scaled);

                SKData png = image.Encode(SKEncodedImageFormat.Png, 100);

                IImageStorageService dependencyService = DependencyService.Get <IImageStorageService>();

                //Save the bitmap and get a boolean indicating success.
                bool result = await dependencyService.SaveBitmap(png.ToArray(), filename);

                if (result)
                {
                    _files = null;
                    canvasViews.InvalidateSurface();
                }
                else
                {
                    await DisplayAlert("bad", "error occured", "cancel");
                }
                ButtonSave.IsEnabled = true;

                _isSaving = false;
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "Ok");

                _isSaving = false;
            }
        }
 public GalleryController(ILogger <GalleryController> logger, IImageStorageService imageStorageService)
 {
     _logger = logger;
     _imageStorageService = imageStorageService;
 }
 public ImagesController(IImageStorageService imageStorageService, IImageService imageService)
 {
     _imageStorageService = imageStorageService;
     _imageService        = imageService;
 }