-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenApplication.cs
More file actions
35 lines (32 loc) · 971 Bytes
/
OpenApplication.cs
File metadata and controls
35 lines (32 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
using Microsoft.VisualStudio.TestTools.UITesting.Playback;
using System.Windows.Forms;
namespace ProjectName
{
public class Application{
public static void Open()
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "C:\\Users\\yourUser\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\UI.appref-ms";
try
{
proc.Start();
WaitApplicationLoad();
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
public static bool WaitApplicationLoad(){
WinButton button = new WinButton();
while(!button.WaitForControlExist())
{
PlayBack.Wait(5000);
}
}
}
}