2013-11-14 33 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); 
     } 
    } 
相关问题