我试图做一个消息框,显示一个消息时,我的应用程序每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 - 有没有办法知道应用程序从哪里下载的代码
我会努力的!谢谢! –