所以假设一台除了运行这个程序什么都不做的计算机有 500 功率。当它运行它时,它会下降到450。当它关闭程序时,它会回到500吗?代码:
bool shouldCheck = true;
string word = "hndxgfhesufyhsukj";
string name = "NAME OF PROGRAM HERE";
bool updates = false;
private void button1_Click(object sender, EventArgs e)
{
if (shouldCheck == true)
{
var url = "MYURL";
var client = new WebClient();
using (var stream = client.OpenRead(url))
using (var reader = new StreamReader(stream))
{
string downloadedString;
while ((downloadedString = reader.ReadLine()) != null)
{
if (downloadedString == word)
{
updates = true;
this.Hide();
Form1 form2 = new Form1();
form2.Show();
MessageBox.Show("There's no updates, and the full program has opened! Enjoy!", name, MessageBoxButtons.OK, MessageBoxIcon.Information);
client.Dispose();
}
else
{
MessageBox.Show("There is an update! Downloading now!", name, MessageBoxButtons.OK, MessageBoxIcon.Information);
url = "MYURL";
var web = new WebBrowser();
web.Navigate(url);
}
}
}
}
}
这运行良好,但在程序关闭后会损害性能吗?通过关闭,我的意思是更新已被检查,新表单打开并使用红色 X 按钮关闭。