我想找到一種方法來找回我以前的變量的值,以便我可以恢復我的應用程序以前的運行狀態,然後在它手動崩潰時手動重新啓動它。我目前正在使用保存在項目文件夾中的'config'文件。有一個更好的方法嗎?在程序崩潰後找回變量
我想保存的代碼的一些小部分。
if (EventID == WIA.EventID.wiaEventItemCreated)
{
if (d != null)
{
foreach (Property p in d.Properties)
{
if (p.Name.Equals("Pictures Taken"))
Console.WriteLine("Taken");
}
wiaImageFile = (WIA.ImageFile)(d.Items[d.Items.Count].Transfer(FormatID.wiaFormatJPEG));
wiaImageFile.SaveFile(Properties.Settings.Default.FolderNameRaw + "\\" + imageCount + ".jpg");
imageCount++;//I want to save this count so that I can continue the sequence even after the application crashes
Pluck.Default.PhotoExistsInDirectory = true;
FacebookControls fbc = new FacebookControls();
if(Properties.Settings.Default.UseFB == true)
fbc.UploadPhotos();
}
}
這是一個網站/網絡應用程序? – sll
我相信一個好主意是從文件夾內容中讀取文件並確定哪個是最後創建的文件。之後你可以分割文件名,然後獲得計數器的值。 –
Dekstop應用程序,用於處理一些圖像,一個photobooth應用程序。 – Bocky