Usuário com melhor resposta
Dim wb As New System.Net.WebClient c# ME AJUDEM

Pergunta
-
Ola Boa noite alguém poderia me ajudar a converter esse codigo pra c#?
Dim wb As New System.Net.WebClient Try My.Computer.Network.Ping("www.google.com", 500) If wb.DownloadString("http://coyotefiles.hol.es/Launcher.xml") = "ON" Then Dim web As New WebClient 'Edite aqui ====> Dim statuson As String = web.DownloadString("http://coyotefiles.hol.es/Launcher.xml") Else If wb.DownloadString("http://coyotefiles.hol.es/Launcher.xml") = "OFF" Then Dim web As New WebClient Dim statusOFF As String = web.DownloadString("http://coyotefiles.hol.es/Launcher.xml") Mensagem.Show() Me.Close() End If End If Catch ex As Exception Mensagem.Show() Me.Close() End Try
Quero q o projeto só abra quando na xml esteja on esse codigo funciona perfeitamente pra vb.net queria fzr ele funcionar no c#
alguém me ajudaria pfv?
- Editado CoyoteTxt domingo, 23 de julho de 2017 01:18
Respostas
-
Boa noite,
Converti aqui rapidamente usando o Code Converter do Telerik:
System.Net.WebClient wb = new System.Net.WebClient();
try {
My.Computer.Network.Ping("www.google.com", 500);
if (wb.DownloadString("http://coyotefiles.hol.es/Launcher.xml") == "ON") {
WebClient web = new WebClient();
//Edite aqui ====>
string statuson = web.DownloadString("http://coyotefiles.hol.es/Launcher.xml");
} else {
if (wb.DownloadString("http://coyotefiles.hol.es/Launcher.xml") == "OFF") {
WebClient web = new WebClient();
string statusOFF = web.DownloadString("http://coyotefiles.hol.es/Launcher.xml");
Mensagem.Show();
this.Close();
}
}
} catch (Exception ex) {
Mensagem.Show();
this.Close();
}Pelo que vi aqui, está correto.
Rafael Esquiçato Professional Scrum Master MCP, MCTS
- Sugerido como Resposta Rafael Esquiçato domingo, 23 de julho de 2017 16:51
- Marcado como Resposta Filipe B CastroModerator segunda-feira, 24 de julho de 2017 12:38
Todas as Respostas
-
Boa noite,
Converti aqui rapidamente usando o Code Converter do Telerik:
System.Net.WebClient wb = new System.Net.WebClient();
try {
My.Computer.Network.Ping("www.google.com", 500);
if (wb.DownloadString("http://coyotefiles.hol.es/Launcher.xml") == "ON") {
WebClient web = new WebClient();
//Edite aqui ====>
string statuson = web.DownloadString("http://coyotefiles.hol.es/Launcher.xml");
} else {
if (wb.DownloadString("http://coyotefiles.hol.es/Launcher.xml") == "OFF") {
WebClient web = new WebClient();
string statusOFF = web.DownloadString("http://coyotefiles.hol.es/Launcher.xml");
Mensagem.Show();
this.Close();
}
}
} catch (Exception ex) {
Mensagem.Show();
this.Close();
}Pelo que vi aqui, está correto.
Rafael Esquiçato Professional Scrum Master MCP, MCTS
- Sugerido como Resposta Rafael Esquiçato domingo, 23 de julho de 2017 16:51
- Marcado como Resposta Filipe B CastroModerator segunda-feira, 24 de julho de 2017 12:38
-
-