コード例 #1
1
 public void TestInitialize()
 {
     _app = new WindowsAppFriend(Process.Start(Target.Path));
     _main = WindowControl.FromZTop(_app);
     _comboBox = new GcComboBoxDriver(_main.Dynamic()._comboBox);
     _comboBoxShiftJIS = new GcComboBoxDriver(_main.Dynamic()._comboBox_ShiftJIS);
 }
コード例 #2
1
        public void TestHandleAndAppVar()
        {
            Process process = null;
            using (WindowsAppFriend app = SetUp())
            {
                process = Process.GetProcessById(app.ProcessId);
                WindowControl targetForm = WindowControl.FromZTop(app);

                //AppVarのテスト
                targetForm.AppVar["Text"]("xxx");
                Assert.AreEqual(targetForm.AppVar["Text"]().ToString(), "xxx");

                //ハンドルのテスト
                WindowControl targetForm2 = new WindowControl(app, targetForm.Handle);
                targetForm2["Text"]("yyy");
                Assert.AreEqual(targetForm2["Text"]().ToString(), "yyy");
            }
            if (process != null)
            {
                process.CloseMainWindow();
            }
        }
コード例 #3
0
 public MainFormDriver(WindowControl window)
 {
     Window = window;
     ListBoxEmployee = new FormsListBox(window.Dynamic()._listBoxEmployee);
     ButtonAdd = new FormsButton(window.Dynamic()._buttonAdd);
     ButtonSearch = new FormsButton(window.Dynamic()._buttonSearch);
 }
コード例 #4
0
 public void TestInitialize()
 {
     _app = new WindowsAppFriend(Process.Start(Target.Path));
     _main = WindowControl.FromZTop(_app);
     _textBox = new GcTextBoxDriver(_main.Dynamic()._textBox);
     _textBoxShiftJIS = new GcTextBoxDriver(_main.Dynamic()._textBoxShiftJIS);
     _multiLineText = new GcTextBoxDriver(_main.Dynamic()._multiLineText);
 }
コード例 #5
0
		public void TestInitialize()
		{
			_app = new WindowsAppFriend( Process.Start( Target.Path ) );
			var main = _app.Type<Application>().OpenForms[ 0 ];
			new FormsButton( main._buttonNormal ).EmulateClick( new Async() );
			var dlg = new WindowControl( main ).WaitForNextModal();
			_grid = new GcMultiRowDriver( dlg.Dynamic()._grid );
		}
コード例 #6
0
 public SearchFormDriver(WindowControl window, Async async)
 {
     Async = async;
     Window = window;
     ButtonExecute = new FormsButton(Window.Dynamic()._buttonExecute);
     TextBoxSearch = new FormsTextBox(Window.Dynamic()._textBoxSearch);
     ListBoxEmployee = new FormsListBox(Window.Dynamic()._listBoxEmployee);
 }
コード例 #7
0
 public void TestInitialize()
 {
     _app = new WindowsAppFriend(Process.Start(Target.Path));
     var main = WindowControl.FromZTop(_app);
     var a = new Async();
     new WPFButtonBase(main.Dynamic()._buttonXamOutlookBar).EmulateClick(a);
     _dlg = main.WaitForNextModal();
     _outlook = new XamOutlookBarDriver(_dlg.Dynamic()._outlook);
 }
 public void SetUp()
 {
     app = new WindowsAppFriend(Process.Start(TargetPath.NativeControls));
     EventChecker.Initialize(app);
     WindowControl main = WindowControl.FromZTop(app);
     NativeButton buttonTest = new NativeButton(main.IdentifyFromDialogId(1030));
     buttonTest.EmulateClick(new Async());
     testDlg = main.WaitForNextModal();
 }
コード例 #9
0
 public AddFormDriver(WindowControl window, Async async)
 {
     Window = window;
     Async = async;
     ButtonEntry = new FormsButton(Window.Dynamic()._buttonEntry);
     TextBoxName = new FormsTextBox(Window.Dynamic()._textBoxName);
     TextBoxAddress = new FormsTextBox(Window.Dynamic()._textBoxAddress);
     RadioButtonWoman = new FormsRadioButton(Window.Dynamic()._radioButtonWoman);
     RadioButtonMan = new FormsRadioButton(Window.Dynamic()._radioButtonMan);
 }
コード例 #10
0
        public void TestInitialize()
        {
            _app = new WindowsAppFriend(Process.Start(Target.Path));
            var main = WindowControl.FromZTop(_app);
            var a = new Async();

            new FormsButton(main.Dynamic()._buttonFlexGrid).EmulateClick(a);
            _dlg = main.WaitForNextModal();
            _grid = new C1FlexGridDriver(_dlg.Dynamic()._grid);
        }
