2012-09-06 33 views
-5

所以我們假設一臺只能運行這個程序的計算機有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按鈕關閉。

+1

500力量?是吧? –

+1

@ByronWhitlock - 我想他恐怕會超過9000! –

+0

我使用500次方作爲參考,這樣我就可以得到我的觀點。沒有實際的權力。 – Frank

回答

2

答案是肯定的,它應該恢復到全力。您可以檢查任務管理器以確保您的程序已正確關閉。如果它消失了,很難繼續對你的機器產生性能影響。有一點你需要注意的是,如果表單已關閉,但應用程序仍在後臺運行。如果是,它將在任務管理器中列出。

0

一個小小的提示,如果你曾經使用線程,你必須添加一個線程停止要麼關閉功能,要麼在線程本身尋找關閉和結束自己。一段時間後,我遇到了一個問題,它沒有正確關閉,並從計算機中吮吸資源,直到它重新啓動。

相關問題