static void Main(string[] args) { var appServiceClient = new AppServiceClient(GW_URL); var deckClient = appServiceClient.CreateAzureCardsClient(); var deckId = deckClient.Deck.New(); Console.WriteLine(string.Format("Your new Deck ID is {0}", deckId)); // shuffle the deck for (int i = 0; i < 10; i++) { deckClient.Deck.Shuffle(deckId); } // deal a hand and show it var hand = deckClient.Deck.Deal(deckId, 11); foreach (var card in hand.Cards) { Console.WriteLine($"{card.Face} of {card.Suit}"); } Console.WriteLine("Press enter to exit"); Console.ReadLine(); }
static void Main(string[] args) { var appServiceClient = new AppServiceClient(GW_URL); var deckClient = appServiceClient.CreateAzureCardsClient(); var deckId = deckClient.Deck.New(); Console.WriteLine(string.Format("Your new Deck ID is {0}", deckId)); // shuffle the deck for(int i=0; i<10; i++) deckClient.Deck.Shuffle(deckId); // deal a hand and show it var hand = deckClient.Deck.Deal(deckId, 11); foreach (var card in hand.Cards) Console.WriteLine($"{card.Face} of {card.Suit}"); Console.WriteLine("Press enter to exit"); Console.ReadLine(); }
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (e.Url.AbsoluteUri.IndexOf(URL_TOKEN) > -1) { var encodedJson = e.Url.AbsoluteUri.Substring(e.Url.AbsoluteUri.IndexOf(URL_TOKEN) + URL_TOKEN.Length); var decodedJson = Uri.UnescapeDataString(encodedJson); var result = JsonConvert.DeserializeObject <dynamic>(decodedJson); string userId = result.user.userId; string userToken = result.authenticationToken; var appServiceClient = new AppServiceClient(GW_URL); appServiceClient.SetCurrentUser(userId, userToken); var deckClient = appServiceClient.CreateAzureCardsClient(); var deckId = deckClient.Deck.New(); webBrowser1.Visible = false; _deckIdLabel.Text = string.Format("Your new Deck ID is {0}", deckId); _deckIdLabel.Visible = true; } }
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (e.Url.AbsoluteUri.IndexOf(URL_TOKEN) > -1) { var encodedJson = e.Url.AbsoluteUri.Substring(e.Url.AbsoluteUri.IndexOf(URL_TOKEN) + URL_TOKEN.Length); var decodedJson = Uri.UnescapeDataString(encodedJson); var result = JsonConvert.DeserializeObject<dynamic>(decodedJson); string userId = result.user.userId; string userToken = result.authenticationToken; var appServiceClient = new AppServiceClient(GW_URL); appServiceClient.SetCurrentUser(userId, userToken); var deckClient = appServiceClient.CreateAzureCardsClient(); var deckId = deckClient.Deck.New(); webBrowser1.Visible = false; _deckIdLabel.Text = string.Format("Your new Deck ID is {0}", deckId); _deckIdLabel.Visible = true; } }
static void Main(string[] args) { string deckId = string.Empty; Form frm = new Form(); WebBrowser browser = new WebBrowser(); browser.Dock = DockStyle.Fill; browser.DocumentCompleted += (sender, e) => { if (e.Url.AbsoluteUri.IndexOf(URL_TOKEN) > -1) { var encodedJson = e.Url.AbsoluteUri.Substring(e.Url.AbsoluteUri.IndexOf(URL_TOKEN) + URL_TOKEN.Length); var decodedJson = Uri.UnescapeDataString(encodedJson); var result = JsonConvert.DeserializeObject <dynamic>(decodedJson); string userId = result.user.userId; string userToken = result.authenticationToken; var appServiceClient = new AppServiceClient(GW_URL); appServiceClient.SetCurrentUser(userId, userToken); var deckClient = appServiceClient.CreateAzureCardsClient(); deckId = deckClient.Deck.New(); frm.Close(); } }; browser.Navigate(string.Format(@"{0}login/twitter", GW_URL)); frm.Controls.Add(browser); frm.ShowDialog(); Console.WriteLine(string.Format("Your new Deck ID is {0}", deckId)); Console.WriteLine("Press enter to exit"); Console.ReadLine(); }
static void Main(string[] args) { string deckId = string.Empty; Form frm = new Form(); WebBrowser browser = new WebBrowser(); browser.Dock = DockStyle.Fill; browser.DocumentCompleted += (sender, e) => { if (e.Url.AbsoluteUri.IndexOf(URL_TOKEN) > -1) { var encodedJson = e.Url.AbsoluteUri.Substring(e.Url.AbsoluteUri.IndexOf(URL_TOKEN) + URL_TOKEN.Length); var decodedJson = Uri.UnescapeDataString(encodedJson); var result = JsonConvert.DeserializeObject<dynamic>(decodedJson); string userId = result.user.userId; string userToken = result.authenticationToken; var appServiceClient = new AppServiceClient(GW_URL); appServiceClient.SetCurrentUser(userId, userToken); var deckClient = appServiceClient.CreateAzureCardsClient(); deckId = deckClient.Deck.New(); frm.Close(); } }; browser.Navigate(string.Format(@"{0}login/twitter", GW_URL)); frm.Controls.Add(browser); frm.ShowDialog(); Console.WriteLine(string.Format("Your new Deck ID is {0}", deckId)); Console.WriteLine("Press enter to exit"); Console.ReadLine(); }