コード例 #11
0
        public void TestEmulateChangeCellTextAsync()
        {
            app.Type <WPFDataGridTest>().AddEditEvent(dataGrid.AppVar);
            Async         async = new Async();
            WindowControl main  = WindowControl.FromZTop(app);

            dataGrid.EmulateChangeCellText(0, 0, "xxx", async);
            new NativeMessageBox(main.WaitForNextModal()).EmulateButtonClick("OK");
            async.WaitForCompletion();
            Assert.AreEqual("xxx", (string)dataGrid.Dynamic().ItemsSource[0].Name);
        }
コード例 #12
0
        public void TestEmulateCellCheckAsync()
        {
            app.Type <WPFDataGridTest>().AddEditEvent(dataGrid.AppVar);
            Async         async = new Async();
            WindowControl main  = WindowControl.FromZTop(app);

            dataGrid.EmulateCellCheck(0, 2, true, async);
            new NativeMessageBox(main.WaitForNextModal()).EmulateButtonClick("OK");
            async.WaitForCompletion();
            Assert.AreEqual(true, (bool)dataGrid.Dynamic().ItemsSource[0].IsActive);
        }
コード例 #13
0
        public void TestPoupu()
        {
            var window = WindowControl.FromZTop(app);
            var target = new WindowControl(window.Dynamic()._popupCheck);

            target.Click(MouseButtonType.Right);
            app.SendKeys("5");
            app.SendKeys("a");

            Assert.AreEqual((string)window.Dynamic()._textBox.Text, "Menu10");
        }
コード例 #14
0
        public void TestDoubleClick1()
        {
            var window = WindowControl.FromZTop(app);

            for (int i = 0; i < 5; i++)
            {
                window.DoubleClick();
            }
            Assert.AreEqual((string)window.Dynamic()._textBox.Text, "DoubleClick : 5");
            Assert.AreEqual((int)window.Dynamic()._click, 5);
        }
コード例 #15
0
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        /// <param name="windowControl">ウィンドウコントロール</param>
        /// <param name="viewModel">ViewModel</param>
        public ShortcutKey(WindowControl windowControl, ShortcutKeyViewModel viewModel)
        {
            var visualTree = windowControl.VisualTree();

            this.ViewModel        = viewModel;
            this.FullScreen       = new WPFShortcutKeyBox(visualTree.ByBinding("FullScreen").Single());
            this.ActiveControl    = new WPFShortcutKeyBox(visualTree.ByBinding("ActiveControl").Single());
            this.SelectionControl = new WPFShortcutKeyBox(visualTree.ByBinding("SelectionControl").Single());
            this.SelectionRegion  = new WPFShortcutKeyBox(visualTree.ByBinding("SelectionRegion").Single());
            this.WebPage          = new WPFShortcutKeyBox(visualTree.ByBinding("WebPage").Single());
        }
コード例 #16
0
        /// <summary>
        /// WAV書き出しメニューをクリックし、音声ファイル保存ダイアログを取得する。
        /// </summary>
        /// <param name="mainWindow">メインウィンドウ。</param>
        /// <param name="speechDataGrid">セリフデータグリッド。</param>
        /// <param name="saveMenuAsync">
        /// WAV書き出しメニュークリック処理用の非同期オブジェクト。
        /// </param>
        /// <returns>音声ファイル保存ダイアログ。表示されなかった場合は null 。</returns>
        private Result <WindowControl> SaveFileImpl_ClickSaveMenu(
            dynamic mainWindow,
            WpfDataGrid speechDataGrid,
            Async saveMenuAsync)
        {
            Debug.Assert((DynamicAppVar)mainWindow != null);
            Debug.Assert(speechDataGrid != null);
            Debug.Assert(saveMenuAsync != null);

            WindowControl fileDialog = null;

            try
            {
                // WAVE書き出しメニューアイテムを取得
                var menuItem = speechDataGrid.Base.ContextMenu.Items[12];

                if (!(bool)menuItem.IsEnabled)
                {
                    return(null, @"本体のWAV書き出しメニューがクリックできない状態です。");
                }

                // WAVE書き出しメニュークリック
                PerformClick(menuItem, saveMenuAsync);

                // ファイルダイアログを待つ
                fileDialog = new WindowControl(mainWindow).WaitForNextModal(saveMenuAsync);
                if (fileDialog == null)
                {
                    return(null, @"本体の音声保存ダイアログが見つかりません。");
                }

                // ダイアログタイトルを確認
                switch (fileDialog.GetWindowText())
                {
                case SaveFileDialogTitle:
                    // OK
                    break;

                case SaveSomeFilesDialogTitle:
                    // 連続書き出しダイアログになってしまっている
                    return(null, @"本体側で連続WAV書き出しダイアログが表示されました。");

                default:
                    return(null, @"本体側でダイアログが表示されました。");
                }
            }
            catch (Exception ex)
            {
                ThreadTrace.WriteException(ex);
                return(null, @"本体のWAV書き出しメニューをクリックできませんでした。");
            }

            return(fileDialog);
        }
