2 using System.Collections.Generic;
4 using System.Diagnostics;
5 using System.Runtime.InteropServices;
6 using System.Xml.Serialization;
8 namespace Seci.Definitions
29 public String Name {
get {
return _name; } set { _name = value; } }
30 public String FilePath {
get {
return _filePath; } set { _filePath = value; } }
31 public int PositionX {
get {
return _positionX; } set { _positionX = value; } }
32 public int PositionY {
get {
return _positionY; } set { _positionY = value; } }
33 [XmlIgnore]
public String OwningComponent {
get {
return _owningComponent; } set { _owningComponent = value; } }
65 _process =
new Process();
67 _process.StartInfo.FileName = _filePath;
68 _process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
72 System.Threading.Thread.Sleep(3000);
82 Helpers.NativeMethods.ShowWindow(_process.MainWindowHandle.ToInt32(), 0);
97 Helpers.NativeMethods.ShowWindow(_process.MainWindowHandle.ToInt32(), 9);
98 Helpers.NativeMethods.SetForegroundWindow(_process.MainWindowHandle.ToInt32());
110 if (Helpers.NativeMethods.IsIconic(_process.MainWindowHandle.ToInt32()) == 0)
113 Helpers.Rect rect =
new Helpers.Rect();
115 Helpers.NativeMethods.GetWindowRect(_process.MainWindowHandle.ToInt32(), out rect);
117 _width = rect.Width - rect.X;
118 _height = rect.Height - rect.Y;
129 if (Helpers.NativeMethods.IsIconic(_process.MainWindowHandle.ToInt32()) == 0)
132 Helpers.Rect rect =
new Helpers.Rect();
134 Helpers.NativeMethods.GetWindowRect(_process.MainWindowHandle.ToInt32(), out rect);
150 Helpers.NativeMethods.MoveWindow(_process.MainWindowHandle, _positionX, _positionY, _width, _height,
true);
159 public void Move(
int xPos,
int yPos)
165 Helpers.NativeMethods.MoveWindow(_process.MainWindowHandle, xPos, yPos, _width, _height,
true);
170 #region IDisposable Members
187 GC.SuppressFinalize(
this);
207 protected virtual void Dispose(Boolean disposing)
212 if (_process != null && !_process.HasExited)
~Executable()
This destructor will run only if the Dispose method does not get called.
This class is used for wrapping standard executables that are included as part of a configuration...
Executable()
Standard Constructor - neccessary for XML deserialisation.
void Load()
Method for creating the executable's process.
int _positionX
The component to which this exe belongs.
Boolean Show()
Method for showing the executable and bringing it to the front. Uses the ShowWindow and SetForeground...
void Move()
Method for moving an executable's window. This is usually done after the executable is loaded...
void getSize()
Method for getting the size of an executable's window. First checks that the window is not minimised...
void Move(int xPos, int yPos)
Overloaded method for moving an executable's window. Uses the MoveWindow method from the WinAPI...
void Dispose()
Public Dispose Method - member of IDisposable. The loaded executable is unmanaged so it needs to be d...
virtual void Dispose(Boolean disposing)
Protected Dispose Method - member of IDisposable. If the value passed it true then the method has bee...
Executable(String filepath)
Recommended Constructor for use in code.
Boolean Hide()
Method for hiding the executable - uses the ShowWindow method from the WinAPI.
void GetPosition()
Method for getting the position of an executable's window. First checks that the window is not minimi...