Also, i would like to suggest you to register the application for the recovery of data. The following are some codes that can be useful for you :
Code:
private void RegisterForRecovery ()
{
recovery data recovery data = new data (new recovery callback (recovery procedure), null);
recovery settings settings = new recovery settings (data, 0);
ApplicationRestartRecoveryManager.RegisterForApplicationRecovery (settings);
}
And then while implementing Recovery Method:
Code:
{
PingSystem ();
File.WriteAllText (recovery file string.Format ("{0} {1} {2} {0} {3}", DataSeparatorString, CurrentFile.Filename, CurrentFile.IsDirty, CurrentFile.Contents));
Debug.WriteLine ("File path:" + file recovery);
Debug.WriteLine ("File exists:" + File.Exists (file recovery));
Debug.WriteLine ("Application shutting down ...");
ApplicationRestartRecoveryManager.ApplicationRecoveryFinished (true);
return 0;
}
Bookmarks