コード例 #17
0
 public void TestInitialize()
 {
     app = new WindowsAppFriend(Process.Start("Target.exe"));
     WindowsAppExpander.LoadAssembly(app, GetType().Assembly);
     dynamic win = app.Type(typeof(Application)).Current.MainWindow;
     dynamic grid = win._grid;
     dynamic target = app.Type<Expander>()();
     grid.Children.Add(target);
     expander = new WPFExpander(target);
     window = new WindowControl(win);
 }
コード例 #18
0
        public void TestEmulateChangeCellComboSelectAsync()
        {
            app.Type <WPFDataGridTest>().AddEditEvent(dataGrid.AppVar);
            Async         async = new Async();
            WindowControl main  = WindowControl.FromZTop(app);

            dataGrid.EmulateChangeCellComboSelect(0, 1, 2, async);
            new NativeMessageBox(main.WaitForNextModal()).EmulateButtonClick("OK");
            async.WaitForCompletion();
            Assert.AreEqual(ProgramingLanguage.CSP, (ProgramingLanguage)dataGrid.Dynamic().ItemsSource[0].Language);
        }
コード例 #19
0
ファイル: ResourceDrawSystem.cs プロジェクト: Wekaj/VoidGate
        public ResourceDrawSystem(SpriteBatch spriteBatch, WindowControl window, ContentManager content)
        {
            this.spriteBatch = spriteBatch;
            this.window      = window;

            // Load content.
            resourceAvailable        = content.Load <Texture2D>("Textures/resource_available");
            resourceSpent            = content.Load <Texture2D>("Textures/resource_spent");
            resourceAvailableFlipped = content.Load <Texture2D>("Textures/resource_available_flipped");
            resourceSpentFlipped     = content.Load <Texture2D>("Textures/resource_spent_flipped");
        }
コード例 #20
0
 public void OnResource(int Id)
 {
     if (Id > DataManage.HeroJsonData.Count)
     {
         WindowControl.SetConsole("跳转失败,该数据你还没有保存");
         return;
     }
     else
     {
         transform.parent.Find("Panel").GetComponent <UIDeploy>().OnOrSetToggle("ResourceConfig", heroData[Id].ID);
     }
 }
コード例 #21
0
        public void TestMaxPostMessage2()
        {
            WindowControl targetForm = WindowControl.FromZTop(app);

            app[typeof(Thread), "Sleep", new Async()](20000);
            targetForm["_incValue"](0);
            for (int i = 0; i < 11000; i++)
            {
                targetForm["Inc", new Async()]();
            }
            Assert.AreEqual(targetForm["_incValue"](), 11000);
        }
コード例 #22
0
        protected virtual void SetEffect(EffectType t, float value)
        {
            ChangeToVoiceEffect();
            int           index   = (int)t;
            WindowControl control = _root.IdentifyFromZIndex(2, 0, 0, 0, 0, 0, 0, index);
            AppVar        v       = control.AppVar;

            v["Focus"]();
            v["Text"](string.Format("{0:0.00}", value));

            // TODO: VOICEROID+では数値を変更するだけでは変更が行われないため何らかの方法が必要
        }
コード例 #23
0
        protected void RestoreMinimizedWindow()
        {
            const uint      WM_SYSCOMMAND = 0x0112;
            const int       SC_RESTORE    = 0xF120;
            FormWindowState state         = (FormWindowState)_root["WindowState"]().Core;

            if (state == FormWindowState.Minimized)
            {
                SendMessage(_root.Handle, WM_SYSCOMMAND,
                            new IntPtr(SC_RESTORE), IntPtr.Zero);
            }
        }
コード例 #24
0
        //Init
        public BankWindow(Canvas gameCanvas)
        {
            mBankWindow = new WindowControl(gameCanvas, Globals.GuildBank ? Strings.Guilds.Bank.ToString(Globals.Me?.Guild) : Strings.Bank.title.ToString(), false, "BankWindow");
            mBankWindow.DisableResizing();
            Interface.InputBlockingElements.Add(mBankWindow);

            mItemContainer = new ScrollControl(mBankWindow, "ItemContainer");
            mItemContainer.EnableScroll(false, true);

            mBankWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
            InitItemContainer();
        }
 /// <summary>
 /// すべて閉じる
 /// </summary>
 /// <param name="testDlg">ダイアログ</param>
 /// <param name="async">きっかけとなった非同期処理</param>
 /// <returns>閉じたダイアログの個数</returns>
 internal static int CloseAll(WindowControl testDlg, Async async)
 {
     for (int i = 0; true; i++)
     {
         WindowControl msg = testDlg.WaitForNextModal(async);
         if (msg == null)
         {
             return i;
         }
         new NativeMessageBox(msg).EmulateButtonClick("OK");
     }
 }
