private void Handler_HasCome(object sender, Message msg) { _toServiceMessenger = Utils.GetAnswerMessenger(msg); switch ((ServiceOperation)msg.What) { case ServiceOperation.GetClientSettings: _callbacks.Dequeue(ServiceOperation.GetClientSettings, Utils.GetData <ConnectionCredentials>(msg)); break; case ServiceOperation.GetIsConnected: _callbacks.Dequeue(ServiceOperation.GetIsConnected, Utils.GetData <ManagerConnectionState>(msg)); break; case ServiceOperation.GetScenarios: _callbacks.Dequeue(ServiceOperation.GetScenarios, Utils.GetData <ScenarioInfo[]>(msg)); break; case ServiceOperation.GetNotifications: _callbacks.Dequeue(ServiceOperation.GetNotifications, Utils.GetData <LazuriteNotification[]>(msg)); break; case ServiceOperation.ConnectionLost: ConnectionLost?.Invoke(); break; case ServiceOperation.ConnectionRestored: ConnectionRestored?.Invoke(); break; case ServiceOperation.CredentialsInvalid: LoginOrPasswordInvalid?.Invoke(); break; case ServiceOperation.CredentialsLoaded: CredentialsLoaded?.Invoke(); break; case ServiceOperation.NeedClientSettings: NeedClientSettings?.Invoke(); break; case ServiceOperation.NeedRefresh: NeedRefresh?.Invoke(); break; case ServiceOperation.ScenariosChanged: ScenariosChanged?.Invoke(Utils.GetData <ScenarioInfo[]>(msg)); break; case ServiceOperation.SecretCodeInvalid: SecretCodeInvalid?.Invoke(); break; case ServiceOperation.ConnectionError: ConnectionError?.Invoke(); break; } }
private void TryLoadClientSettings() { if (Savior.Has(_credentialsKey)) { try { _credentials = Savior.Get <ConnectionCredentials>(_credentialsKey); CredentialsLoaded?.Invoke(); } catch { Savior.Clear(_credentialsKey); } } }