public void ShareImage(IImageService service) { string imagePath = GetCapturedImage(); if (SynchronizationContext.Current == null) SynchronizationContext.SetSynchronizationContext(new WindowsFormsSynchronizationContext()); var worker = Task.Run(() => { StartAsyncOutput(); var uploadTask = service.UploadImage(imagePath); uploadTask.ContinueWith(task => HandleError(task.Exception), TaskContinuationOptions.AttachedToParent | TaskContinuationOptions.OnlyOnFaulted); return uploadTask.Result; }); worker.ContinueWith(previousTask => HandleResult(previousTask.Result), CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.FromCurrentSynchronizationContext()) .ContinueWith(task => { FinishAsyncOutput(); File.Delete(imagePath); }); }
public WatchController(IWatchService watchService, IImageService imageService, IOrderService orderService, IRequestContext requestContext) { _watchService = watchService; _imageService = imageService; _orderService = orderService; _requestContext = requestContext; }
public DishController(IDishService dishservice, IUserService userservice, IDishTypeService dishtypeservice, IImageService imageservice) { DishSvc = dishservice; UserSvc = userservice; DishTypeSvc = dishtypeservice; ImageSvc = imageservice; }
/// <summary> /// Initializes a new instance of the <see cref="ImageDimensionMinValidator"/> class. /// </summary> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="imageService">The image service.</param> public ImageDimensionMinValidator(int width, int height, IImageService imageService) : base(Errors.ImageDimensionMinNotValid) { this.Width = width; this.Height = height; this.ImageService = imageService; }
/// <summary> /// Initializes a new instance of the <see cref="EstatesController" /> class. /// </summary> /// <param name="unitsRepository">The units repository.</param> /// <param name="imageService">The image service.</param> /// <param name="accountService">The account service.</param> /// <param name="unitFinder">The unit finder.</param> public EstatesController(IRepository<Unit> unitsRepository, IImageService imageService, IAccountService accountService, IUnitFinderService unitFinder) { this.unitsRepository = unitsRepository; this.imageService = imageService; this.accountService = accountService; this.unitFinder = unitFinder; }
public AccountController(IUserService userService, ICryptographyService cryptographyService, IEmailService emailService, IImageService imageService) { _userService = userService; _cryptographyService = cryptographyService; _emailService = emailService; _imageService = imageService; }
public ArticleController(IArticleService articleService, IRubricService rubricService, IImageService imageService, ITagService tagService) { this.articleService = articleService; this.rubricService = rubricService; this.imageService = imageService; this.tagService = tagService; }
public FlickrSearchViewModel(IImageService imageService) { Images = new ReactiveList<SearchResultViewModel>(); var canExecute = this.WhenAnyValue(x => x.SearchText) .Select(x => !String.IsNullOrWhiteSpace(x)); Search = ReactiveCommand.CreateAsyncObservable( canExecute, _ => { Images.Clear(); ShowError = false; return imageService.GetImages(SearchText); }); Search.Subscribe(images => Images.Add(images)); Search.ThrownExceptions.Subscribe(_ => ShowError = true); isLoading = Search.IsExecuting.ToProperty(this, vm => vm.IsLoading); canEnterSearchText = this.WhenAnyValue(x => x.IsLoading) .Select(x => !x) .ToProperty(this, vm => vm.CanEnterSearchText); }
public ImageController( IImageProcessor imageProcessor, IImageService imageService) { _imageProcessor = imageProcessor; _imageService = imageService; }
public CoopStaffTab(CooperationStaff cooperationStaff, CooperationProjectWrapper cooperationProjectWrapper) { if (cooperationStaff != null) { this.InitializeComponent(); this.imageService = ServiceUtil.Instance.ImageService; this.fileService = ServiceUtil.Instance.FileService; this.TabHeader.Label = cooperationStaff.Name; this.TabHeader.imgIcon.Source = cooperationStaff.HeaderImage; base.Tag = new MenuItem { Icon = new Image { Width = 16.0, Height = 16.0, Source = cooperationStaff.HeaderImage }, Header = cooperationStaff.Name }; this.TabContent = new CoopStaffChatTabControl(cooperationStaff, cooperationProjectWrapper); this.Staff = cooperationStaff; this.CooperationProjectWrapper = cooperationProjectWrapper; base.SetFocus2DesktopButton(); this.AddEventListenerHandler(); } }
public EmployeController(IEmployeService employeService, IRoleService roleService, IUtilisateurService<Employe> utilisateurService, IImageService imageService) { EmployeService = employeService; RoleService = roleService; UtilisateurService = utilisateurService; ImageService = imageService; }
/// <summary> /// Initializes a new instance of the <see cref="ServicesController"/> class. /// </summary> /// <param name="imageService">The image service.</param> /// <param name="imageConverter">The image converter.</param> /// <param name="queueFileService">The queue file service.</param> public ServicesController(IImageService imageService, IImageConverter imageConverter, IQueueFileService queueFileService) { _imageConverter = imageConverter; _queueFileService = queueFileService; _imageService = imageService; }
public MemoryCachedImageService(IImageService serviceToCache) { this.serviceToCache = serviceToCache; isLoading = new Dictionary<Uri, bool>(); images = new Dictionary<Uri, byte[]>(); callbacks = new Dictionary<Uri, List<Action<byte[]>>>(); }
public ActivityController(IAllReadyDataAccess dataAccess, UserManager<ApplicationUser> userManager, IImageService imageService, IMediator bus) { _dataAccess = dataAccess; _userManager = userManager; _imageService = imageService; _bus = bus; }
public AccountController(IClientService clientService, IRoleService roleService, IUtilisateurService<Client> utilisateurService, IImageService imageService) { ClientService = clientService; RoleService = roleService; UtilisateurService = utilisateurService; ImageService = imageService; }
public HoutaiController(IImageService imageService, IManageService manageService) { this.ImageSerivce = imageService; this.AddDisposableObject(imageService); this.ManageService = manageService; this.AddDisposableObject(manageService); }
public BaseController(BaseServiceCollection baseServiceCollection) { if (baseServiceCollection == null) return; AccountService = baseServiceCollection.AccountService; AuthenticationService = baseServiceCollection.AuthenticationService; ImageService = baseServiceCollection.ImageService; }
public ProductsController(IProductService products, IImageService images, IProducerService producers) { this.products = products; this.images = images; this.producers = producers; }
public UserService(INoSqlDb db, IHistoryService history, IImageService image, ILogger logger, IDateTimeProvider dtp) { _db = db; _history = history; _image = image; _logger = logger; _dtp = dtp; }
/// <summary> /// Initializes a new instance of the <see cref="ImagesService" /> class. /// </summary> /// <param name="repository">The repository.</param> /// <param name="fileUrlResolver">The file URL resolver.</param> /// <param name="imageService">The image service.</param> public ImagesService(IRepository repository, IMediaFileUrlResolver fileUrlResolver, IImageService imageService, IUploadImageService uploadImageService, ICategoryService categoryService) { this.repository = repository; this.fileUrlResolver = fileUrlResolver; this.imageService = imageService; this.categoryService = categoryService; Upload = uploadImageService; }
public UserController(IUserService userService,ICryptographyService cryptographyService,IImageService imageService, IEmailService emailService,ISessionService sessionService) { _userService = userService; _cryptographyService = cryptographyService; _imageService = imageService; _emailService = emailService; _sessionService = sessionService; }
public HomeController(IPlatformProxy platformProxy, IPlatformSettings platformSettings, IImageService imageService, IBoardsRepository boardsRepository, IBoardItemsRepository boardItemsRepository) { _platformProxy = platformProxy; _platformSettings = platformSettings; _imageService = imageService; _boardsRepository = boardsRepository; _boardItemsRepository = boardItemsRepository; }
public CreditRequestService(IUnitOfWork iUnitOfWork, IImageService iImageService, ICustomerService iCustomerService, IValidationService iValidationService) { _iUnitOfWork = iUnitOfWork; _iImageService = iImageService; _iCustomerService = iCustomerService; _iValidationService = iValidationService; }
public AccountController(IUserService userservice, IDishService dishservice, IGeoCoder geocodeservice, IImageService imageservice, IReservationService reservationservice) { UserSvc = userservice; DishSvc = dishservice; GeocodeSvc = geocodeservice; ImageSvc = imageservice; ReservationSvc = reservationservice; }
public ApiPublicationController(IOrchardServices orchardServices, IVideoService videoService, IIssueService issueService, ICategoryService categoryService, IImageService imageService) { _videoService = videoService; _issueService = issueService; _categoryService = categoryService; _imageService = imageService; Services = orchardServices; T = NullLocalizer.Instance; }
public WorkerController(IWorkerService workerService, IPersonService personService, IImageService imageServ, IWorkerCache wc) { this.wcache = wc; this.serv = workerService; this.imageServ = imageServ; }
private static async Task<ImageDetails> AcquireImage(IImageService imageService, long imageId) { return new ImageDetails { ImageBytes = await DownloadImageAsync(imageService, imageId), Metadata = await GetMetadataAsync(imageService, imageId) }; }
public void Initialize() { Setting.Rebuild(new List<Setting> { new Setting { Key = "image.extension", Value = "jpg,gif,png" } }); this.ImageService = new ImageService(); }
public Renderer(Template template, IImageService imageService) { _template = template; _imageService = imageService; _compiler = new FormatCompiler(); _compiler.RegisterTag(new ImgUrlTagDefinition(imageService), true); _generator = _compiler.Compile(_template.HTML); }
public DefaultMediaManagerApiOperations(IMediaTreeService mediaTree, IImagesService images, IImageService image, IFilesService files, IFileService file) { MediaTree = mediaTree; Images = images; Image = image; Files = files; File = file; }
public ImagesController(IImageService imageService) { _imageService = imageService; }
public ImagesController(IBaseService baseService, IImageService imageService) : base(baseService) { this.imageService = imageService; }
public ImageController(IImageService imageService) { this.imageService = imageService; }
public RssCrawlingService(INewsItemService newsItemService, IAlbumService albumService, ISettingsService settingsService, IImageService imageService, ILogService logService, IHeartService heartService) { _newsItemService = newsItemService; _albumService = albumService; _settingsService = settingsService; _imageService = imageService; _logService = logService; _heartService = heartService; }
public MemberService(IMemberRepository memberRepository, IChapterRepository chapterRepository, IAuthorizationService authorizationService, IEmailService emailService, MemberServiceSettings settings, IImageService imageService, IPaymentService paymentService, ICacheService cacheService) { _authorizationService = authorizationService; _cacheService = cacheService; _chapterRepository = chapterRepository; _emailService = emailService; _imageService = imageService; _memberRepository = memberRepository; _paymentService = paymentService; _settings = settings; }
public ImageController(IImageService ImageService) { _imageService = ImageService; }
internal UsersController ( IAuthenticationRepository authenticationRepository, IUserRepository userRepository, ISqlSettingsRepository settingsRepository, IEmailHelper emailHelper, IApplicationSettingsRepository applicationSettingsRepository, IServiceLogRepository log, IHttpClientProvider httpClientProvider, IPrivilegesRepository privilegesRepository, IItemInfoRepository itemInfoRepository, ISendMessageExecutor sendMessageExecutor, IImageService imageService, ISqlHelper sqlHelper) { _authenticationRepository = authenticationRepository; _userRepository = userRepository; _settingsRepository = settingsRepository; _emailHelper = emailHelper; _applicationSettingsRepository = applicationSettingsRepository; _log = log; _httpClientProvider = httpClientProvider; _privilegesManager = new PrivilegesManager(privilegesRepository); _itemInfoRepository = itemInfoRepository; _sendMessageExecutor = sendMessageExecutor; _imageService = imageService; _sqlHelper = sqlHelper; }
public AdminBookController(IBookService service, IImageService image) { _service = service; _image = image; }
public PlatformImageLoaderTask(ITarget <UIImage, TImageView> target, TaskParameter parameters, IImageService imageService, Configuration configuration, IMainThreadDispatcher mainThreadDispatcher) : base(ImageCache.Instance, configuration.DataResolverFactory ?? DataResolvers.DataResolverFactory.Instance, target, parameters, imageService, configuration, mainThreadDispatcher, true) { // do not remove! Kicks scale retrieval so it's available for all, without deadlocks due to accessing MainThread ScaleHelper.Init(); }
public HomeController(ILogger <HomeController> logger, IImageService imageService) { _logger = logger; _imageService = imageService; }
public EventController(IImageService imageService, IMediator mediator, IValidateEventEditViewModels eventEditViewModelValidator) { _imageService = imageService; _mediator = mediator; _eventEditViewModelValidator = eventEditViewModelValidator; }
private CampaignAdminControllerBuilder(IMediator mediator, IImageService imageService, IImageSizeValidator imageSizeValidator) { _mediator = mediator; _imageService = imageService; _imageSizeValidator = imageSizeValidator; }
public static CampaignAdminControllerBuilder WithInstances(IMediator mediatorObject, IImageService imageService) { return(new CampaignAdminControllerBuilder(mediatorObject, imageService, null)); }
public GetImageAbsoluteUriHandler(IImageService imageService) { _imageService = imageService; }
public ImageController(IConfiguration config, ImageContext context, ICloudService cloudService, IImageService imageService) { _config = config; _context = context; _cloudService = cloudService; _imageService = imageService; }
public BlogCategoriesController(ApplicationDbContext context, IImageService imageService) { _context = context; _imageService = imageService; }
public ShareViewModel(IPatternClient client, IFavoritesService favoritesService, IImageService imageService, IMvxMessenger messenger) : base(client, favoritesService, imageService, messenger) { }
public ManagementController(IUserManager userManager, IImageService imageService) { this.userManager = userManager; this.imageService = imageService; }
#pragma warning restore RECS0108 // Warns about static fields in generic types public PlatformImageLoaderTask(ITarget <PImage, TImageView> target, TaskParameter parameters, IImageService imageService) : base(ImageCache.Instance, target, parameters, imageService) { }
public CountryService(ICountryRepository countryRepository, IImageService imageService) { CountryRepository = countryRepository; ImageService = imageService; }
public AlbumService(IAsyncRepository <Album> albumRepository, IImageService imageService) { _albumRepository = albumRepository; _imageService = imageService; }
public DishController(IDishService dishService, ICategoryService categoryService, IImageService imageService) { _categoryService = categoryService; _dishService = dishService; _imageService = imageService; }
public ImagesController(IHostingEnvironment hostingEnvironment, IImageService imageService) { _hostingEnvironment = hostingEnvironment; _imageService = imageService; }
public DestinationsController(IDestinationService destinationService, IMappingService mappingService, IImageService imageService) : base(mappingService, imageService) { Guard.WhenArgument(destinationService, "Destination service is null.").IsNull().Throw(); this.destinationService = destinationService; }
public PlatformImageLoaderTask(ITarget <WriteableBitmap, TImageView> target, TaskParameter parameters, IImageService imageService, Configuration configuration, IMainThreadDispatcher mainThreadDispatcher) : base(ImageCache.Instance, configuration.DataResolverFactory ?? DataResolvers.DataResolverFactory.Instance, target, parameters, imageService, configuration, mainThreadDispatcher, false) { }
/// <summary> /// Processes the image. /// </summary> /// <param name="context"> /// the <see cref="T:System.Web.HttpContext">HttpContext</see> object that provides /// references to the intrinsic server objects /// </param> /// <returns> /// The <see cref="T:System.Threading.Tasks.Task"/>. /// </returns> private async Task ProcessImageAsync(HttpContext context) { HttpRequest request = context.Request; // Should we ignore this request? if (request.RawUrl.ToUpperInvariant().Contains("IPIGNORE=TRUE")) { return; } IImageService currentService = this.GetImageServiceForRequest(request); if (currentService != null) { bool isFileLocal = currentService.IsFileLocalService; bool hasMultiParams = request.Url.ToString().Count(f => f == '?') > 1; string requestPath = string.Empty; string queryString = string.Empty; string urlParameters = string.Empty; if (hasMultiParams) { // We need to split the querystring to get the actual values we want. string urlDecode = HttpUtility.UrlDecode(request.QueryString.ToString()); if (!string.IsNullOrWhiteSpace(urlDecode)) { // UrlDecode seems to mess up in some circumstance. if (urlDecode.IndexOf("://", StringComparison.OrdinalIgnoreCase) == -1) { urlDecode = urlDecode.Replace(":/", "://"); } string[] paths = urlDecode.Split('?'); requestPath = paths[0]; // Handle extension-less urls. if (paths.Length > 2) { queryString = paths[2]; urlParameters = paths[1]; } else if (paths.Length > 1) { queryString = paths[1]; } } } else { if (string.IsNullOrWhiteSpace(currentService.Prefix)) { requestPath = HostingEnvironment.MapPath(request.Path); queryString = HttpUtility.UrlDecode(request.QueryString.ToString()); } else { requestPath = HttpUtility.UrlDecode(request.QueryString.ToString()); } } // Replace any presets in the querystring with the actual value. queryString = this.ReplacePresetsInQueryString(queryString); // Execute the handler which can change the querystring queryString = this.CheckQuerystringHandler(queryString, request.RawUrl); // If the current service doesn't require a prefix, don't fetch it. // Let the static file handler take over. if (string.IsNullOrWhiteSpace(currentService.Prefix) && string.IsNullOrWhiteSpace(queryString)) { return; } string parts = !string.IsNullOrWhiteSpace(urlParameters) ? "?" + urlParameters : string.Empty; string fullPath = string.Format("{0}{1}?{2}", requestPath, parts, queryString); object resourcePath; if (hasMultiParams) { resourcePath = string.IsNullOrWhiteSpace(urlParameters) ? new Uri(requestPath, UriKind.RelativeOrAbsolute) : new Uri(requestPath + "?" + urlParameters, UriKind.RelativeOrAbsolute); } else { resourcePath = requestPath; } // Check whether the path is valid for other requests. if (resourcePath == null || !currentService.IsValidRequest(resourcePath.ToString())) { return; } // Create a new cache to help process and cache the request. DiskCache cache = new DiskCache(requestPath, fullPath, queryString); string cachedPath = cache.CachedPath; // Since we are now rewriting the path we need to check again that the current user has access // to the rewritten path. // Get the user for the current request // If the user is anonymous or authentication doesn't work for this suffix avoid a NullReferenceException // in the UrlAuthorizationModule by creating a generic identity. string virtualCachedPath = cache.VirtualCachedPath; IPrincipal user = context.User ?? new GenericPrincipal(new GenericIdentity(string.Empty, string.Empty), new string[0]); // Do we have permission to call UrlAuthorizationModule.CheckUrlAccessForPrincipal? PermissionSet permission = new PermissionSet(PermissionState.None); permission.AddPermission(new AspNetHostingPermission(AspNetHostingPermissionLevel.Unrestricted)); bool hasPermission = permission.IsSubsetOf(AppDomain.CurrentDomain.PermissionSet); bool isAllowed = true; // Run the rewritten path past the authorization system again. // We can then use the result as the default "AllowAccess" value if (hasPermission && !context.SkipAuthorization) { isAllowed = UrlAuthorizationModule.CheckUrlAccessForPrincipal(virtualCachedPath, user, "GET"); } if (isAllowed) { // Is the file new or updated? bool isNewOrUpdated = cache.IsNewOrUpdatedFile(cachedPath); // Only process if the file has been updated. if (isNewOrUpdated) { // Process the image. using (ImageFactory imageFactory = new ImageFactory(preserveExifMetaData != null && preserveExifMetaData.Value)) { using (await this.locker.LockAsync(cachedPath)) { byte[] imageBuffer = await currentService.GetImage(resourcePath); using (MemoryStream memoryStream = new MemoryStream(imageBuffer)) { // Reset the position of the stream to ensure we're reading the correct part. memoryStream.Position = 0; // Process the Image imageFactory.Load(memoryStream).AutoProcess(queryString).Save(cachedPath); // Add to the cache. cache.AddImageToCache(cachedPath); // Store the cached path, response type, and cache dependency in the context for later retrieval. context.Items[CachedPathKey] = cachedPath; context.Items[CachedResponseTypeKey] = imageFactory.CurrentImageFormat.MimeType; context.Items[CachedResponseFileDependency] = new List <string> { cachedPath }; } } } } // Image is from the cache so the mime-type will need to be set. if (context.Items[CachedResponseTypeKey] == null) { string mimetype = ImageHelpers.GetMimeType(cachedPath); if (!string.IsNullOrEmpty(mimetype)) { context.Items[CachedResponseTypeKey] = mimetype; } } if (context.Items[CachedResponseFileDependency] == null) { if (isFileLocal) { // Some services might only provide filename so we can't monitor for the browser. context.Items[CachedResponseFileDependency] = Path.GetFileName(requestPath) == requestPath ? new List <string> { cachedPath } : new List <string> { requestPath, cachedPath }; } else { context.Items[CachedResponseFileDependency] = new List <string> { cachedPath }; } } // The cached file is valid so just rewrite the path. context.RewritePath(virtualCachedPath, false); } else { throw new HttpException(403, "Access denied"); } } }
public StorageController(IImageService imageService, IArticleService articleService, IUserService userService) { _imageService = imageService; _articleService = articleService; _userService = userService; }
public ServiceService(IUnitOfWork unitOfWork, IImageService imageService) { _unitOfWork = unitOfWork; _imageService = imageService; }
public SitecoreImageNodeConverter(IImageService imageService, ISitecoreContext sitecoreContext) { _imageService = imageService; _sitecoreContext = sitecoreContext; }