Example #1
0
        private void InitAvatarPool()
        {
            // Get AvatarPool and initialize it
            string avatarsFolderPath = Helper.GetAvatarsFolderPath();

            // FOR TEST PURPOSE ONLY
            //if (Directory.Exists(avatarsFolderPath))
            //    Directory.Delete(avatarsFolderPath, true);

            // We create Avatars service
            RbAvatars = Avatars.Instance;
            RbAvatars.SetApplication(RbApplication);
            RbAvatars.SetDensity((float)Helper.GetDensity());
            RbAvatars.SetFolderPathUsedToStoreAvatars(avatarsFolderPath);
            RbAvatars.AllowAvatarDownload(true);
            RbAvatars.AllowToAskInfoForUnknownContact(true);
            RbAvatars.AllowToAskInfoAboutUnknowBubble(true);

            RbAvatars.PeerAvatarUpdated += RbAvatars_PeerAvatarUpdated;

            if (!RbAvatars.Initialize())
            {
                log.LogError("CANNOT initialize Avatars service ...");
            }
        }
Example #2
0
        public TestSdkWrapper()
        {
            // We just need to create it to use it in "Avatars" constructor
            RbApplication = new Rainbow.Application(Helper.GetAppFolderPath());
            RbApplication.SetApplicationInfo(ApplicationInfo.APP_ID, ApplicationInfo.APP_SECRET_KEY);
            RbApplication.SetHostInfo(ApplicationInfo.HOST_NAME);

            // Get AvatarPool and initialize it
            string avatarsFolderPath = Helper.GetAvatarsFolderPath();

            RbAvatars = Avatars.Instance;
            RbAvatars.SetApplication(RbApplication);
            RbAvatars.SetDensity((float)Helper.GetDensity());
            RbAvatars.SetFolderPathUsedToStoreAvatars(avatarsFolderPath);

            if (!RbAvatars.Initialize())
            {
                log.LogError("CANNOT initialize Avatars service ...");
            }

            // Set default max size to Thumbnail
            MaxThumbnailWidth = MaxThumbnailHeight = 300;
        }