private void ConnectToRainbow() { if (rainbowApplication.IsConnected()) { rainbowApplication.Logout(callback => { if (!callback.Result.Success) { string logline = String.Format("Impossible to logout:\r\n{0}", Util.SerializeSdkError(callback.Result)); AddStateLine(logline); log.Warn(logline); } }); } else { String login = txt_login.StringValue; String password = txt_password.StringValue; rainbowApplication.Login(login, password, callback => { if (callback.Result.Success) { rainbowMyContact = rainbowContacts.GetCurrentContact(); AddStateLine("Welcome " + rainbowMyContact.DisplayName); } else { string logline = String.Format("Impossible to login:\r\n{0}", Util.SerializeSdkError(callback.Result)); AddStateLine(logline); log.Warn(logline); } }); } }
private void btnLoginLogout_Click(object sender, EventArgs e) { if (rainbowApplication.IsConnected()) { // We want to logout rainbowApplication.Logout(callback => { if (!callback.Result.Success) { log.LogInformation("Impossible to logout:\r\n{0}", Util.SerializeSdkError(callback.Result)); } }); } else { String login = tbLogin.Text; String password = tbPassword.Text; // We want to login rainbowApplication.Login(login, password, callback => { if (callback.Result.Success) { // Since we are connected, we get the current contact object rainbowMyContact = rainbowContacts.GetCurrentContact(); if (String.IsNullOrEmpty(rainbowMyContact.Timezone)) { rainbowMyContact.Timezone = "Europe/Paris"; } UpdateMyContactElements(); } else { string logLine = String.Format("Impossible to login:\r\n{0}", Util.SerializeSdkError(callback.Result)); AddStateLine(logLine); log.LogInformation(logLine); } }); } }
public void LoginOrLogoutCommand(object obj) { if (LoginInfoModel.ConnectionState == Rainbow.Model.ConnectionState.Connected) { // Don't use UI Thread to perform network task Task task = new Task(() => { rbApplication.Logout(); }); task.Start(); } else if (LoginInfoModel.ConnectionState == Rainbow.Model.ConnectionState.Disconnected) { // Don't use UI Thread to perform network task Task task = new Task(() => { rbApplication.Login(LoginInfoModel.Login, LoginInfoModel.Password); }); task.Start(); } }
public override void Login(string login, string password, Action <SdkResult <Boolean> > callback = null) { RbApplication.Login(login, password, callback); }
private void btnLoginLogout_Click(object sender, EventArgs e) { if (rainbowApplication.IsConnected()) { // We want to logout rainbowApplication.Logout(callback => { if (!callback.Result.Success) { string logLine = String.Format("Impossible to logout:\r\n{0}", Util.SerializeSdkError(callback.Result)); AddStateLine(logLine); log.LogWarning(logLine); } }); } else { // Check event mode used: if (cbUseS2SEventMode.Checked) { // We want to use S2S Event mode rainbowApplication.Restrictions.EventMode = Restrictions.SDKEventMode.S2S; // We must specify also the callback URL String callbackUrl = tbCallbackUrl.Text; rainbowApplication.SetS2SCallbackUrl(callbackUrl); // We must also create and start a local web server - here we use 9870 for our local web server if (webServer == null) { webServer = CreateWebServer("http://localhost:9870", callbackUrl); webServer.RunAsync(); } } else { // We use XMMPP mode (std mode) rainbowApplication.Restrictions.EventMode = Restrictions.SDKEventMode.XMPP; } String login = tbLogin.Text; String password = tbPassword.Text; // We want to login rainbowApplication.Login(login, password, callback => { if (callback.Result.Success) { // Since we are connected, we get the current contact object rainbowMyContact = rainbowContacts.GetCurrentContact(); } else { string logLine = String.Format("Impossible to login:\r\n{0}", Util.SerializeSdkError(callback.Result)); AddStateLine(logLine); log.LogWarning(logLine); } }); } }