所以我們假設一臺只能運行這個程序的計算機有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按鈕關閉。
500力量?是吧? –
@ByronWhitlock - 我想他恐怕會超過9000! –
我使用500次方作爲參考,這樣我就可以得到我的觀點。沒有實際的權力。 – Frank