2013-11-14 34 views

回答

2

要麼在LocalStorage中創建文件,要麼在其中創建一個設置。

每次打開應用程序時,都可以遞增計數,重新保存文件,然後檢查count % 5 == 0以查看是否應顯示消息。

+0

我會努力的!謝謝! –

1

基於WinForms應用程序這會是這樣看

詮釋計數= 0; 私人無效Form1_Load的(對象發件人,EventArgs的){

 using (BinaryReader reader = new BinaryReader(new FileStream("file.bin", FileMode.OpenOrCreate))) 
     { 
      while (reader.BaseStream.Position < reader.BaseStream.Length) 
      { 
       Count = reader.ReadInt32(); Count++; 
      } 
     } 
     if (Count % 5 == 0) 
     { 
      MessageBox.Show(Count.ToString()); 
     } 
    } 
    private void Form1_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) 
    { 
     using (BinaryWriter writer = new BinaryWriter(new FileStream("file.bin", FileMode.Open))) 
     { 
      writer.Write(Count); 
     } 
    } 
相關問題