Example #1
0
        private void InitializeRainbowSDK()
        {
            rainbowApplication = new Rainbow.Application();;

            // Set Application Id, Secret Key and Host Name
            rainbowApplication.SetApplicationInfo(APP_ID, APP_SECRET_KEY);
            rainbowApplication.SetHostInfo(HOST_NAME);

            // Get Rainbow main objects
            rainbowContacts      = rainbowApplication.GetContacts();
            rainbowConversations = rainbowApplication.GetConversations();
            rainbowFavorites     = rainbowApplication.GetFavorites();

            // EVENTS WE WANT TO MANAGE
            rainbowApplication.ConnectionStateChanged += RainbowApplication_ConnectionStateChanged;

            rainbowContacts.RosterPeerAdded   += RainbowContacts_RosterPeerAdded;
            rainbowContacts.RosterPeerRemoved += RainbowContacts_RosterPeerRemoved;

            rainbowConversations.ConversationCreated += RainbowConversations_ConversationCreated;
            rainbowConversations.ConversationRemoved += RainbowConversations_ConversationRemoved;

            rainbowFavorites.FavoriteCreated += RainbowFavorites_FavoriteCreated;
            rainbowFavorites.FavoriteRemoved += RainbowFavorites_FavoriteRemoved;

            rainbowContactsList = new List <Contact>();
        }
Example #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            InitLogsWithNLog();
            log = Rainbow.LogFactory.CreateLogger <App>();

            string appFolderPath = Path.Combine(Helper.GetTempFolder(), LogFolderName);

            RbApplication = new Rainbow.Application(appFolderPath);
            RbApplication.SetTimeout(10000);

            RbApplication.SetApplicationInfo(AppConfiguration.APP_ID, AppConfiguration.APP_SECRET_KEY);
            RbApplication.SetHostInfo(AppConfiguration.HOST_NAME);
            RbApplication.SetWebProxyInfo(null);

            RbBubbles          = RbApplication.GetBubbles();
            RbContacts         = RbApplication.GetContacts();
            RbConversations    = RbApplication.GetConversations();
            RbFavorites        = RbApplication.GetFavorites();
            RbInstantMessaging = RbApplication.GetInstantMessaging();
            RbFileStorage      = RbApplication.GetFileStorage();

            InitAvatarPool();
            InitFilePool();

            if (!USE_DUMMY_DATA)
            {
                LoginWindow = new LoginView();
                LoginWindow.Show();
            }
            else
            {
                CurrentUserId  = "1";
                CurrentUserJid = "1";

                if (USE_DUMMY_DATA && USE_LOGIN_FORM_WITH_DUMMY_DATA)
                {
                    LoginWindow = new LoginView();
                    LoginWindow.Show();
                }
                else
                {
                    ApplicationMainWindow = new MainView();
                    ApplicationMainWindow.Show();
                }
            }
        }