Results 1 to 4 of 4

Thread: The Restart and recovery API

  1. #1
    Join Date
    Jul 2010
    Posts
    38

    The Restart and recovery API

    My programs do not crash, and I am sure about it. But if it is going happen is that an application "crashes", or simply not doing what is expected of it, then you can now be done with style and an automatic restart of the application. This helps the restart-and-recovery API that already introduced in Windows Vista and now Windows 7 has been extended. I have tried number of ways to solve it, but not succeeded in doing it. So thought that some genius hanging out there will definitely help me. Please provide some notes that can be useful in resolving that quandary. Also provide some codes so that it can be useful for me to understand.

  2. #2
    Join Date
    Mar 2008
    Posts
    192

    Re: The Restart and recovery API

    The application simply not responding and all data is lost. Perhaps they have seen before, that some applications offer after a crash, right again to restart. And in the boot process then the lost data be recovered. Users of such applications are lucky. In such scenarios, you will have to try to register the application for a restart.
    private void RegisterForRestart ()
    {
    ApplicationRestartRecoveryManager.RegisterForApplicationRestart (
    new restart settings ("/ restart",
    RestartRestrictions.NotOnReboot | RestartRestrictions.NotOnPatch));
    }

  3. #3
    Join Date
    Mar 2008
    Posts
    227

    Re: The Restart and recovery API

    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; 
    }

  4. #4
    Join Date
    Mar 2008
    Posts
    258

    Re: The Restart and recovery API

    Reboot to restore the data. The following are some codings that will be useful for you while restarting your API.
    Code:
    private void recover last session (string command) 
    { 
    if (File.Exists (file recovery)) 
    { 
    MessageBox.Show (this, string.Format ("{0} file does not exist Recovery" recovery file)); 
    internalLoad = true; 
    textBox1.Text = "not recover the data. Could recovery data file does not exist"; 
    internalLoad = false; 
    UpdateAppTitle (); 
    Return; 
    } 
    
    // Perform application state restoration actions here. 
    string contents = File.ReadAllText (recovery file); 
    CurrentFile.Filename = contents.Remove (contents.indexOf (Form1.DataSeparatorString)); 
    contents = contents.Remove (0 contents.indexOf (Form1.DataSeparatorString) + 
    Form1.DataSeparatorString.Length); 
    CurrentFile.IsDirty = contents.Remove (contents.indexOf (Form1.DataSeparatorString)) == "true"? true: false; 
    contents = contents.Remove (0 contents.indexOf (Form1.DataSeparatorString) + Form1.DataSeparatorString.Length); 
    CurrentFile.Contents = contents; 
    
    // Load our textbox 
    textBox1.Text = CurrentFile.Contents; 
    
    / Update the title 
    UpdateAppTitle (); 
    
    // Reset our variable to next title updates we do not show the "recovered" text 
    recovered = false; 
    }

Similar Threads

  1. System recovery during the Restart process in Edubuntu
    By Rufta in forum Operating Systems
    Replies: 4
    Last Post: 26-12-2010, 04:01 PM
  2. Recovery my work and restart microsoft excel
    By Chang2 in forum Windows Software
    Replies: 4
    Last Post: 22-10-2010, 06:01 AM
  3. Problem writing creating recovery disc in Recovery Manager
    By SajalSOFT in forum Windows Software
    Replies: 6
    Last Post: 11-09-2010, 02:24 AM
  4. Replies: 5
    Last Post: 27-08-2010, 06:13 AM
  5. Replies: 7
    Last Post: 13-08-2010, 10:39 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,063,597.63825 seconds with 17 queries