コード例 #26
0
        public void TestEmulateChangeCurrentCellAsync()
        {
            app.Type <WPFDataGridTest>().AddCurrentCellEvent(dataGrid.AppVar);
            Async         async = new Async();
            WindowControl main  = WindowControl.FromZTop(app);

            dataGrid.EmulateChangeCurrentCell(2, 1, async);
            new NativeMessageBox(main.WaitForNextModal()).EmulateButtonClick("OK");
            async.WaitForCompletion();
            Assert.AreEqual(2, dataGrid.CurrentItemIndex);
            Assert.AreEqual(1, dataGrid.CurrentColIndex);
        }
コード例 #27
0
        public void TestDoubleClick2()
        {
            var window = WindowControl.FromZTop(app);
            var target = new WindowControl(window.Dynamic()._clickCheck);

            target.DoubleClick(MouseButtonType.Left, new Point(2, 3));
            Assert.AreEqual((string)window.Dynamic()._textBox.Text, "CheckDoubleClick : Left, 2, 3");
            target.DoubleClick(MouseButtonType.Middle, new Point(4, 5));
            Assert.AreEqual((string)window.Dynamic()._textBox.Text, "CheckDoubleClick : Middle, 4, 5");
            target.DoubleClick(MouseButtonType.Right, new Point(6, 7));
            Assert.AreEqual((string)window.Dynamic()._textBox.Text, "CheckDoubleClick : Right, 6, 7");
        }
コード例 #28
0
        public void TestInitialize()
        {
            app = new WindowsAppFriend(Process.Start("Target.exe"));
            WindowsAppExpander.LoadAssembly(app, GetType().Assembly);
            dynamic win    = app.Type(typeof(Application)).Current.MainWindow;
            dynamic grid   = win._grid;
            dynamic target = app.Type <Expander>()();

            grid.Children.Add(target);
            expander = new WPFExpander(target);
            window   = new WindowControl(win);
        }
コード例 #29
0
        public void SetUp()
        {
            _app = new WindowsAppFriend(Process.Start("Target.exe"));
            _mainWindow = WindowControl.FromZTop(_app);

            dynamic win = _app.Type<Application>().Current.MainWindow;
            dynamic grid = win._grid;
            _target = _app.Type<ProgressBar>()();
            grid.Children.Add(_target);

            WindowsAppExpander.LoadAssemblyFromFile(_app, GetType().Assembly.Location);
        }
 internal static void CloseAll(WindowControl testDlg)
 {
     while (testDlg.IsWindow())
     {
         WindowControl next = WindowControl.FromZTop(testDlg.App);
         if (next.Handle == testDlg.Handle || next.Handle == testDlg.ParentWindow.Handle)
         {
             continue;
         }
         new NativeMessageBox(next).EmulateButtonClick("OK");
     }
 }
コード例 #31
0
 public static bool TryAttach(WindowControl window, out string title)
 {
     title = null;
     if (window.GetFromWindowClass("SysTreeView32").Length != 1 ||
         window.GetFromWindowText("OK").Length != 1 ||
         window.GetFromWindowText("キャンセル").Length != 1)
     {
         return(false);
     }
     title = window.GetWindowText();
     return(true);
 }
