Are you performing a CopyDesign in the Vault client and have to wait until it completes? Then let’s play Tetris in the meantime :)
This is just an example of what is possible. You can embed whatever process you like into another window.
What do we need for this?
- Data Standard for Vault
- The game, you want to embed
- PowerJobs
Thats all!
Getting started:
First, you have to extract the xaml file to this folder. Copy the dll’s to your Vault client installation directory and restart the Vault client. Select a file and the new tab should appear with Spider Solitaire.
Other examples:
– Internet explorer in Vault client
You can browse inside here, too! You could browse to some online game store and play other games via internet explorer as well!
How does it work?
By using Data Standard, we add a new xaml file-tab that uses an UI library from powerJobs in its namespace:
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:behaviours="clr-namespace:Common.Wpf;assembly=Common" xmlns:powerJobs="clr-namespace:PowerJobs.UI.Views;assembly=PowerJobs.UI" xmlns:pJProcess="clr-namespace:PowerJobs.UI.Models.Process;assembly=PowerJobs.UI" behaviours:TabTitleBehavior.TabTitle="Internet" x:Name="MainWindow"> ...
Now you have to find these two assemblies in the powerJobs installation directory:
C:\Program Files\coolOrange\powerJobs 2015\PowerJobs.UI.dll C:\Program Files\coolOrange\powerJobs 2015\powerJobs.Interfaces.dll
These assemblies have to be placed inside here: C:\Program Files\Autodesk\Vault Professional 2015\Explorer
And now you can start using the ExternalProcess control in your xaml.
1. Place this code in the control resources and give the path to the executable of your choice:
<pJProcess:ProcessSettings x:Key="processSettings" ProcessName="PATH TO THE EXECUTABLE" />
2. Define the ExternalProcess control by binding its settings to ‘processSettings’:
... <powerJobs:ExternalProcess ProcessSettings="{StaticResource processSettings}"/> </UserControl>
That’s it!
This control will start the process if it’s not already started. Otherwise it takes its MainWindow and embeds it with the size of the WPF-control into your WPF-window. When your window dies, it will kill the other process for you.
Internally, the window-handle for the MainWindow of the process is searched. Then it uses this handle for calling this pinvoke function: SetParent (http://www.pinvoke.net/default.aspx/user32/setparent.html). If the Parent window is a WPF window, you have to use a WinForms-Host control and pass this handle to SetParent.
That’s how it works, but now let’s go on playing Tetris :)