static void Main(string[] args) { Application app = new Application(); ConnectionInfos cis = app.ConnectionInfos; foreach (ConnectionInfo x in cis) Console.WriteLine("Connection Type" + x.ConnectionType); }
private void RemovePlayer(ConnectionInfos infos) { for (int i = 0; i < connectedPlayers.Length; i++) { if (connectedPlayers[i] != null && connectedPlayers[i].accessKey == infos.accessKey) { keysPressed[infos.accessKey] = false; connectedPlayers[i] = null; OnPlayerEvent.Invoke(i, infos, false); break; } } }
private void AddPlayer(ConnectionInfos infos) { for (int i = 0; i < connectedPlayers.Length; i++) { if (connectedPlayers[i] == null) { keysPressed[infos.accessKey] = true; connectedPlayers[i] = infos; OnPlayerEvent.Invoke(i, infos, true); break; } } }
private void AddConnectionInfo(string connectionName, string connectionString) { var connInfo = new ConnectionInfo(connectionName, connectionString); ConnectionInfos.Add(connInfo); }
public async Task <bool> ConnectQA(ConnectionInfos connectInfos) { // if (AppConstants.OfflineEnabled) // { // //lstType.Add(typeof(ListHeaderWO)); // //lstType.Add(typeof(UserInfosOffline)); // //lstType.Add(typeof(CustomerOrderDB)); // try // { // Repository<ListHeaderWO> repoListHeaderWO = new Repository<ListHeaderWO>(); //await repoListHeaderWO.DeleteAllAsync(); // Repository<UserInfosOffline> repoUserInfosOffline = new Repository<UserInfosOffline>(); //await repoUserInfosOffline.DeleteAllAsync(); //Repository<ObjectFieldMap> repoCustomerOrderDB = new Repository<ObjectFieldMap>(); //await repoCustomerOrderDB.DeleteAllAsync(); // //Task.WaitAll(t1, t2, t3); // } // catch(Exception ex) // { // var msg = ex.Message; // } // } isConnected = false; isLoggedOff = true; LastQueryURL = string.Empty; LastResultString = string.Empty; HttpClient authClient = null; if (Device.OS == TargetPlatform.iOS) { authClient = new HttpClient(); } else { authClient = new HttpClient(new NativeMessageHandler()); } //set OAuth key and secret variables string sfdcConsumerKey = connectInfos.ConsumerKey; string sfdcConsumerSecret = connectInfos.ConsumerSecret; HttpContent content = null; string codenew = ConnectionInfos.Instance.code.Replace("%3D", "="); Debug.WriteLine("Code" + codenew); if (AppConstants.SFPointing == "QA") { content = new FormUrlEncodedContent(new Dictionary <string, string> { { "grant_type", "authorization_code" }, { "code", codenew }, { "client_id", "3MVG9ZL0ppGP5UrDhS8a_1kOJZ5ihoBL70D8.rWXY2sIkEwjBOA8MDB10od0aOdu_jhzcLqw2F3t6nv0M2pWZ" }, { "client_secret", "1254695708531707837" }, { "redirect_uri", "https://arun-zone-dev-ed.my.salesforce.com/auth/success" } } ); } LastQueryURL = content.ToString(); HttpResponseMessage message = null; if (AppConstants.SFPointing == "QA") { //message = await authClient.PostAsync(UrlAuthToken, content); message = await authClient.PostAsync(AppConstants.UrlAuthTokenQA, content); } else if (AppConstants.SFPointing == "Prod") { message = await authClient.PostAsync(AppConstants.UrlAuthTokenProd, content); } string responseString = await message.Content.ReadAsStringAsync(); Debug.WriteLine(responseString); if (responseString.Length != 0) { if (!responseString.Contains("error_description")) { JObject obj = JObject.Parse(responseString); UserInfos.Instance.access_token = (string)obj["access_token"]; UserInfos.Instance.refresh_token = (string)obj["refresh_token"]; UserInfos.Instance.sfdc_community_url = (string)obj["sfdc_community_url"]; UserInfos.Instance.sfdc_community_id = (string)obj["sfdc_community_id"]; UserInfos.Instance.signature = (string)obj["signature"]; UserInfos.Instance.scope = (string)obj["scope"]; UserInfos.Instance.id_token = (string)obj["id_token"]; UserInfos.Instance.instance_url = (string)obj["instance_url"]; UserInfos.Instance.id = (string)obj["id"]; UserInfos.Instance.token_type = (string)obj["token_type"]; UserInfos.Instance.issued_at = (string)obj["issued_at"]; // Constante de l'URL serviceUrl = UserInfos.Instance.instance_url; isConnected = true; isLoggedOff = false; } } return(isConnected); }