コード例 #32
0
        //Init
        public DebugMenu(Canvas gameCanvas)
        {
            mDebugWindow = new WindowControl(gameCanvas, Strings.Debug.title);
            mDebugWindow.SetSize(200, 212);
            mDebugWindow.SetPosition(0, 150);
            mDebugWindow.DisableResizing();
            mDebugWindow.Margin  = Margin.Zero;
            mDebugWindow.Padding = Padding.Zero;
            mDebugWindow.Hide();

            mFpsLabel = new Label(mDebugWindow);
            mFpsLabel.SetPosition(4, 4);

            mPingLabel = new Label(mDebugWindow);
            mPingLabel.SetPosition(4, 16);

            mDrawsLabel = new Label(mDebugWindow);
            mDrawsLabel.SetPosition(4, 28);

            mMapLabel = new Label(mDebugWindow);
            mMapLabel.SetPosition(4, 40);

            mXLabel = new Label(mDebugWindow);
            mXLabel.SetPosition(4, 52);

            mYLabel = new Label(mDebugWindow);
            mYLabel.SetPosition(4, 64);

            mZLabel = new Label(mDebugWindow);
            mZLabel.SetPosition(4, 76);

            mEntitiesLabel = new Label(mDebugWindow);
            mEntitiesLabel.SetPosition(4, 88);

            mMapsLoadedLabel = new Label(mDebugWindow);
            mMapsLoadedLabel.SetPosition(4, 100);

            mMapsDrawnLabel = new Label(mDebugWindow);
            mMapsDrawnLabel.SetPosition(4, 112);

            mEntitiesDrawnLabel = new Label(mDebugWindow);
            mEntitiesDrawnLabel.SetPosition(4, 124);

            mLightsDrawnLabel = new Label(mDebugWindow);
            mLightsDrawnLabel.SetPosition(4, 136);

            mTimeLabel = new Label(mDebugWindow);
            mTimeLabel.SetPosition(4, 148);

            mInterfaceObjectsLabel = new Label(mDebugWindow);
            mInterfaceObjectsLabel.SetPosition(4, 160);
        }
コード例 #33
0
        private void BuildWindow(ref ByteColor LeftPanelColor)
        {
            //Create the Close Button
            _debugWindow        = new WindowControl();
            _debugWindow.Name   = "DebugComponent";
            _debugWindow.Title  = "Debug Component";
            _debugWindow.Bounds = new UniRectangle(0, 0, 600, 400);
            _closeBt            = ToDispose(new CloseWindowButtonControl()
            {
                Bounds = new UniRectangle(_debugWindow.Bounds.Right - 20, 5, 15, 15)
            });
            _closeBt.Pressed += closeBt_Pressed;
            _debugWindow.Children.Add(_closeBt);

            //Create the Left Menu panel
            PanelControl menu = ToDispose(new PanelControl()
            {
                Bounds = new UniRectangle(4, 24, 100, _debugWindow.Bounds.Size.Y - 28), Color = LeftPanelColor
            });
            LabelControl menu_title = ToDispose(new LabelControl()
            {
                Bounds = new UniRectangle(5, 0, menu.Bounds.Size.X, 30), Color = Color.Yellow, Text = "Visualisation"
            });

            menu.Children.Add(menu_title);

            ButtonControl btOptions = ToDispose(new ButtonControl()
            {
                Tag = "btOptions", Bounds = new UniRectangle(4, menu_title.Bounds.Bottom - 6, 92, 40), Text = "Debug Options"
            });

            btOptions.Pressed += new EventHandler(btMenu_Pressed);
            menu.Children.Add(btOptions);

            ButtonControl btComponent = ToDispose(new ButtonControl()
            {
                Tag = "btComponent", Bounds = new UniRectangle(4, menu_title.Bounds.Bottom - 6 + 40, 92, 40), Text = "Game Comp."
            });

            btComponent.Pressed += new EventHandler(btMenu_Pressed);
            menu.Children.Add(btComponent);

            ButtonControl btPerf = ToDispose(new ButtonControl()
            {
                Tag = "btPerf", Bounds = new UniRectangle(4, menu_title.Bounds.Bottom - 6 + 80, 92, 40), Text = "Perf. Comp."
            });

            btPerf.Pressed += new EventHandler(btMenu_Pressed);
            menu.Children.Add(btPerf);

            _debugWindow.Children.Add(menu);
        }
コード例 #34
0
 public void OnDetail(int Id)
 {
     print(Id);
     if (Id > DataManage.HeroJsonData.Count)
     {
         WindowControl.SetConsole("跳转失败,该数据你还没有保存");
         return;
     }
     else
     {
         transform.parent.Find("Panel").GetComponent <UIDeploy>().OnOrSetToggle("BasicInformation", heroData[Id].ID);
     }
 }
コード例 #35
0
        private void CreateOptionsWindow()
        {
            Log.Debug("ModOptions", "Creating mod options window");

            optionsWindow           = Window.Create("(SkyT) Mod Options", false);
            optionsWindow.IsVisible = false;

            optionsWindow.IsResizable = true;
            optionsWindow.Title       = "Mod Options";
            optionsWindow.Close      += optionsWindow_Close;

            GameObject.DontDestroyOnLoad(optionsWindow);
        }
コード例 #36
0
        private void timer_Elapsed(object sender, EventArgs e)
        {
            WindowControl playButton = _root.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 0, 3);
            AppVar        button     = playButton.AppVar;
            string        text       = (string)button["Text"]().Core;

            if (!_playStarting && text.Trim() == "再生")
            {
                _timer.Stop();
                OnFinished();
            }
            _playStarting = false;
        }
