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>(); }
public RainbowSdkWrapper() { RbApplication = new Rainbow.Application(Helper.GetAppFolderPath()); RbApplication.SetTimeout(10000); RbApplication.SetApplicationInfo(ApplicationInfo.APP_ID, ApplicationInfo.APP_SECRET_KEY); RbApplication.SetHostInfo(ApplicationInfo.HOST_NAME); // Set Mobile application RbApplication.Restrictions.MobileApplication = !Helper.IsDesktopPlatform(); // Use Stream Management RbApplication.Restrictions.StreamManagement = true; // Use Auto Reconnection RbApplication.Restrictions.AutoReconnection = true; RbBubbles = RbApplication.GetBubbles(); RbContacts = RbApplication.GetContacts(); RbConversations = RbApplication.GetConversations(); RbInstantMessaging = RbApplication.GetInstantMessaging(); RbFileStorage = RbApplication.GetFileStorage(); // Manage "File Storage" service events RbFileStorage.FileDownloadUpdated += RbFileStorage_FileDownloadUpdated; RbFileStorage.FileUploadUpdated += RbFileStorage_FileUploadUpdated; // Manage "Instant Messaging" service events RbInstantMessaging.MessageReceived += RbInstantMessaging_MessageReceived; RbInstantMessaging.ReceiptReceived += RbInstantMessaging_ReceiptReceived; RbInstantMessaging.MessagesAllRead += RbInstantMessaging_MessagesAllRead; RbInstantMessaging.UserTypingChanged += RbInstantMessaging_UserTypingChanged; // Manage "Contacts" service events RbContacts.PeerAdded += RbContacts_PeerAdded; RbContacts.PeerInfoChanged += RbContacts_PeerInfoChanged; RbContacts.ContactAggregatedPresenceChanged += RbContacts_ContactAggregatedPresenceChanged; RbContacts.ContactPresenceChanged += RbContacts_ContactPresenceChanged; // Manage "Conversations" service events RbConversations.ConversationCreated += RbConversations_ConversationCreated; RbConversations.ConversationRemoved += RbConversations_ConversationRemoved; RbConversations.ConversationUpdated += RbConversations_ConversationUpdated; // Manage "Bubbles" service events RbBubbles.BubbleInfoUpdated += RbBubbles_BubbleInfoUpdated; // Manage "Application" service events RbApplication.ConnectionStateChanged += RbApplication_ConnectionStateChanged; RbApplication.InitializationPerformed += RbApplication_InitializationPerformed; RbApplication.DataCleared += RbApplication_DataCleared; InitAvatarPool(); InitFilePool(); }
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(); } } }
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); } }