Hi, if got recently being trying WPF and my problem is update an label (i know how to do but i think it's something wrong).
Here is an sample of code, and i cant understand why it's not changing after TCP result.
And basicly i dont get label's updated.
x = my new other form
Here is an sample of code, and i cant understand why it's not changing after TCP result.
Code:
public void check()
{
MainMenu x = new MainMenu();
//PING -> WORLD Server
if (_tcpREC(Convert.ToInt32(Properties.Settings.Default["worldport"].ToString())) == true)
{
x.dksv.Content = "Online";
x.dksv.Foreground = Brushes.Green;
}
else
{
x.dksv.Content = "Offline";
x.dksv.Foreground = Brushes.Red;
}
}
public Boolean _tcpREC(int port)
{
IniFile configFile = new IniFile();
//Check if is open or not on the server ip
using (TcpClient rec = new TcpClient())
{
try
{
rec.Connect(configFile.Read("Server Name", "MSSQL"), port);
if (rec.Connected == true)
{
return true;
}
}
catch
{
return false;
}
}
x = my new other form