private static async Task GetProductAsync(string barcode) { String userAgent = UserAgentHelper.GetUserAgent("OpenFoodFacts4Net.ApiClient.TestConsoleApp", ".Net Platform", "0.1", null); Client client = new Client(Constants.BaseUrl, userAgent); GetProductResponse productResponse = await client.GetProductAsync(barcode); Console.WriteLine(productResponse.Product.GenericName); }
public async Task Should_GetProductAsync_3029330003533() { string barcode = "3029330003533"; String userAgent = UserAgentHelper.GetUserAgent("OpenFoodFacts4Net.ApiClient.Tests", ".Net Platform", "0.1", null); Uri baseAddress = new Uri(Constants.BaseUrl); HttpClient httpClient = HttpClientHelper.Create(baseAddress, userAgent); GetProductResponse productResponse = await httpClient.GetProductAsync(barcode); Assert.Equal("Pain de mie complet", productResponse.Product.GenericName); }
private void HomeView_Loaded(object sender, RoutedEventArgs e) { UserAgentHelper.GetUserAgent( LayoutRoot, userAgent => { // TODO: Store this wherever you want ApplicationSettings.Current.UserAgent = userAgent; }); }
private void DoExpCol(object sender) { Button btn = (Button)sender; TreeLbItem tiCurrent = (TreeLbItem)btn.Tag; if (tiCurrent.Expanded) { tiCurrent.Collapse(); } else { if (tiCurrent.ContainerID != "IE") { tiCurrent.Expand(); } else { if (m_tiLoading != null) { MessageBox.Show("Load in progress!\n\nPlease wait..."); return; } m_tiLoading = tiCurrent; m_tiLoading.Loading = true; UserAgentHelper.GetUserAgent( iePanel, userAgent => { if (m_tiLoading != null) { m_tiLoading.Loading = false; m_tiLoading.PreInserts(); TreeLbItem ti; ti = new TreeLbItem(m_tiLoading.Holder, m_tiLoading, "UserAgent", "User Agent", userAgent); m_tiLoading.Insert(ti); m_tiLoading.Expand_Base(); m_tiLoading = null; } }); } } }
private void HomeView_Loaded(object sender, RoutedEventArgs e) { bool UAexists = MowblyClientManager.Instance.DoesUAexists(); if (!UAexists) { UserAgentHelper.GetUserAgent( LayoutRoot, userAgent => { MowblyClientManager.Instance.PutUA(userAgent); }); } }