コード例 #37
0
        public void SelectedIndexAsync()
        {
            app.Type <WPFListBoxTest>().AddSelectionEvent(listBox.AppVar);
            Async         async = new Async();
            WindowControl main  = WindowControl.FromZTop(app);

            listBox.EmulateChangeSelectedIndex(3, async);
            new NativeMessageBox(main.WaitForNextModal()).EmulateButtonClick("OK");
            async.WaitForCompletion();
            int index = listBox.SelectedIndex;

            Assert.AreEqual(3, index);
        }
コード例 #38
0
        public void GetItemEmulateChangeSelectedAsync()
        {
            WindowControl windowControl = WindowControl.FromZTop(app);
            var           item          = listBox.GetItem(99);

            app.Type(GetType()).MessageBoxEvent(item);
            var a = new Async();

            item.EmulateChangeSelected(true, a);
            Assert.IsTrue(item.IsSelected);
            new NativeMessageBox(windowControl.WaitForNextModal()).EmulateButtonClick("OK");
            a.WaitForCompletion();
        }
コード例 #39
0
        //Init
        public ShopWindow(Canvas gameCanvas)
        {
            mShopWindow = new WindowControl(gameCanvas, Globals.GameShop.Name, false, "ShopWindow");
            mShopWindow.DisableResizing();
            Interface.InputBlockingElements.Add(mShopWindow);

            mItemContainer = new ScrollControl(mShopWindow, "ItemContainer");
            mItemContainer.EnableScroll(false, true);

            mShopWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());

            InitItemContainer();
        }
コード例 #40
0
ファイル: EnemyHandSystem.cs プロジェクト: Wekaj/VoidGate
        public EnemyHandSystem(WindowControl window, ContentManager content, List <Card> deck)
            : base(content, new Vector2(window.Width / LD34Game.Scale, 0f), false, false, deck)
        {
            this.window    = window;
            random         = new Random();
            changeTimer    = 0f;
            selectionDelay = 1f;
            targetCard     = 0;

            // Load content.
            growIconFlipped = content.Load <Texture2D>("Textures/grow_icon_flipped");
            playIconFlipped = content.Load <Texture2D>("Textures/play_icon_flipped");
        }
コード例 #41
0
        /// <summary>
        /// VOICEROID+ に入力された文字列を再生します
        /// </summary>
        public virtual void Play()
        {
            WindowControl playButton = _root.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 0, 3);
            AppVar        button     = playButton.AppVar;
            string        text       = (string)button["Text"]().Core;

            if (text.Trim() == "再生")
            {
                button["PerformClick"]();
                _playStarting = true;
                _timer.Start();
            }
        }
コード例 #42
0
 /// <summary>
 /// Voiceroidを起動する。すでに起動している場合には起動しているものを操作対象とする。
 /// </summary>
 public void Activate()
 {
     if (IsActive())
     {
         _app = new WindowsAppFriend(_process);
     }
     else
     {
         _process = Process.Start(VoiceroidPath);
         _app     = new WindowsAppFriend(_process);
     }
     _root = WindowControl.GetTopLevelWindows(_app)[0];
 }
コード例 #43
0
 public SearchFormDriver(WindowControl window)
 {
     Window            = window;
     SearchButton      = new FormsButton(Window.Dynamic().SearchButton);
     ClearButton       = new FormsButton(Window.Dynamic().ClearButton);
     KeywordText       = new FormsTextBox(Window.Dynamic().KeywordText);
     ExtensionText     = new FormsTextBox(Window.Dynamic().ExtensionText);
     UpdateDate1       = new FwC1DateEdit(Window.Dynamic().UpdateDate1);
     UpdateDate2       = new FwC1DateEdit(Window.Dynamic().UpdateDate2);
     ShowPreviewButton = new FormsButton(Window.Dynamic().ShowPreviewButton);
     TargetIndexGrid   = new FwFlexGridEx(Window.Dynamic().TargetIndexGrid);
     ReslutGrid        = new FwFlexGridEx(Window.Dynamic().ReslutGrid);
 }
