The AppLife Update Controller is completely compatible with the .Net Framework 3.5 and WPF applications. Though the built-in user interface forms that are in the Update Controller are Windows Forms based, they can still be shown from WPF applications. In addition, you can completely customize your user interface using WPF XAML, just as you can create custom winforms user interfaces.
Integration Points to consider with WPF applications
1. The Update
Controller is Disposable
The controller class is disposable and
must be disposed when you are done using it. Placing a controller on a
WinForms designer adds the control to the form container, and the container
ensures that the controller is disposed when the form is closed. In WPF
this won’t be the case.
If you
intend to utilize the built-in Inter-process communications(IPC) of the update
controller to coordinate the shutdown of multiple instances, then instantiate
your controller and keep it instantiated throughout the lifetime of your main
WPF Window. Ensure the control is disposed as the Window
closes.
2. Setting the Owning
Form
To utilize the built-in user interface for updating, the
Update Controller methods expect a IWin32Window class for the
owner parameters. If you don’t set an owner, the dialogs that the
Update Controller displays will not be properly positioned. You can easily
wrap a WPF Window using this simple wrapper class, allowing you to pass the WPF
Window to the Update Controller properties.
private class WindowWrapper : System.Windows.Forms.IWin32Window {
private System.Windows.Interop.WindowInteropHelper mHelper;
public WindowWrapper(Window window) {
if(window
!= null)
{
mHelper = new System.Windows.Interop.WindowInteropHelper(window);
}
}
public IntPtr Handle {
get {
if(mHelper
== null) {
return IntPtr.Zero;
} else {
return
mHelper.Handle;
}
}
}
}
Example Usage:
mController.UpdateInteractive(new WindowWrapper(this));