예제 #1
0
        /// <summary>
        /// Checks whether the file is allowed to be used as an avatar
        /// </summary>
        /// <param name="postedFile">A posted image file</param>
        public static bool IsFileAllowed(this IAvatarsService service, HttpPostedFileBase postedFile)
        {
            if (postedFile == null)
            {
                return(false);
            }

            return(service.IsFileAllowed(postedFile.FileName));
        }
 public RocketChatRestApi(
     IToastNotificationsService toastService,
     IAvatarsService avatarsService,
     IEventAggregator eventAggregator)
 {
     this.toastService    = toastService;
     this.avatarsService  = avatarsService;
     this.eventAggregator = eventAggregator;
     this.eventAggregator.GetEvent <ServerAddressChangedEvent>().Subscribe(ServerAddressChangedHandler);
     GetServerAddress();
 }
        public AvatarPartHandler(
            IAvatarsService avatarsService)
        {
            _avatarsService = avatarsService;

            OnLoaded<AvatarPart>((context, part) =>
                {
                    // Add loaders that will load content just-in-time
                    part.ImageUrlField.Loader(() => _avatarsService.GetAvatarUrl(part.As<CommonPart>().Owner.Id));
                });
        }
        public AvatarProfilePartHandler(
            IRepository<AvatarProfilePartRecord> repository,
            IAvatarsService avatarsService)
        {
            Filters.Add(StorageFilter.For(repository));

            _avatarsService = avatarsService;

            OnLoaded<AvatarProfilePart>((context, part) =>
                {
                    // Add loaders that will load content just-in-time
                    part.ImageUrlField.Loader(() => _avatarsService.GetAvatarUrl(part.Id));
                });
        }
        public AvatarsEventHandler(IAvatarsService avatarsService)
        {
            _avatarsService = avatarsService;

            Logger = NullLogger.Instance;
        }
예제 #6
0
 public AvatarProfilePartDriver(IAvatarsService avatarsService)
 {
     _avatarsService = avatarsService;
 }
예제 #7
0
 public Migrations(IAvatarsService avatarsService)
 {
     _avatarsService = avatarsService;
 }
예제 #8
0
 public void Init()
 {
     this.users = TestObjectFactory.Users;
     this.avatarsService = TestObjectFactory.GetAvatarsService();
     this.avatarController = new AvatarsController(this.avatarsService);
 }
예제 #9
0
 public Migrations(IAvatarsService avatarsService, IStorageProvider storageProvider)
 {
     _avatarsService = avatarsService;
     _storageProvider = storageProvider;
 }
 public Migrations(IAvatarsService avatarsService)
 {
     _avatarsService = avatarsService;
 }
 public AvatarsController(IAvatarsService avatars)
 {
     this.avatarsService = avatars;
 }
예제 #12
0
 public AvatarsController(IAvatarsService avatarServicePassed)
 {
     this.avatars = avatarServicePassed;
 }
예제 #13
0
 /// <summary>
 /// Saves an avatar file
 /// </summary>
 /// <param name="id">Id of the content item (user) to attach the file to</param>
 /// <param name="postedFile">A posted image file</param>
 /// <returns>True or false indicating success or failure</returns>
 public static bool SaveAvatarFile(this IAvatarsService service, int id, HttpPostedFileBase postedFile)
 {
     return(service.SaveAvatarFile(id, postedFile.InputStream, Path.GetExtension(postedFile.FileName)));
 }
예제 #14
0
 /// <summary>
 /// Saves an avatar file
 /// </summary>
 /// <param name="avatar">The actual AvatarProfilePart attach the file to</param>
 /// <param name="postedFile">A posted image file</param>
 /// <returns>True or false indicating success or failure</returns>
 public static bool SaveAvatarFile(this IAvatarsService service, AvatarProfilePart avatar, HttpPostedFileBase postedFile)
 {
     return(service.SaveAvatarFile(avatar.Id, postedFile));
 }
        public AvatarsEventHandler(IAvatarsService avatarsService)
        {
            _avatarsService = avatarsService;

            Logger = NullLogger.Instance;
        }