Beispiel #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();
            rainbowInstantMessaging = rainbowApplication.GetInstantMessaging();

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

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

            rainbowContacts.ContactPresenceChanged += RainbowContacts_ContactPresenceChanged;

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

            rainbowInstantMessaging.MessageReceived   += RainbowInstantMessaging_MessageReceived;
            rainbowInstantMessaging.ReceiptReceived   += RainbowInstantMessaging_ReceiptReceived;
            rainbowInstantMessaging.UserTypingChanged += RainbowInstantMessaging_UserTypingChanged;

            rainbowContactsList = new List <Contact>();


            // Get Login/password used successfully in last connexion
            String login = rainbowApplication.GetUserLoginFromCache();

            if (!String.IsNullOrEmpty(login))
            {
                tbLogin.Text = login;
            }

            String pwd = rainbowApplication.GetUserPasswordFromCache();

            if (!String.IsNullOrEmpty(pwd))
            {
                tbPassword.Text = pwd;
            }

            // Get INI File Parser
            rainbowIniFileParser = rainbowApplication.GetIniFileParser();

            // Get AutoLogon settings and launch login process automatically if set
            String autoLogon = rainbowIniFileParser.GetValue("AutoLogon", "Settings", "false");

            if (autoLogon != "true")
            {
                cbAutoLogon.Checked = false;
            }
            else
            {
                cbAutoLogon.Checked = true;

                btnLoginLogout_Click(null, null);
            }
        }