/// <summary> /// 找到窗口并绑定 /// </summary> /// <param name="title"></param> /// <param name="mode"></param> public void BindingWindow(string title, string mode) { appWin = Window.FindWindow(title); if (appWin == null) throw new Exception("Binding window fail.Can't find " + title); switch (mode) { case "Foreground": appWin.BindingDmsoft(BindingInfo.DefaultForeground); break; case "Background": appWin.BindingDmsoft(BindingInfo.DefaultBackground); break; } if (appWin.IsBinding == false) throw new Exception("Binding window fail.Can't bind mode " + mode); }
public void RunAndGetAppRegion(string exePath,string arguments="",string mode = "Foreground") { RunApp(exePath,arguments); Thread.Sleep(1000); appWin = new Window(app.MainWindowHandle.ToInt32()); switch (mode) { case "Foreground": appWin.BindingDmsoft(BindingInfo.DefaultForeground); break; case "Background": appWin.BindingDmsoft(BindingInfo.DefaultBackground); break; } if (appWin.IsBinding == false) throw new Exception("Binding window fail.Can't bind mode " + mode); }