/// <summary> /// アプリケーションを終了します。 /// </summary> public void EndProcess() { if (this.detector != null) { this.detector.Finish(); this.detector = null; dynamic provider = this.app.Type("WinCap.Serialization.LocalSettingsProvider"); provider.Instance.Reset(); provider.Instance.Save(); this.Shutdown(); } }
/// <summary> /// アプリケーションをアタッチします。 /// </summary> public void Attach() { if (this.Process == null) { this.Process = Process.Start(ExecutablePath, "-UITest"); this.app = new WindowsAppFriend(this.Process); this.mainWindow = new WindowControl(this.app.Type <Application>().Current.MainWindow); // アプリケーション設定をリセットする dynamic provider = this.app.Type("WinCap.Serialization.LocalSettingsProvider"); provider.Instance.Reset(); } this.detector = new TimeoutDetector(1000 * 60 * 5); this.detector.Timedout += (sender, e) => { this.Shutdown(); }; this.InitApp(); }