private static void DownloadTestsXap(Uri testsXapUri, Action<StreamResourceInfo> OnDownloadComplete) { _onDownloadComplete = OnDownloadComplete; WebClient wc = new WebClient(); wc.OpenReadCompleted += new OpenReadCompletedEventHandler(DownloadTestXap_Complete); wc.OpenReadAsync(testsXapUri); }
private void button1_Click(object sender, RoutedEventArgs e) { // Download an "on-demand" assemblies. WebClient webClient = new WebClient(); webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted); webClient.OpenReadAsync(new Uri("DXRichEditAssemblies.zip", UriKind.Relative)); }
public void ImportWorkbookFromTxt(string fileName) { string filePath = string.Format(@"http://localhost:54352/Files/{0}", fileName); WebClient webClient = new WebClient(); webClient.OpenReadCompleted += webClient_OpenReadCompleted; webClient.OpenReadAsync(new Uri(filePath)); }
public void SetSourceTest() { client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); client.OpenReadAsync(new Uri("http://localhost:8080/elephants-dream-320x180-first-minute.wmv", UriKind.Absolute)); EnqueueConditional(delegate() { return(completed); }); EnqueueTestComplete(); }
public static void DownloadPackageAsync(Uri packageUri, Action <AsyncCompletedEventArgs, Package> packageDownloadCompleted) { var client = new WebClient(); client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); client.OpenReadAsync(packageUri, new Tuple <Uri, Action <AsyncCompletedEventArgs, Package> >(packageUri, packageDownloadCompleted)); }
private void AMWObl(object sender, RoutedEventArgs e) { var webClient = new WebClient(); webClient.OpenReadAsync(new Uri("http://hein.bluequeen.tk/select.php")); webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(bus); jakiprzystanek = "AMWOBLUZE"; }
private void OksywieOksywie(object sender, RoutedEventArgs e) { var webClient = new WebClient(); webClient.OpenReadAsync(new Uri("http://hein.bluequeen.tk/select7.php")); webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(bus); jakiprzystanek = "OKSOKSYWIE"; }
public void Play(string filename, int song) { Filename = filename; Song = song; WebClient = new WebClient(); WebClient.OpenReadCompleted += WebClient_OpenReadCompleted; WebClient.OpenReadAsync(new Uri(filename, UriKind.Relative)); }
private void GetEarthquakes() { if (!_isBusy) { _isBusy = true; _client.OpenReadAsync(ServiceUrl); } }
public void GetForecastForCityAsync(CityWeather cityWeather) { string link = string.Format("http://api.openweathermap.org/data/2.5/forecast?units=metric&id={0}&APPID={1}", cityWeather.CityID.ToString(), OpenWeatherKey); WebClient forecastClient = new WebClient(); forecastClient.OpenReadCompleted += forecastClient_OpenReadCompleted; forecastClient.OpenReadAsync(new Uri(link), cityWeather); }
public void StartDownload() { using (var client = new WebClient()) { client.OpenReadCompleted += ClientOnOpenReadCompleted; client.OpenReadAsync(new Uri(DownloadUrl)); } }
public void GetWeatherAsync() { string link = "http://api.openweathermap.org/data/2.5/box/city?bbox=-180,-90,180,90&cluster=yes&APPID=" + OpenWeatherKey; WebClient weatherClient = new WebClient(); weatherClient.OpenReadCompleted += weatherClient_OpenReadCompleted; weatherClient.OpenReadAsync(new Uri(link)); }
private void LoadPhoto() { Photo photo = App.Settings.SelectedPhoto; WebClient wc = new WebClient(); wc.OpenReadAsync(new Uri(photo.ImageURL)); wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted); }
//</Snippet29> //<Snippet30> public static void OpenResourceForReading2(string address) { WebClient client = new WebClient(); Uri uri = new Uri(address); client.OpenReadCompleted += new OpenReadCompletedEventHandler(OpenReadCallback2); client.OpenReadAsync(uri); }
public void LoadImage() { WebClient webClient = new WebClient(); webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted); webClient.OpenReadAsync(new Uri(file, UriKind.Absolute)); }
static public Boolean LogIn(string userName, string password) { WebClient webClient = new WebClient(); webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(authUser_OpenReadCompletedEventArgs); webClient.OpenReadAsync(new Uri("")); return(authentification); }
public void GetVersionInfoAsync(Uri versionInfoUri) { WebClient wc = new WebClient(); wc.OpenReadCompleted += (sender, e) => { VersionInfo versionInfo = null; if (e.Error == null) { using (Stream s = e.Result) { using (StreamReader reader = new StreamReader(s)) { versionInfo = new VersionInfo(); string line = string.Empty; while (!string.IsNullOrEmpty(line = reader.ReadLine())) { string[] tokens = line.Split(':'); switch (tokens[0]) { case "PROGRAM_VERSION": versionInfo.Version = new Version(tokens[1]); break; case "SETUP_FILENAME": versionInfo.SetupFileName = tokens[1]; break; case "FTP_BASE_PATH": versionInfo.relativePath = tokens[1]; break; case "FILE_SIZE": versionInfo.fileSize = tokens[1]; break; default: break; } } } } } else { App.logger.Error(Utils.Util.GetExceptionMessageWithStackTrace(e.Error)); MessageBox.Show(e.Error.Message); } if (this.GetVersionInfoCompleted != null) { GetVersionInfoCompleted(versionInfo); } }; wc.OpenReadAsync(versionInfoUri); }
public void Start() { var con = new WebClient(); con.Headers.Add("Authorization", "Bearer " + OAndaCandleReader.BEARER); System.Action connect = () => { con.OpenReadAsync(new System.Uri("https://stream-fxpractice.oanda.com/v3/accounts/" + OAndaCandleReader.ACCOUNT + "/pricing/stream?instruments=" + OAndaCandleReader.INSTRUMENTS)); }; con.OpenReadCompleted += (object sender, OpenReadCompletedEventArgs e) => { try { using (var streamReader = new System.IO.StreamReader(e.Result)) { while (true) { var conteudo = streamReader.ReadLine(); ClientPrice price = null; PricingHeartbeat heartbeat = null; if (conteudo.Contains("\"type\":\"PRICE\"")) { price = Newtonsoft.Json.JsonConvert.DeserializeObject <ClientPrice>(conteudo); } else { heartbeat = Newtonsoft.Json.JsonConvert.DeserializeObject <PricingHeartbeat>(conteudo); } var responsePrice = new InlineResponse20028(); responsePrice.Price = price; responsePrice.Heartbeat = heartbeat; if (price != null) { this.OnPriceChanged(new PriceChangedEventArgs() { PrecoVenda = price.CloseoutAsk, PrecoCompra = price.CloseoutBid, Time = price.Time }); } } } } catch (System.Exception) { connect(); } }; connect(); }
private void LoadOrDownload() { LoaderProgress(); string fileName = "version.txt"; string version_Server1 = GetFileText(fileName).Trim(); string version_Iso1 = GetFileText("\\wp8\\" + fileName).Trim(); if (version_Server1 == version_Iso1 && version_Server1 != "") { try { //Create a webclient that'll handle your download WebClient client = new WebClient(); //Run function when resource-read (OpenRead) operation is completed client.OpenReadCompleted += client_OpenVersionReadCompletedHash; //Start download / open stream client.OpenReadAsync(new Uri("https://www.xforex.com/mobile-project/rc/wp8/hash.txt"));//Use the url to your file instead, this is just a test file (pdf) } catch (Exception ex) { MessageBox.Show("We could not start your download. Error message: " + ex.Message); } //string fileNameHash = "hash.txt"; //string version_Server1Hash = GetFileText(fileNameHash).Trim(); //string version_Iso1Hash = GetFileText("\\wp8\\" + fileNameHash).Trim(); //if (version_Server1Hash == version_Iso1Hash && version_Server1Hash != "") //{ LoaderProgress(); string version_engine = GetFileText("\\wp8\\engine_wp8_nativ.html").Trim(); if (version_engine != "") { statPageLoaded = true; myWB.Base = "wp8"; myWB.Navigate(new Uri("engine_wp8_nativ.html", UriKind.Relative)); } //} else { LoadJsZip(); } } else { LoadJsZip(); } }
void WebClientNext() { WebClient wc = new WebClient(); wc.OpenReadCompleted += delegate(object sender, OpenReadCompletedEventArgs e) { string status = "FAIL (no check found)"; try { if (e.Result != null) { status = "OK"; } else { status = "null"; } } catch (TargetInvocationException tie) { if (tie.InnerException is SecurityException) { status = "SecurityException"; } else { status = String.Format("{0} : {1}", tie.InnerException.GetType(), tie.InnerException); } } catch (Exception ex) { status = String.Format("{0} : {1}", ex.GetType(), ex); } finally { Func <string, string> check = null; if (test_cases.TryGetValue(current.OriginalString, out check)) { log.Text += check(status); } else { log.Text += status; fail++; } uri_no++; if (uri_no <= urls.Length) { WebClientNext(); } else { ShowFinalStatus(); } } }; string uri = urls [uri_no - 1]; log.Text += String.Format("{0}WEBCLIENT({3}) {1}. {2} : ", Environment.NewLine, uri_no, uri, stack); current = new Uri(uri); wc.OpenReadAsync(current); }
private void btnPontuacao_Click(object sender, RoutedEventArgs e) { WebClient clube = new WebClient(); clube.OpenReadCompleted += Clube_OpenReadCompleted1; Uri uri = new Uri("https://api.cartolafc.globo.com/atletas/pontuados", UriKind.Absolute); clube.OpenReadAsync(uri); }
private void btnClubes_Click(object sender, RoutedEventArgs e) { WebClient clube = new WebClient(); clube.OpenReadCompleted += Clube_OpenReadCompleted;; Uri uri = new Uri("https://api.cartolafc.globo.com/partidas", UriKind.Absolute); clube.OpenReadAsync(uri); }
private void btnMitoRodada_Click(object sender, RoutedEventArgs e) { WebClient client = new WebClient(); client.OpenReadCompleted += MitoRodada_OpenReadCompleted1;;; Uri uri = new Uri("https://api.cartolafc.globo.com/pos-rodada/destaques", UriKind.Absolute); client.OpenReadAsync(uri); }
private void btnPatrocinadores_Click(object sender, RoutedEventArgs e) { WebClient client = new WebClient(); client.OpenReadCompleted += Client_OpenReadCompletedPatrocinadores; Uri uri = new Uri("https://api.cartolafc.globo.com/patrocinadores", UriKind.Absolute); client.OpenReadAsync(uri); }
private void btnAtualizar_Click(object sender, RoutedEventArgs e) { WebClient client = new WebClient(); client.OpenReadCompleted += PegarRodadasCompleted; Uri uri = new Uri("https://api.cartolafc.globo.com/rodadas", UriKind.Absolute); client.OpenReadAsync(uri); }
private void btnJogadores_Click(object sender, RoutedEventArgs e) { WebClient client = new WebClient(); client.OpenReadCompleted += client_OpenReadCompletedJogadoresParticipantes; Uri uri = new Uri("https://api.cartolafc.globo.com/atletas/mercado", UriKind.Absolute); client.OpenReadAsync(uri); }
private IObservable <IEnumerable <HatebuItem> > GetObservableSyndication <T>(string method) { var wc = new WebClient(); var observable = wc.GetHatebuObservable(); var url = string.Concat(HotEntryUrl, method); wc.OpenReadAsync(new Uri(url)); return(observable); }
/// <summary> /// Checks for new updates asynchronously. After update check is finished, event UpdateChecked is raised. /// </summary> /// <exception cref="ArgumentNullException">Thrown when manifestUrl is null.</exception> /// <exception cref="WebException">Thrown when manifestUrl is not valid url or client can't connect to specified url.</exception> public void CheckUpdateAsync() { _webClient.OpenReadCompleted += (sender, args) => { _manifest = _manifestSerializer.Deserialize(args.Result) as XmlUpdateManifest; OnUpdateChecked(new UpdateCheckedEventArgs(UpdatesAvailable())); }; _webClient.OpenReadAsync(new Uri(_manifestUrl)); }
public void LoadAllMyBoardsPage() { IsLoading = true; Visible = "Visible"; WebClient notificationclient = new WebClient(); notificationclient.OpenReadCompleted += RenderBoards; notificationclient.OpenReadAsync(new Uri(String.Format(EnumUtil.GetEnumDescription(ConnectionEnum.GETConnections.MyBoards), IsolatedStorageSettings.ApplicationSettings["MyToken"], IsolatedStorageSettings.ApplicationSettings["Token"]))); }
public void RequestResponse() { if (wc.IsBusy) { //RequestResponse(); return; } wc.OpenReadAsync(new Uri("http://tray.technobase.fm/radio.xml")); }
private void btnStatusMercado_Click(object sender, RoutedEventArgs e) { WebClient client = new WebClient(); client.OpenReadCompleted += Client_OpenReadCompleted;; Uri uri = new Uri("https://api.cartolafc.globo.com/mercado/status", UriKind.Absolute); client.OpenReadAsync(uri); }
private void btnListarJogadores_Click(object sender, RoutedEventArgs e) { WebClient client = new WebClient(); client.OpenReadCompleted += Client_ListarJogadores;; Uri uri = new Uri("https://api.cartolafc.globo.com/mercado/destaques", UriKind.Absolute); client.OpenReadAsync(uri); }
public void GetVersionAsynch(string version,string token, string fullpath,bool test) { //string file = null; string URL = "http://moscrif.com/ide/getVersion.ashx?v={0}"; client = new WebClient(); client.DownloadProgressChanged+= delegate(object sender, DownloadProgressChangedEventArgs e) { //Console.WriteLine("----> {0}",e.ProgressPercentage);; /*progressBar.Text = e.ProgressPercentage.ToString(); progressBar.QueueDraw(); while (Application.EventsPending ()) Application.RunIteration ();*/ }; if(String.IsNullOrEmpty(token)){ URL = String.Format(URL,version); } else { URL = String.Format(URL+"&t={1}",version,token); } //URL = String.Format(URL,version,token); if(test){ URL = URL+"&test=1"; } Console.WriteLine("URL ->{0}",URL); //client.DownloadStringCompleted += delegate(object sender, DownloadStringCompletedEventArgs e) { //OpenReadCompleted += delegate(object sender, OpenReadCompletedEventArgs e) {//UploadStringCompleted+= delegate(object sender, UploadStringCompletedEventArgs e) { client.OpenReadCompleted += delegate(object sender, OpenReadCompletedEventArgs e) {//UploadStringCompleted+= delegate(object sender, UploadStringCompletedEventArgs e) { if (e.Cancelled){ isFinish = true; return; } if (e.Error != null){ isFinish = true; return; } if(File.Exists(fullpath)) File.Delete(fullpath); FileStream writeStream = new FileStream(fullpath, FileMode.Create, FileAccess.Write); try{ Copy(e.Result,writeStream); writeStream.Close(); writeStream.Dispose(); }catch{ isError = true; } isFinish = true; }; client.OpenReadAsync(new Uri(URL)); //client.DownloadStringAsync(new Uri(URL)); // while (Application.EventsPending ()) // Application.RunIteration (); }