我試圖做一個消息框,顯示一個消息時,我的應用程序每5次打開,但我不能找到一種方法來做到這一點,有沒有辦法在C#中做到這一點?有沒有辦法知道我的Windows Phone 8應用程序打開了多少次?
-1
A
回答
2
要麼在LocalStorage中創建文件,要麼在其中創建一個設置。
每次打開應用程序時,都可以遞增計數,重新保存文件,然後檢查count % 5 == 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);
}
}
相關問題
- 1. 有沒有辦法知道我的應用程序目前有多少安裝?
- 2. 有沒有辦法知道應用程序第一次啓動?
- 3. 有沒有辦法知道有多少會話,打開一個特定的表
- 4. 有沒有辦法知道會話使用多少內存?
- 5. 有沒有辦法共享仍在開發中的Windows 8應用程序?
- 6. 有沒有辦法知道當前有多少個webrole實例?
- 7. 有沒有辦法知道用戶是否打開郵件?
- 8. 有沒有辦法知道從rake命令啓動了Rails應用程序?
- 9. 有沒有辦法知道我的jar(在公共Maven倉庫中)通過Maven下載了多少次?
- 10. 有沒有辦法知道mysqldump需要多少空間?
- 11. 有沒有辦法知道cudaMalloc要保留多少空間?
- 12. 如何知道windows phone 8應用程序的下載鏈接
- 13. 有沒有辦法打開SublimeText 2從其他應用程序
- 14. 有沒有辦法知道rxjs websocket是否打開
- 15. 有沒有辦法知道我們在for循環中做了多少次迭代?
- 16. Windows Phone應用程序分析的Windows Phone 8 - 開始
- 17. 有沒有辦法讓我的「文件關聯」不被應用程序打開?
- 18. 有沒有辦法在Windows Phone 7應用程序中獲取Assembly的日期?
- 19. 應用程序的IsolatedStorage在Windows Phone 8上有多大?
- 20. 如何打開Windows Phone 8應用程序中的手電筒
- 21. 有沒有辦法爲我的應用程序知道用戶已添加了Twitter帳戶?
- 22. 有沒有辦法執行異步操作,如同步關於Windows Phone應用程序?正如我們所知,
- 23. 有什麼辦法可以知道線程使用了多少內存?
- 24. 有沒有辦法在不使用windows phone 7 marketplace的情況下發布windows phone 7應用程序?
- 25. windows phone 8應用程序Application_Activated()從來沒有叫
- 26. windows phone 8有沒有辦法讀取從應用程序內的電腦下載的文件?
- 27. 有沒有辦法從vim一次打開多個文件?
- 28. 有沒有辦法知道shell/terminal命令/應用程序的選項?
- 29. 有沒有辦法知道最近的應用程序何時啓動?
- 30. Android - 有沒有辦法知道應用程序從哪裏下載的代碼
我會努力的!謝謝! –