private async Task <bool> InitializeConnection() { bool connectionEstablished = false; // TODO: Secure Storage isn't working, need to figure that out. Probs cause the app is removed and readded each debug session. var infoJson = await SecureStorage.GetAsync("Foo"); var conInfo = (infoJson != null) ? JsonConvert.DeserializeObject <TCConnectionData>(infoJson) : null; #if DEBUG conInfo = new TCConnectionData() { Url = "192.168.56.1", Port = 8080, ConnectionType = ConnectionType.Guest }; #endif // Attempt to connect if (conInfo != null) { try { Connection.Instance.InitializeConnection(conInfo); connectionEstablished = await Connection.Instance.TestConnection().ConfigureAwait(false); } catch { // TODO: may want to be a bit more helpful here, maybe a toast message. connectionEstablished = false; } } return(connectionEstablished); }
private async void StoreConnectionInfo(TCConnectionData connectionData) { //-- THIS NEEDS ENCRYPTION await SecureStorage.SetAsync("TCConnection", JsonConvert.SerializeObject(connectionData)); }