private static void AuthorizeClient(AppServiceClient appServiceClient) { Form frm = new Form(); frm.Width = 640; frm.Height = 480; 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; appServiceClient.SetCurrentUser(userId, userToken); frm.Close(); } }; browser.Navigate(string.Format(@"{0}login/twitter", GW_URL)); frm.Controls.Add(browser); frm.ShowDialog(); }
public void HandleLogon(Uri uri) { var encodedJson = uri.AbsoluteUri.Substring( uri.AbsoluteUri.IndexOf(WellKnown.UrlToken) + WellKnown.UrlToken.Length); var decodedJson = Uri.UnescapeDataString(encodedJson); var result = JsonConvert.DeserializeObject <dynamic>(decodedJson); string userId = result.user.userId; string userToken = result.authenticationToken; var url = Global.GatewayUri.AbsoluteUri; if (!url.EndsWith("/")) { url += "/"; } appServiceClient = new AppServiceClient(url); appServiceClient.SetCurrentUser(userId, userToken); IsLoggedOn = true; }
// Use this for initialization void Start() { // Create App Service client _client = new AppServiceClient(_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable <Inventory> ("Inventory"); // set TSTableView delegate _tableView.dataSource = this; // setup token using Unity Inspector value if (!String.IsNullOrEmpty(_facebookAccessToken)) { InputField inputToken = GameObject.Find("FacebookAccessToken").GetComponent <InputField> (); inputToken.text = _facebookAccessToken; } // hide controls until login CanvasGroup group = GameObject.Find("UserDataGroup").GetComponent <CanvasGroup> (); group.alpha = 0; group.interactable = false; UpdateUI(); }
internal async Task <ForceClient> GetClientForApp() { var gatewayUrl = ConfigurationManager.AppSettings["emA_RuntimeUrl"]; AppServiceClient appServiceClient = new AppServiceClient(gatewayUrl); appServiceClient.SetCurrentUser(this.UserId, this.ZumoToken); var gateway = appServiceClient.CreateApiAppClient(new System.Uri(gatewayUrl)); var result = await gateway.GetAsync(String.Format("/api/tokens?api-version=2015-01-14&tokenName={0}", "salesforce")); var jsonString = await result.Content.ReadAsStringAsync(); JToken json = JToken.Parse(jsonString); if (json["Properties"] == null) { return(null); } var accessToken = json["Properties"]["AccessToken"].ToString(); var instanceUrl = json["Properties"]["InstanceUrl"].ToString(); var apiVersion = "v32.0"; //need to get dynamically Debug.WriteLine("App Service Token:" + jsonString); var client = new ForceClient(instanceUrl, accessToken, apiVersion); Console.WriteLine("Connected to Salesforce, apiVersion:" + apiVersion); return(client); }
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(); }
internal async Task<ForceClient> GetClientForApp() { var gatewayUrl = ConfigurationManager.AppSettings["emA_RuntimeUrl"]; AppServiceClient appServiceClient = new AppServiceClient(gatewayUrl); appServiceClient.SetCurrentUser(this.UserId, this.ZumoToken); var gateway = appServiceClient.CreateApiAppClient(new System.Uri(gatewayUrl)); var result = await gateway.GetAsync(String.Format("/api/tokens?api-version=2015-01-14&tokenName={0}", "salesforce")); var jsonString = await result.Content.ReadAsStringAsync(); JToken json = JToken.Parse(jsonString); if (json["Properties"] == null) { return null; } var accessToken = json["Properties"]["AccessToken"].ToString(); var instanceUrl = json["Properties"]["InstanceUrl"].ToString(); var apiVersion = "v32.0"; //need to get dynamically Debug.WriteLine("App Service Token:" + jsonString); var client = new ForceClient(instanceUrl, accessToken, apiVersion); Console.WriteLine("Connected to Salesforce, apiVersion:" + apiVersion); return client; }
private static void AuthorizeClient(AppServiceClient appServiceClient) { Form frm = new Form(); frm.Width = 640; frm.Height = 480; 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; appServiceClient.SetCurrentUser(userId, userToken); frm.Close(); } }; browser.Navigate(string.Format(@"{0}login/twitter", GW_URL)); frm.Controls.Add(browser); frm.ShowDialog(); }
void Start() { // Create App Service client _client = new AppServiceClient(_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable <AgentInfo>("AgentInfo"); }
// Use this for initialization void Start() { // Create App Service client _client = new AppServiceClient(_appUrl); // Get App Service 'HighScoreScripts' table _table = _client.GetTable <HighScoreData>("Banana_HighScores"); }
// Use this for initialization void Start() { // Create App Service client _client = new AppServiceClient(_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable <Highscore> ("Highscores"); // set TSTableView delegate _tableView.dataSource = this; UpdateUI(); }
//Interface public IssueMgtConfiguration() { //Constructor this.mUConfig = new UserConfiguration(); AppServiceClient configClient = new AppServiceClient(); UserConfiguration c = configClient.GetUserConfiguration2(App.Product, new string[] { Environment.UserName, Environment.MachineName }); foreach (KeyValuePair <object, object> e in c) { this.mUConfig.Add(e.Key, e.Value); } configClient.Close(); }
public MainWindow() { InitializeComponent(); DataContext = this; browser.LoadCompleted += (s, e) => { if (e.Uri.AbsoluteUri.IndexOf(URL_TOKEN) == -1) { return; } try { var encodedJson = e.Uri.AbsoluteUri.Substring( e.Uri.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(GATEWAY_URL); appServiceClient.SetCurrentUser(userId, userToken); var api = appServiceClient.CreateBlobSmartAPI(); var values = api.Values.Get(); foreach (var value in values) { textBox.Text += value + Environment.NewLine; } //appServiceClient.Logout(); //browser.Navigate(string.Format(@"{0}login/aad", GATEWAY_URL)); } catch (Exception error) { } }; }
// Use this for initialization void Start() { EmailField.onEndEdit.AddListener(delegate { tryLogin(); }); PassField.onEndEdit.AddListener(delegate { tryLogin(); }); _client = new AppServiceClient(_appUrl); _table = _client.GetTable <UserProfile>("Users"); savedEmail = "Blank"; savedPass = "******"; Button btn = SubmitButton.GetComponent <Button>(); Button btn2 = BackButton.GetComponent <Button>(); btn2.onClick.AddListener(IntroLoad); btn.onClick.AddListener(tryLogin); }
public MainWindow() { InitializeComponent(); DataContext = this; browser.LoadCompleted += (s, e) => { if (e.Uri.AbsoluteUri.IndexOf(URL_TOKEN) == -1) return; try { var encodedJson = e.Uri.AbsoluteUri.Substring( e.Uri.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(GATEWAY_URL); appServiceClient.SetCurrentUser(userId, userToken); var api = appServiceClient.CreateBlobSmartAPI(); var values = api.Values.Get(); foreach (var value in values) textBox.Text += value + Environment.NewLine; //appServiceClient.Logout(); //browser.Navigate(string.Format(@"{0}login/aad", GATEWAY_URL)); } catch (Exception error) { } }; }
// Use this for initialization void Start() { // Create App Service client _client = new AppServiceClient(_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable <Inventory> ("Inventory"); // set TSTableView delegate _tableView.dataSource = this; // hide controls until login CanvasGroup group = GameObject.Find("UserDataGroup").GetComponent <CanvasGroup> (); group.alpha = 0; group.interactable = false; UpdateUI(); }
// Use this for initialization void Start() { // Create App Service client _client = new AppServiceClient(_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable <Highscore> ("Highscores"); // set TSTableView delegate _tableView.dataSource = this; // setup token using Unity Inspector value if (!String.IsNullOrEmpty(_facebookAccessToken)) { InputField inputToken = GameObject.Find("FacebookAccessToken").GetComponent <InputField> (); inputToken.text = _facebookAccessToken; } UpdateUI(); }
// Use this for initialization void Start() { inputName.onEndEdit.AddListener(delegate { saveAll(); }); inputEmail.onEndEdit.AddListener(delegate { saveAll(); }); inputPass.onEndEdit.AddListener(delegate { saveAll(); }); _client = new AppServiceClient(_appUrl); _table = _client.GetTable <UserProfile>("Users"); savedName = "Blank"; savedEmail = "Blank"; savedPass = "******"; Button btn = SubmitButton.GetComponent <Button>(); Button btn2 = BackButton.GetComponent <Button>(); btn2.onClick.AddListener(IntroLoad); btn.onClick.AddListener(saveAll); }
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; } }
public ActionResult Insert(User user) { ViewData["ShowForm"] = true; if (ModelState.IsValid) { AppServiceClient client = new AppServiceClient(); ViewData["Result"] = client.Insert( user.DegreeBefore, user.Name, user.Surname, user.DegreeAfter, user.Street, user.StreetNumber, user.Town, user.Zipcode ); ViewData["ShowForm"] = false; } return View(user); }
public static void Trace(string message, LogLevel level) { //Trace TraceMessage m = new TraceMessage(); m.Name = "Argix08"; m.Source = App.Product; m.User = Environment.UserName; m.Computer = Environment.MachineName; m.LogLevel = level; m.Message = message; AppServiceClient appLog = new AppServiceClient(); try { appLog.WriteLogEntry(m); appLog.Close(); } catch (TimeoutException ex) { appLog.Abort(); ReportError(ex, true, LogLevel.None); } catch (CommunicationException ex) { appLog.Abort(); ReportError(ex, true, LogLevel.None); } catch (Exception ex) { appLog.Abort(); ReportError(ex, true, LogLevel.None); } }
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(); }
private void OnSubmitOrder() { AppServiceClient proxy = null; try { proxy = new AppServiceClient("BasicHttpBinding_IAppService"); proxy.SubmitOrder(_CurrentOrder); CurrentOrder = new Order(); CurrentOrder.OrderDate = DateTime.Now; CurrentOrder.OrderStatusId = 1; Items = new ObservableCollection <OrderItemModel>(); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { proxy.Close(); } }
private async void LoadProductsAndCustomers() { AppServiceClient proxy = null; try { proxy = new AppServiceClient("BasicHttpBinding_IAppService"); Products = await proxy.GetProductsAsync(); Customers = await proxy.GetCustomersAsync(); proxy.Close(); } catch (Exception ex) { Console.WriteLine(ex.Message); if (proxy != null) { proxy.Close(); } } }
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(); }
private void browser1_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(GATEWAY_URL); appServiceClient.SetCurrentUser(userId, userToken); var contactsListClient = appServiceClient.CreateContactWebAPI(); var contacts = contactsListClient.Contacts.Get(); foreach (var c in contacts) { txtContacts.Text += c.Name + " " + c.EmailAddress + System.Environment.NewLine; } //appServiceClient.Logout(); //webBrowser1.Navigate(string.Format(@"{0}login/aad", GW_URL)); } }
private void browser1_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(GATEWAY_URL); appServiceClient.SetCurrentUser(userId, userToken); var contactsListClient = appServiceClient.CreateContactWebAPI(); var contacts = contactsListClient.Contacts.Get(); foreach (var c in contacts) { txtContacts.Text += c.Name + " " + c.EmailAddress + System.Environment.NewLine; } //appServiceClient.Logout(); //webBrowser1.Navigate(string.Format(@"{0}login/aad", GW_URL)); } }
public AppAPI(AppServiceClient service) { _service = service; }
public ActionResult Count() { AppServiceClient client = new AppServiceClient(); ViewData["Count"] = client.Count(); return View(); }
void Start() { client = new AppServiceClient("https://poc-ra.azurewebsites.net"); table = client.GetTable <Name>("Coordinates"); }