Skip to content

Setting a restore point

Brent Moberly edited this page Jan 12, 2015 · 1 revision

###Overview

In previous tutorials, we have built the user-interface for our version on InCert. In this tutorial, we will finally start implementing processes to evaluate and configure users' computers. The first step is to set a system restore point, which allows users a convenient way to back out of the changes that the engine makes to their computers if something goes wrong.

Setup

This tutorial assumes that you have completed the tutorial, Adding progress banners, and have a version of the engine that will start and attempt to contact your web-server.

A note on examples

Our xml files are starting to get too long to include their full text inline in these tutorials. When you see this symbol external link in the text, you can click on it to view the xml in question.

Setting the restore point

  1. Create a new xml file called restorepoint.xml. Add the following to this new file:
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://incert.incommon.org/schemas ../Schemas/tasklist.xsd">
  <Branches>
    <TaskBranch name="restorepoint.set restore point">
      <SystemRestore.SetRestorePoint minimumTaskTime="3">
        <Properties>
          <Name>!ApplicationTitle!</Name>
        </Properties>
      </SystemRestore.SetRestorePoint>
    </TaskBranch>    
  </Branches>
</Content>

Here, we're setting a restore point with a name equivalent to our application title. We're assigning a minimumTaskTime of three seconds for user-interface purposes -- so that users can "see" the restore point being set in the progress dialog. We will need to implement this below, though.

  1. Modify the Control.GetContentFromEndpoint block at the start of the main role-branch of tasklist.xml to load restorepoint.xml:
<Control.GetContentFromEndpoint>
   <Properties>
     <ContentName>banners.xml</ContentName>
     <ContentName>restorepoint.xml</ContentName>
   </Properties>
 </Control.GetContentFromEndpoint>

We could just include the restorepoint.set restore point branch in our tasklist.xml file, but the branch will get slightly more complicated. Also, keeping each process in its own xml file makes it easier to make changes in the future, as its much easier to find content in smaller xml files.

  1. Now, add the following to the main role-branch of tasklist.xml between the UserInterface.ChangeBanner blocks that we added in the last tutorial:
<Control.ReturnBranchResult>
  <Properties>
    <Branch>restorepoint.set restore point</Branch>
  </Properties>
</Control.ReturnBranchResult>

This will run the restorepoint.set restore point branch, which, in turn, should set a restore point.

  1. Upload tasklist.xml external link and the new restorepoint.xml external link to your server and run the engine to completion. If you open your computer's system restore control panel, you should see the restore point created by the engine:

restore point control panel

Creating a restore point is not that complicated, at least not from the xml point of view. The heavy lifting is done by the engine. You just need to need to include the appropriate xml.

Disabling the 'close' button while the restore point is being set

While not strictly necessary, it's good practice to disable the progress dialog's close button during external processes, such as setting restore points. If the user clicks 'close' while an external process is running, the engine will not close until that process is complete, but disabling the close button informs the user that the engine is performing a critical external action.

  1. Modify restorepoint.xml to addUserInterface.DisableCloseButton and UserInterface.EnableCloseButton tasks before and after the SystemRestore.SetRestorePoint task:
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://incert.incommon.org/schemas ../Schemas/tasklist.xsd">
  <Branches>
    <TaskBranch name="restorepoint.set restore point">
      <UserInterface.DisableCloseButton>
        <Properties>
          <Dialog>Main dialog</Dialog>
        </Properties>
      </UserInterface.DisableCloseButton>
      <SystemRestore.SetRestorePoint minimumTaskTime="3">
        <Properties>
          <Name>!ApplicationTitle!</Name>
        </Properties>
      </SystemRestore.SetRestorePoint>
      <UserInterface.EnableCloseButton>
        <Properties>
          <Dialog>Main dialog</Dialog>
        </Properties>
      </UserInterface.EnableCloseButton>
    </TaskBranch>
  </Branches>
</Content>
  1. Upload restorepoint.xml external link to your server and run the engine to completion. The progress dialog's close button should be disabled while the restore point is being set:

verifying security progress dialog

We still need to update the progress dialog itself. We'll do this in the last part of this tutorial.

Updating the progress dialog

In most cases, the difficult part is not making the engine configure users' computers, but choreographing the user interface changes required to communicate the engine's progress to users. This is certainly this case here. It takes one xml block to set a restore point, but seven additional user-interface tasks to activate update the progress dialog. This is something we hope to address in future updates to the engine.

  1. Modify restorepoint.xml to activate the Setting system restore point checked paragraph:
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://incert.incommon.org/schemas ../Schemas/tasklist.xsd">
  <Branches>
    <TaskBranch name="restorepoint.set restore point">
      <UserInterface.ActivateCheckedParagraph minimumTaskTime="1">
        <Properties>
          <Dialog>Main dialog</Dialog>
          <ControlKey>Setting system restore point</ControlKey>
        </Properties>
      </UserInterface.ActivateCheckedParagraph>
      <UserInterface.DisableCloseButton>
        <Properties>
          <Dialog>Main dialog</Dialog>
        </Properties>
      </UserInterface.DisableCloseButton>
      <SystemRestore.SetRestorePoint minimumTaskTime="3">
        <Properties>
          <Name>!ApplicationTitle!</Name>
        </Properties>
      </SystemRestore.SetRestorePoint>
      <UserInterface.EnableCloseButton>
        <Properties>
          <Dialog>Main dialog</Dialog>
        </Properties>
      </UserInterface.EnableCloseButton>
    </TaskBranch>
  </Branches>
