private void InitLogin(LoginSuccessHandler loginSuccessHandler) { _LoggingWorker.DoWork += new DoWorkEventHandler(LoggingWorker_DoWork); _LoggingWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(LoggingWorker_RunWorkerCompleted); if (loginSuccessHandler != null) { OnLoginSuccess += loginSuccessHandler; } InitializeComponent(); tbUser.Focus(); if (IsExistCookie()) { Cookie cookie = Cookie.Instance; LoginPanel.Visibility = System.Windows.Visibility.Collapsed; ProcessPanel.Visibility = System.Windows.Visibility.Visible; UserLogging.Text = cookie["user"].ToString(); _LoggingWorker.RunWorkerAsync(new LoginMetadata(true, cookie["user"].ToString(), cookie["pass"].ToString(), true)); } }
/************ * Unity callback methods ************/ new void Awake() { base.Awake(); serverPublicKeyHandler = new ServerPublicKeyHandler(); loginSuccessHandler = new LoginSuccessHandler(); // Register callback delegate smartFox.AddEventListener(SFSEvent.CONNECTION, OnConnection); smartFox.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost); smartFox.AddEventListener(SFSEvent.LOGIN, OnLogin); smartFox.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError); smartFox.AddEventListener(SFSEvent.LOGOUT, OnLogout); smartFox.AddEventListener(SFSEvent.MODERATOR_MESSAGE, OnMod); smartFox.AddLogListener(LogLevel.DEBUG, OnDebugMessage); serverPublicKeyHandler.afterMessageRecieved += Login_AfterServerPKRecieved; loginSuccessHandler.afterMessageRecieved += OnLoginSuccess; handlers.Add("publickey", serverPublicKeyHandler); handlers.Add("loginsuccess", loginSuccessHandler); }
public static extern int createRtmService(string appId, SendMessageReceivedHandler smr, PeerMessageReceivedHandler pmr, LoginSuccessHandler lsc, LoginFailureHandler lfc, QueryStatusReceivedHandler qus, SubscriptionRequestHandler src, GetChannelMembersCountHandler gcmc);
public Login(LoginSuccessHandler loginSuccessHandler) { InitLogin(loginSuccessHandler); }
/************ * Unity callback methods ************/ new void Awake() { base.Awake(); serverPublicKeyHandler = new ServerPublicKeyHandler(); loginSuccessHandler = new LoginSuccessHandler(); // Register callback delegate smartFox.AddEventListener(SFSEvent.CONNECTION, OnConnection); smartFox.AddEventListener(SFSEvent.CONNECTION_LOST, OnConnectionLost); smartFox.AddEventListener(SFSEvent.LOGIN, OnLogin); smartFox.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError); smartFox.AddEventListener(SFSEvent.LOGOUT, OnLogout); smartFox.AddEventListener(SFSEvent.MODERATOR_MESSAGE, OnMod); smartFox.AddLogListener(LogLevel.DEBUG, OnDebugMessage); serverPublicKeyHandler.afterMessageRecieved += Login_AfterServerPKRecieved; loginSuccessHandler.afterMessageRecieved += OnLoginSuccess; handlers.Add("publickey", serverPublicKeyHandler); handlers.Add("loginsuccess", loginSuccessHandler); }