コード例 #44
0
 public void TestInitialize()
 {
     _app = new WindowsAppFriend(Process.Start(Target.Path));
     var main = WindowControl.FromZTop(_app);
     var a = new Async();
     new WPFButtonBase(main.Dynamic()._buttonXamEditors).EmulateClick(a);
     _dlg = main.WaitForNextModal();
     _combo = new XamComboEditorDriver(_dlg.Dynamic()._combo);
     _numeric = new XamValueEditorDriver(_dlg.Dynamic()._numeric);
     _dateTime = new XamValueEditorDriver(_dlg.Dynamic()._dateTime);
     _currency = new XamValueEditorDriver(_dlg.Dynamic()._currency);
     _masked = new XamValueEditorDriver(_dlg.Dynamic()._masked);
     _text = new XamValueEditorDriver(_dlg.Dynamic()._text);
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="window">The message box's main window.</param>
#else
        /// <summary>
        /// コンストラクタ。
        /// </summary>
        /// <param name="window">メッセージボックス本体。</param>
#endif
        public NativeMessageBox(WindowControl window)
        {
            _window = window;
            _title = _window.GetWindowText();
            _message = string.Empty;
            foreach (WindowControl staticControl in window.GetFromWindowClass("Static"))
            {
                string text = staticControl.GetWindowText();
                if (!string.IsNullOrEmpty(text))
                {
                    _message = text;
                    break;
                }
            }
        }
コード例 #46
0
        public void Wpf()
        {
            var app = new WindowsAppFriend(Process.Start("Wpf.exe"));
            AppVar window = app.Type().System.Windows.Application.Current.MainWindow;
            var logicalTree = window.LogicalTree();
            var buttonModal = new WPFButtonBase(logicalTree.ByBinding("CommandModal").Single());
            var buttonModeless = new WPFButtonBase(logicalTree.ByBinding("CommandModeless").Single());

            //モーダレスは通常はそのままでOK
            buttonModeless.EmulateClick();
            var next = app.Type().System.Windows.Application.Current.Windows[1];
            next.Title = "aaa";

            //でもたまに変なことしているやつがいれば注意
            //まあ、こっち使った方が無難
            var nextW = WindowControl.WaitForIdentifyFromWindowText(app, "aaa");
            nextW.Dynamic().Close();

            //モーダルは要注意
            var current = new WindowControl(window);

            {
                var a = new Async();
                buttonModal.EmulateClick(a);
                var modal = current.WaitForNextModal();
                modal.Dynamic().Close();
                a.WaitForCompletion();
            }

            //連続で出るやつはもっと注意
            var buttonModalSequential = new WPFButtonBase(logicalTree.ByBinding("CommandModalSequential").Single());
            {
                var a = new Async();
                buttonModalSequential.EmulateClick(a);

                var modal1 = current.WaitForNextModal();
                modal1.Dynamic().Close();
                modal1.WaitForDestroy();

                var modal2 = current.WaitForNextModal();
                modal2.Dynamic().Close();
                modal2.WaitForDestroy();

                a.WaitForCompletion();
            }

            Process.GetProcessById(app.ProcessId).Kill();
        }
        public void Friendlyなめんなよ()
        {
            var app = new WindowsAppFriend(Process.Start("WinForms.exe"));
            var form = app.Type().System.Windows.Forms.Application.OpenForms[0];
            WindowsAppExpander.LoadAssembly(app, GetType().Assembly);

            var button = new FormsButton(form._buttonFile);
            var a = new Async();
            button.EmulateClick(a);
            var dlg = new WindowControl(form).WaitForNextModal();

            OpenFile(dlg, @"c:\TestData\data.txt");

            a.WaitForCompletion();
            Process.GetProcessById(app.ProcessId).Kill();
        }
        static void OpenFile(WindowControl fileDialog, string path)
        {
            //ボタン取得
            var buttonOpen = new NativeButton(fileDialog.IdentifyFromWindowText("開く(&O)"));

            //コンボボックスは二つある場合がある。
            //下の方を採用。
            var comboBoxPathSrc = fileDialog.GetFromWindowClass("ComboBoxEx32").OrderBy(e =>
            {
                RECT rc;
                GetWindowRect(e.Handle, out rc);
                return rc.Top;
            }).Last();
            var comboBoxPath = new NativeComboBox(comboBoxPathSrc);

            //パスを設定
            comboBoxPath.EmulateChangeEditText(path);

            //開くボタンを押す
            buttonOpen.EmulateClick();
        }
コード例 #49
0
 public void TestGetWindowFromHandle()
 {
     Process process = null;
     using (WindowsAppFriend app = SetUpWpf())
     {
         process = Process.GetProcessById(app.ProcessId);
         //ウィンドウハンドルから取得
         AppVar v = null;
         {
             WindowControl targetForm = new WindowControl(app, process.MainWindowHandle);
             targetForm["Title"]("aaa");
             Assert.AreEqual(targetForm["Title"]().ToString(), "aaa");
             v = targetForm.AppVar;
         }
     }
     if (process != null)
     {
         process.CloseMainWindow();
     }
 }
 public void SetUp()
 {
     app = new WindowsAppFriend(Process.Start(TargetPath.NativeControls));
     EventChecker.Initialize(app);
     main = WindowControl.FromZTop(app);
 }
コード例 #51
0
 internal WaitForm(WindowsAppFriend app, WindowControl oldTop)
 {
     _app = app;
     _oldTop = oldTop;
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="src">WindowControl with the target window. </param>
#else
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="src">元となるウィンドウコントロールです。</param>
#endif
        public NativeProgress(WindowControl src)
            : base(src)
        {
            Initializer.Initialize(App);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="src">WindowControl with the target window. </param>
#else
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="src">元となるウィンドウコントロールです。</param>
#endif
        public NativeComboBox(WindowControl src)
            : base(src)
        {
            Initializer.Initialize(App);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="src">WindowControl with the target window. </param>
#else
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="src">元となるウィンドウコントロールです。</param>
#endif
        public NativeSpinButton(WindowControl src)
            : base(src)
        {
            Initializer.Initialize(App);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="src">WindowControl with the target window. </param>
#else
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="src">元となるウィンドウコントロールです。</param>
#endif
        public NativeScrollBar(WindowControl src)
            : base(src)
        {
            Initializer.Initialize(App);
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="src">WindowControl with the target window. </param>
#else
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="src">元となるウィンドウコントロールです。</param>
#endif
        public NativeMonthCalendar(WindowControl src)
            : base(src)
        {
            Initializer.Initialize(App);
        }
        /// <summary>
        ///  Cancels editing asynchronously.
        /// </summary>
        /// <param name="async">Asynchronous execution object.</param>
#else
        /// <summary>
        ///  編集キャンセル。
        /// </summary>
        /// <param name="async">非同期実行オブジェクト。</param>
#endif
        public void EmulateCancelEdit(Async async)
        {
            WindowControl edit = new WindowControl(App, SendMessage(LVM_GETEDITCONTROL, IntPtr.Zero, IntPtr.Zero));
            edit.SequentialMessage(async,
                new MessageInfo(NativeCommonDefine.WM_KEYDOWN, 0x1B, 0x10001),
                new MessageInfo(NativeCommonDefine.WM_CHAR, 0x1B, 0x10001),
                new MessageInfo(NativeCommonDefine.WM_KEYUP, 0x1B, 0xC0010001));
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="src">WindowControl with the target window. </param>
#else
        /// <summary>
        /// コンストラクタです。
        /// </summary>
        /// <param name="src">元となるウィンドウコントロールです。</param>
#endif
        public NativeListControl(WindowControl src)
            : base(src)
        {
            Initializer.Initialize(App);
        }
        public void TestChangeContextByWindowHandle()
        {
            //フォームの取得
            WindowControl targetForm = WindowControl.FromZTop(app);

            //別スレッドウィンドウを表示
            WindowControl _buttonOtherThread = targetForm.IdentifyFromZIndex(0);
            _buttonOtherThread["PerformClick"]();

            //表示待ち
            IntPtr nextHandle = IntPtr.Zero;
            while (nextHandle == IntPtr.Zero)
            {
                EnumWindowsDelegate callBack = delegate(IntPtr hWnd, int lParam)
                {
                    int lpdwProcessId;
                    GetWindowThreadProcessId(hWnd, out lpdwProcessId);
                    if (lpdwProcessId != app.ProcessId)
                    {
                        return 1;
                    }

                    StringBuilder lpString = new StringBuilder(1000);
                    GetWindowText(hWnd, lpString, 1000);
                    if (lpString.ToString() == "NormalGuiForm")
                    {
                        nextHandle = hWnd;
                        return 0;
                    }
                    return 1;
                };
                EnumWindows(callBack, 0);
                GC.KeepAlive(callBack);
            }

            //実行コンテキストを変更
            using (ExecuteContext context = new ExecuteContext(app, nextHandle))
            {
                ExecuteContext oldContext = app.ChangeContext(context);

                //ウィンドウコントロール生成
                WindowControl next = new WindowControl(app, nextHandle);

                //別スレッドウィンドウを操作
                AppVar _textBoxSrc = next["_textBoxSrc"]();
                _textBoxSrc["Text"]("xxx");
                AppVar _buttonCopyText = next["_buttonCopyText"]();
                _buttonCopyText["PerformClick"]();
                AppVar _textBoxDst = next["_textBoxDst"]();
                //操作の結果_textBoxDstにxxxが入力される
                Assert.AreEqual(_textBoxDst["Text"]().ToString(), "xxx");
                try
                {
                    next["Close"]();
                }
                catch (FriendlyOperationException) { }//スレッドが終了してしまうので、通信途中で通信不能となる これは仕様

                //コンテキストをもとに戻す
                app.ChangeContext(oldContext);
            }
            //ウィンドウを操作しても例外が発生しない
            targetForm["Handle"]();
            targetForm["Text"]("xxx");
        }