using System; using System.Drawing; using Arp.Prova.ImageLibrary; using Arp.Prova.CsvLib; using Arp.Prova.PlayLib; using System.IO; // CodeClass public class CodeClass { public static int CodeStart() { //--------------------テーマの設定サンプル-------------------- //こちらのサンプルは、「個人用設定」設定の「テーマ」画面内、 //「テーマの変更」の設定を行うサンプルです。 //設定値などは、設定したい内容に変更の上お試しください。 //--------------------設定開始-------------------- //■「テーマ」画面を表示 PlayLib.ProcessStart("ms-settings:themes"); //■「設定」画面が開くまで待つ if(PlayLib.WaitWindow("設定", true, 10)) { PlayLib.Window("設定").Activate(); //「設定」画面を前面に表示 PlayLib.Sleep(1000); //画面内の描画は終わるまで少し待つ //操作しやすいよう設定画面を最大化する if(PlayLib.Window("設定").WaitUIControl("UIButton", "設定 を最大化する", true, 10)) { PlayLib.Window("設定").UIButton("設定 を最大化する").Click(); PlayLib.Sleep(1000); } //■テーマの変更:「Windows (ライト)」を持ったUIListBoxを探す for(int i = 1; i < 10; i++) { if((bool)PlayLib.Window("設定").UIListBox("UIListBox&" + i).GetItemProperty("Exists", "Windows (ライト)、1 イメージ")) { //「Windows (ライト)」を持ったUIListBoxがあった場合、「Windows (ライト)」を選択する PlayLib.Window("設定").UIListBox("UIListBox&" + i).Select("Windows (ライト)、1 イメージ"); PlayLib.Sleep(1000); //「Enter」キーを押下 PlayLib.Window("設定").Input("{Enter}"); PlayLib.Sleep(2000); break; } } //選択した「Windows のテーマ」のエビデンスとして、任意の場所にスクリーンキャプチャ画像を取得する //※このサンプルでは、デスクトップに保存しています PlayLib.Window("設定").ScreenCapture(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "テーマの変更.png")); //■「設定」画面を閉じる PlayLib.Window("設定").Close(); } else //「テーマ」画面が開かなかった場合 { PlayLib.TestLogError("「テーマ」画面が開きませんでした"); return -1; } return 0; } }