コード例 #1
0
        public void TestText()
        {
            FormsButton button = new FormsButton(testDlg["button"]());

            button["Text"]("abc");
            Assert.AreEqual("abc", button.Text);
        }
コード例 #2
0
        public void TestEnabled()
        {
            FormsButton button = new FormsButton(testDlg["button"]());

            button["Enabled"](false);
            Assert.IsFalse(button.Enabled);
            button["Enabled"](true);
            Assert.IsTrue(button.Enabled);
        }
コード例 #3
0
        public void TestVisible()
        {
            FormsButton button = new FormsButton(testDlg["button"]());

            button["Visible"](false);
            Assert.IsFalse(button.Visible);
            button["Visible"](true);
            Assert.IsTrue(button.Visible);
        }
コード例 #4
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);
 }
コード例 #5
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);
 }
コード例 #6
0
        public void WinForms()
        {
            var app = new WindowsAppFriend(Process.Start("WinForms.exe"));
            var mainForm = app.Type().System.Windows.Forms.Application.OpenForms[0];

            //WinFormsの場合は変数名で取りましょう。
            var _buttonX = new FormsButton(mainForm._buttonX);
            _buttonX.EmulateClick();

            //ポップアップメニューも変数からとる
            var _toolStripMenuItemA = new FormsToolStripItem(mainForm._toolStripMenuItemA);
            _toolStripMenuItemA.EmulateClick();

            //とは言え、取れないときも
            //そんなときは工夫する
            WindowsAppExpander.LoadAssembly(app, GetType().Assembly);
            var button名無し = new FormsButton(app.Type().Tips.ChildControl.Get名無し(mainForm));
            button名無し.EmulateClick();

            //メニューアイテムも上位ライブラリ使えばインデックスとかテキストから取れたり
            var menu = new FormsToolStrip(mainForm._contextMenuStrip);
            var b = menu.FindItem("B");
            b.EmulateClick();

            Process.GetProcessById(app.ProcessId).Kill();
        }
コード例 #7
0
        /// <summary>
        /// 起動きりたん(Process) I/O取得
        /// </summary>
        private void controlvoiceroid()
        {
            //VOICEROID起動
            Process watch;

            watch = Process.GetProcessesByName("VOICEROID")[0];

            var w    = new WindowsAppFriend(watch);
            var main = WindowControl.FromZTop(w);

            //テキストボックス
            tb = main.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 1);

            //再生ボタン
            playbtn = new FormsButton(main.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 0, 3));

            //保存ボタン
            savebtn = new FormsButton(main.IdentifyFromZIndex(2, 0, 0, 1, 0, 1, 0, 1));
            //main.GetFromWindowText(" 再生") 用spy++ 去看function 找出來
            //new FormsButton(指定某個東西 EXmain.GetFromWindowText(" 再生")).EmulateClick(); 點他(event)
            //或是main.IdentifyFromZIndex 一層一層往下找 跟psy++ 所標得 大小相同就是那個object


            ShowWindow(FindWindow(main.IdentifyFromZIndex(0).WindowClassName, null), 2);
        }
コード例 #8
0
        public void TestButtonClick()
        {
            app.LoadAssembly(GetType().Assembly);
            app.LoadAssembly(typeof(Cell).Assembly);
            app.LoadAssembly(typeof(WindowControl).Assembly);
            app.LoadAssembly(typeof(FormsControlBase).Assembly);
            var    cell = app.Dim(new Cell());
            string t    = (string)cell["GetType"]()["Assembly"]()["ToString"]().Core;

            app[GetType(), "AAA"]();

            FormsButton button = new FormsButton(testDlg["button"]());

            button.EmulateClick();
            int count = (int)testDlg["async_counter"]().Core;

            Assert.AreEqual(1, count);

            //非同期
            app[GetType(), "ClickEvent"](button.AppVar);
            button.EmulateClick(new Async());
            new NativeMessageBox(testDlg.WaitForNextModal()).EmulateButtonClick("OK");
            count = (int)testDlg["async_counter"]().Core;
            Assert.AreEqual(2, count);
        }
コード例 #9
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);
 }
コード例 #10
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);
 }
コード例 #11
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);
 }
コード例 #12
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);
 }
コード例 #13
0
        public void Test()
        {
            var textBox = new FormsTextBox(_form._textBox);
            var button  = new FormsButton(_form._button);

            textBox.EmulateChangeText("abc");
            button.SetFocus();

            string err = _form._errorProvider.GetError(_form._textBox);

            Assert.AreEqual("数字じゃないよ。", err);
        }
コード例 #14
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);
 }
コード例 #15
0
        public IndexBuildFormDriver(WindowControl window, Async async)
        {
            Window = window;
            Async  = async;

            TargetDirText       = new FormsTextBox(Window.Dynamic().TargetDirText);
            ReferenceButton     = new FormsButton(Window.Dynamic().ReferenceButton);
            UpdateIndexButton   = new FormsButton(Window.Dynamic().UpdateIndexButton);
            AddOuterIndexButton = new FormsButton(Window.Dynamic().AddOuterIndexButton);
            StopButton          = new FormsButton(Window.Dynamic().StopButton);
            ProgressBar         = new FormsProgressBar(Window.Dynamic().ProgressBar);
            ActiveIndexGrid     = new FwFlexGridEx(Window.Dynamic().ActiveIndexGrid);
            IndexHistoryGrid    = new FwFlexGridEx(Window.Dynamic().IndexHistoryGrid);
        }
コード例 #16
0
        public OuterIndexFormDriver(WindowControl window, Async async)
        {
            Window = window;
            Async  = async;

            OuterStorePathText  = new FormsTextBox(Window.Dynamic().OuterStorePathText);
            OuterTargetPathText = new FormsTextBox(Window.Dynamic().OuterTargetPathText);
            LocalPathText       = new FormsTextBox(Window.Dynamic().LocalPathText);

            ReferenceButton = new FormsButton(Window.Dynamic().ReferenceButton);
            OKButton        = new FormsButton(Window.Dynamic().OKButton);
            CancelButton    = new FormsButton(Window.Dynamic().CancelButton1);

            ActiveIndexGrid = new FwFlexGridEx(Window.Dynamic().ActiveIndexGrid);
        }
        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();
        }
コード例 #18
0
        protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                customControl = e.NewElement;
                nativeControl = new FormsButton();

                var style = Application.Current.Resources["NextPrevButtonStyle"] as Style;

                nativeControl.Style            = style;
                nativeControl.Command          = customControl.Command;
                nativeControl.CommandParameter = customControl.CommandParameter;
                nativeControl.Content          = customControl.Text;
                nativeControl.Click           += nativeControl_Click;
                nativeControl.IsEnabled        = customControl.IsEnabled;
                SetNativeControl(nativeControl);
            }
        }
コード例 #19
0
 protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
 {
     base.OnElementChanged(e);
     if (e.NewElement != null)
     {
         Style style;
         customControl = e.NewElement;
         nativeControl = new FormsButton();
         if ((e.NewElement as HACCPHomePageButton).RemoveBorderOnClick)
         {
             style = Application.Current.Resources["BorderLessButtonStyle"] as Style;
         }
         else
         {
             style = Application.Current.Resources["HomeButtonStyle"] as Style;
         }
         nativeControl.Style            = style;
         nativeControl.Command          = customControl.Command;
         nativeControl.CommandParameter = customControl.CommandParameter;
         SetNativeControl(nativeControl);
     }
 }