</Content>
  1. Because it sometimes takes a second or two to set a restore point, let's inform the user of this and let's add a basic animation to let the user know that the engine is still working. Modify restorepoint.xml to add UserInterface.SetCheckedParagraphSubtitle and UserInterface.StartMessageTimer tasks:
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://incert.incommon.org/schemas ../Schemas/tasklist.xsd">
  <Branches>
    <TaskBranch name="restorepoint.set restore point">
      <UserInterface.ActivateCheckedParagraph minimumTaskTime="1">
        <Properties>
          <Dialog>Main dialog</Dialog>
          <ControlKey>Setting system restore point</ControlKey>
        </Properties>
      </UserInterface.ActivateCheckedParagraph>
      <UserInterface.SetCheckedParagraphSubtitle>
        <Properties>
          <Dialog>Main dialog</Dialog>
          <ControlKey>Setting system restore point</ControlKey>
        </Properties>
        <Content>
          <ProgressParagraph settingKey="restore point subtitle" margin="0,0,0,0" padding="0,0,0,0">
            <Content>
              <DirectTextContent>This sometimes takes a few seconds to complete</DirectTextContent>
            </Content>
          </ProgressParagraph>
        </Content>
      </UserInterface.SetCheckedParagraphSubtitle>
      <UserInterface.StartMessageTimer>
        <Properties>
          <SettingKey>restore point subtitle</SettingKey>
        </Properties>
      </UserInterface.StartMessageTimer>
      <UserInterface.DisableCloseButton>
        <Properties>
          <Dialog>Main dialog</Dialog>
        </Properties>
      </UserInterface.DisableCloseButton>
      <SystemRestore.SetRestorePoint minimumTaskTime="3">
        <Properties>
          <Name>!ApplicationTitle!</Name>
        </Properties>
      </SystemRestore.SetRestorePoint>
      <UserInterface.EnableCloseButton>
        <Properties>
          <Dialog>Main dialog</Dialog>
        </Properties>
      </UserInterface.EnableCloseButton>
    </TaskBranch>
  </Branches>
</Content>

Here, UserInterface.SetCheckedParagraphSubtitle adds a ProgressParagraph with the base content of 'This sometimes takes a few seconds to complete' and a settingKey of 'restore point subtitle.' The UserInterface.StartMessageTimer task then activates this progress paragraph.

  1. After the restore point is set, we need to disable and remove the progress paragraph that we added and activated above and mark the restore-point checked paragraph as completed. To do this, modify restorepoint.xml as follows:
<Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://incert.incommon.org/schemas ../Schemas/tasklist.xsd">
  <Branches>
    <TaskBranch name="restorepoint.set restore point">
      <UserInterface.ActivateCheckedParagraph minimumTaskTime="1">
        <Properties>
          <Dialog>Main dialog</Dialog>
          <ControlKey>Setting system restore point</ControlKey>
        </Properties>
      </UserInterface.ActivateCheckedParagraph>
      <UserInterface.SetCheckedParagraphSubtitle>
        <Properties>
          <Dialog>Main dialog</Dialog>
          <ControlKey>Setting system restore point</ControlKey>
        </Properties>
        <Content>
          <ProgressParagraph settingKey="restore point subtitle" margin="0,0,0,0" padding="0,0,0,0">
            <Content>
              <DirectTextContent>This sometimes takes a few seconds to complete</DirectTextContent>
            </Content>
          </ProgressParagraph>
        </Content>
      </UserInterface.SetCheckedParagraphSubtitle>
      <UserInterface.StartMessageTimer>
        <Properties>
          <SettingKey>restore point subtitle</SettingKey>
        </Properties>
      </UserInterface.StartMessageTimer>
      <UserInterface.DisableCloseButton>
        <Properties>
          <Dialog>Main dialog</Dialog>
        </Properties>
      </UserInterface.DisableCloseButton>
      <SystemRestore.SetRestorePoint minimumTaskTime="3">
        <Properties>
          <Name>!ApplicationTitle!</Name>
        </Properties>
      </SystemRestore.SetRestorePoint>
      <UserInterface.EnableCloseButton>
        <Properties>
          <Dialog>Main dialog</Dialog>
        </Properties>
      </UserInterface.EnableCloseButton>
      <UserInterface.StopMessageTimer>
        <Properties>
          <SettingKey>restore point subtitle</SettingKey>
        </Properties>
      </UserInterface.StopMessageTimer>
      <UserInterface.RemoveCheckedParagraphSubtitle>
        <Properties>
          <Dialog>Main dialog</Dialog>
          <ControlKey>Setting system restore point</ControlKey>
        </Properties>
      </UserInterface.RemoveCheckedParagraphSubtitle>
      <UserInterface.CompleteCheckedParagraph minimumTaskTime="1">
        <Properties>
          <Dialog>Main dialog</Dialog>
          <ControlKey>Setting system restore point</ControlKey>
        </Properties>
      </UserInterface.CompleteCheckedParagraph>
    </TaskBranch>
  </Branches>
</Content>
  1. Upload restorepoint.xml external link to your server and run the engine to completion. The progress dialog's close button should be disabled while the restore point is being set, and the progress dialog should now update itself appropriately:

verifying security progress dialog

verifying security progress dialog

Conclusion

In this tutorial, we configured our version of InCert to set a restore point and update the progress dialog to inform users of operation's progress. In the next tutorial, we will verify that the user has an admin password set.