protected override void InitControls()
        {
            this.Text            = "Browse for Folder and File";
            this.Width           = 500;
            this.Height          = 400;
            this.BackColor       = ColorTool.White;
            this.StartUpPosition = WindowsStartupPosition.CenterScreen;
            this._TextPath       = new NativeTextBox();

            this._TextPath.Left   = 10;
            this._TextPath.Top    = 10;
            this._TextPath.Width  = 200;
            this._TextPath.Height = 20;
            this._TextPath.Style |= WindowStylesConst.WS_BORDER;

            this._PathSelectButton          = new NativeButton();
            this._PathSelectButton.Left     = this._TextPath.Left + this._TextPath.Width + 2;
            this._PathSelectButton.Top      = this._TextPath.Top;
            this._PathSelectButton.Width    = 30;
            this._PathSelectButton.Height   = 20;
            this._PathSelectButton.Text     = "…";
            this._PathSelectButton.Clicked += PathSelectButton_Click;

            this.Controls.Add(this._TextPath);
            this.Controls.Add(this._PathSelectButton);
        }
Esempio n. 2
0
        private void MergeFile(WindowControl fileDialog, string path)
        {
            var buttonOpen = new NativeButton(fileDialog.IdentifyFromWindowText("開く(&O)"));

            var comboBoxMergeOrderSrc = fileDialog.GetFromWindowClass("ComboBox").OrderBy(e =>
            {
                RECT rc;
                GetWindowRect(e.Handle, out rc);
                return(rc.Top);
            }).Last();
            var comboBoxMergeOrder = new NativeComboBox(comboBoxMergeOrderSrc);

            comboBoxMergeOrder.EmulateSelectItem(1);


            var editPathSrc = fileDialog.GetFromWindowClass("Edit").OrderBy(e =>
            {
                RECT rc;
                GetWindowRect(e.Handle, out rc);
                return(rc.Left);
            }).Last();
            var editPath = new NativeEdit(editPathSrc);

            editPath.EmulateChangeText(path);

            buttonOpen.EmulateClick();
        }
        public SaveFileDialogDriver(WindowControl window)
        {
            _window = window;
            var combo = _window.GetFromWindowClass("ComboBox").OrderBy(e => NativeMethods.GetTop(e)).ToArray()[1];

            ComboBox_FilePath = new NativeComboBox(combo);
            Button_保存         = new NativeButton(_window.IdentifyFromWindowText("保存(&S)"));
            Button_キャンセル      = new NativeButton(_window.IdentifyFromWindowText("キャンセル"));
        }
        public OpenFileDialogDriver(WindowControl window)
        {
            _window = window;
            var combo = _window.GetFromWindowClass("ComboBoxEx32").OrderBy(e => NativeMethods.GetTop(e)).Last();

            ComboBox_FilePath = new NativeComboBox(combo);
            Button_開く         = new NativeButton(_window.IdentifyFromWindowText("開く(&O)"));
            Button_キャンセル      = new NativeButton(_window.IdentifyFromWindowText("キャンセル"));
        }
Esempio n. 5
0
        private void CreatedButton_Clicked(object sender, EventArgs e)
        {
            NativeButton bn = sender as NativeButton;

            if (bn != null)
            {
                MessageBox.Show("Button Click=>" + bn.Name);
            }
        }
Esempio n. 6
0
        internal override Drawing.Size GetPreferredSizeCore(Drawing.Size proposedSize)
        {
            if (this.AutoSize)
            {
                return(NativeButton.SizeThatFits(proposedSize.ToCGSize()).ToSDSize());
            }

            return(base.GetPreferredSizeCore(proposedSize));
        }
Esempio n. 7
0
 protected override void InitControls()
 {
     this.ButtonOne          = new NativeButton();
     this.ButtonOne.Left     = 10;
     this.ButtonOne.Top      = 10;
     this.ButtonOne.Width    = 99;
     this.ButtonOne.Height   = 33;
     this.ButtonOne.Text     = "ClickMe";
     this.ButtonOne.Clicked += OnButtonOne_Click;
     this.Controls.Add(this.ButtonOne);
 }
Esempio n. 8
0
        protected override void InitControls()
        {
            this.Width           = 400;
            this.Height          = 200;
            this.Text            = "Message";
            this.StartUpPosition = WindowsStartupPosition.CenterScreen;
            NativeLabel frameLabel = new NativeLabel
            {
                Location  = new Point(0, 0),
                Width     = this.Width,
                Height    = 110,
                BackColor = ColorTool.White
            };

            this._LblMessage = new NativeLabel
            {
                Location = new Point(80, 20),
                Width    = this.Width - 110,
                Height   = this.Height - 110,
                Text     = "Enter your text\nEnter your Text",
                //BackColor = ColorTool.Gray,
                //ForeColor = ColorTool.White,
            };
            this._LblIcon = new NativeBitmap
            {
                BitMap   = "asset\\Question.bmp",
                Location = new Point(10, this._LblMessage.Height / 2 - 25),
                Width    = 50,
                Height   = 50,
            };
            this._BnOk = new NativeButton
            {
                Location = new Point(this.Width - 30 - 80, 120),
                Width    = 80,
                Height   = 25,
                Text     = "&Ok"
            };
            this._BnOk.Clicked += Ok_Clicked;
            this._BnCancel      = new NativeButton
            {
                Location = new Point(this._BnOk.Left - 10 - 80, 120),
                Width    = 80,
                Height   = 25,
                Text     = "&Cancel"
            };

            this._BnCancel.Clicked += Cancel_Clicked;
            this.Controls.Add(frameLabel);
            this.Controls.Add(this._LblIcon);
            this.Controls.Add(this._LblMessage);
            this.Controls.Add(this._BnOk);
            this.Controls.Add(this._BnCancel);
        }
Esempio n. 9
0
        //public Window2(NativeWindow parent) : base(parent)
        //{

        //}
        protected override void InitControls()
        {
            this.Text   = "Dies ist ein 2. Fenster";
            this.Name   = "Window2";
            this.Left   = 100;
            this.Top    = 100;
            this.Width  = 600;
            this.Height = 400;

            this.Click               += Window2_Click;
            this.DoubleClick         += Window2_DblClick;
            this.Create              += Window2_Create;
            this._WebBrowser          = new NativeWebBrowser();
            this._WebBrowser.Location = new Diga.Core.Api.Win32.Point(100, 100);
            this._WebBrowser.Width    = 200;
            this._WebBrowser.Height   = 200;
            this._WebBrowser.Url      = "https://www.google.de";

            this._Button          = new NativeButton();
            this._Button.Left     = 100;
            this._Button.Top      = 100;
            this._Button.Width    = 100;
            this._Button.Height   = 30;
            this._Button.Text     = "Add a Button";
            this._Button.Name     = "nativeButton";
            this._Button.Clicked += Button_AddButton;

            this._Link              = new NativeLink();
            this._Link.Left         = 200;
            this._Link.Top          = 100;
            this._Link.Width        = 300;
            this._Link.Height       = 25;
            this._Link.Text         = "For more information, <A ID=\"TEST\" HREF=\"https://www.microsoft.com\">click here</A> or <A ID=\"idInfo\">here</A>.";
            this._Link.LinkClicked += Link_Clicked;
            this._Link.Font         = new Font()
            {
                Name = "Arial", Size = 12
            };

            this._GroupBox        = new NativeGroupBox();
            this._GroupBox.Left   = 100;
            this._GroupBox.Top    = 250;
            this._GroupBox.Width  = 300;
            this._GroupBox.Height = 100;
            this._GroupBox.Text   = "TEST";


            this.Controls.Add(this._WebBrowser);
            this.Controls.Add(this._Button);
            this.Controls.Add(this._Link);
            this.Controls.Add(this._GroupBox);
        }
        public OpenFileDialogDriver(WindowControl window)
        {
            Core = window;
            ComboBox_FilePath = new NativeComboBox(Core.GetFromWindowClass("ComboBoxEx32").OrderBy(e => GetWindowRect(e.Handle).Top).Last());
            var handle = ComboBox_FilePath.ParentWindow.Handle;

            try
            {
                ComboBox_FileType = new NativeComboBox(Core.GetFromWindowClass("ComboBox").Where(e => e.ParentWindow.Handle == handle).OrderBy(e => GetWindowRect(e.Handle).Top).Last());
            }
            catch { }
            Button_Open   = new NativeButton(Core.IdentifyFromWindowText("開く(&O)"));
            Button_Cancel = new NativeButton(Core.IdentifyFromWindowText("キャンセル"));
        }
Esempio n. 11
0
        void ReleaseDesignerOutlets()
        {
            if (NativeButton != null)
            {
                NativeButton.Dispose();
                NativeButton = null;
            }

            if (NativeTextView != null)
            {
                NativeTextView.Dispose();
                NativeTextView = null;
            }
        }
Esempio n. 12
0
        public SaveFileDialogDriver(WindowControl core)
        {
            Core = core;

            var combos        = Core.GetFromWindowClass("ComboBox");
            int indexFileName = combos.Length == 3 ? 1 : 0;
            int indexFileType = combos.Length == 3 ? 2 : 1;
            var sortedComobs  = combos.OrderBy(e => GetWindowRect(e.Handle).Top).ToArray();

            ComboBox_FileName = new NativeComboBox(sortedComobs[indexFileName]);
            ComboBox_FileType = new NativeComboBox(sortedComobs[indexFileType]);

            Button_Save   = new NativeButton(Core.IdentifyFromWindowText("保存(&S)"));
            Button_Cancel = new NativeButton(Core.IdentifyFromWindowText("キャンセル"));
        }
Esempio n. 13
0
        private void Button_AddButton(object sender, EventArgs e)
        {
            NativeButton bn = new NativeButton();

            bn.Left        = this.lastLeft;
            bn.Top         = this.LastTop;
            bn.Height      = 30;
            bn.Width       = 100;
            this.lastLeft += bn.Width + 5;
            this.LastTop  += bn.Height + 5;
            bn.Text        = "Button" + this.lastLeft;
            bn.ForeColor   = CoreWindowsWrapper.Tools.ColorTool.Blue;
            bn.BackColor   = CoreWindowsWrapper.Tools.ColorTool.White;
            bn.Name        = bn.Text;
            bn.Clicked    += CreatedButton_Clicked;
            this.Controls.Add(bn);
        }
Esempio n. 14
0
        protected override void InitControls()
        {
            //this.Width = 400;
            //this.Height = 400;
            this.Text     = "Test TExt";
            this.KeyDown += FormKeyDown;


            this.BackColor = CoreWindowsWrapper.Tools.ColorTool.Rgb(255, 255, 255);
            this._IpEdit   = new NativeIpAddressEdit()
            {
                Top    = 10,
                Left   = 10,
                Width  = 120,
                Height = 25
            };

            this._TestButton = new NativeButton()
            {
                Top    = 40,
                Left   = 10,
                Width  = 100,
                Height = 25,
                Text   = "TEST"
            };
            this._Label = new NativeLabel()
            {
                BackColor = CoreWindowsWrapper.Tools.ColorTool.ControlBackground,
                Top       = 80,
                Left      = 10,
                Width     = 150,
                Height    = 25,
                Font      = new Font()
                {
                    Name = "Arial", Size = 15
                }
            };

            this._TestButton.Clicked += OnTestButtonClick;
            this.Controls.Add(this._IpEdit);
            this.Controls.Add(this._TestButton);
            this.Controls.Add(this._Label);
        }
Esempio n. 15
0
        protected override void Initialize()
        {
            base.Initialize();
            Debug.Print(this.Width.ToString());

            this._TextBox        = new NativeTextBox();
            this._Button         = new NativeButton();
            this._TextBox.Width  = this.Width - 20;
            this._TextBox.Height = this.Height;
            this._TextBox.Left   = 0;
            this._TextBox.Top    = 0;
            this._TextBox.Name   = "CONTROL_TEST_TXT";
            this._Button.Width   = 20;
            this._Button.Height  = this.Height;
            this._Button.Left    = this._TextBox.Width;
            this._Button.Top     = 0;
            this._Button.Name    = "CONTROL_TEST_BT";
            this._Button.Text    = "...";

            this._Button.Clicked += Button_Clicked;
            this.Controls.Add(this._TextBox);
            this.Controls.Add(this._Button);
        }
Esempio n. 16
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            this._Panel1Window = new CoreWindowsWrapper.NativeWindow(this.panel1.Handle);
            this._Panel2Window = new CoreWindowsWrapper.NativeWindow(this.panel2.Handle);
            this._NativeWindow = new CoreWindowsWrapper.NativeWindow(this.Handle);

            this._Panel2Window.Size += OnSize;
            NativeMenu menuFile = new NativeMenu("mnuFile", "&File");

            //Create Sub-Items for File-Menu
            NativeMenuItem menuFileOpen  = new NativeMenuItem("mnuOpen", "&Open");
            NativeMenuItem menuFileClose = new NativeMenuItem("mnuSave", "&Save");
            NativeMenuItem menuFileSep   = new NativeMenuItem("mnuFileSep")
            {
                IsSeparator = true
            };
            NativeMenuItem menFileExit = new NativeMenuItem("mnuExit", "E&xit");

            //Add Menu Event Handlers
            menuFileClose.Click += FileSave_Click;
            menuFileOpen.Click  += FileOpen_Click;
            menFileExit.Click   += Menu_Exit;

            //Add The Sub-Items to File-Menu
            menuFile.Items.Add(menuFileOpen);
            menuFile.Items.Add(menuFileClose);
            menuFile.Items.Add(menuFileSep);
            menuFile.Items.Add(menFileExit);

            //Create Help-Menu
            NativeMenu menuHelp = new NativeMenu("&Help");
            //Add Sub-Item to Help-Menu
            NativeMenuItem menuInfo = new NativeMenuItem("&Info");

            //Add Event-Handler
            menuInfo.Click += MenuInfo_Click;
            //Add the Sub-Item to the Help-Menu
            menuHelp.Items.Add(menuInfo);
            //Add the Help-Menu to the File-Menu
            menuFile.Items.Add(menuHelp);
            this._NativeWindow.Menu      = menuFile;
            this._NativeWindow.BackColor = CoreWindowsWrapper.Tools.ColorTool.White;


            this._Button = new NativeButton
            {
                Left   = 10,
                Top    = 0,
                Width  = 100,
                Height = 30,
                Text   = "<",
                Font   = new Font()
                {
                    Name = "Segoe UI Symbol", Size = 15
                },
                Name      = "bnTestA",
                BackColor = ColorTool.Blue,
                ForeColor = ColorTool.Green
            };

            this._Button.Font.Name = "Segoe UI ";

            this._Button1 = new NativeButton
            {
                Left   = 150,
                Top    = 0,
                Width  = 100,
                Height = 30,
                Text   = ">",
                Name   = "bnTestB" //,
                                   //ControlId = 505
            };
            this._Button.Clicked += button_OnClicked;

            this._Button1.Clicked += button1_OnClicked;


            this._WebBrowser = new NativeWebBrowser()
            {
                Width                      = this._NativeWindow.Width,
                Height                     = this._NativeWindow.Height,
                Url                        = "http://www.itagnesmeyer.de",
                IsStatusBarEnabled         = true,
                DefaultContextMenusEnabled = false,
                DevToolsEnabled            = false
            };

            this._Panel2Window.Controls.Add(this._WebBrowser);
            this._Panel1Window.Controls.Add(this._Button);
            this._Panel1Window.Controls.Add(this._Button1);


            this._NativeWindow.PostCreateControls();
        }
Esempio n. 17
0
 public static IClickable MakeSync(this NativeButton button, Async async)
 {
     return(new ClickSync(button.EmulateClick, async.WaitForCompletion));
 }
Esempio n. 18
0
 public static IClickable <T> MakeModalOrSync <T>(this NativeButton button, Func <WindowControl, Async, T> create, Async async)
 {
     return(new ClickModalOrSync <T>(button.App, button.EmulateClick, (w, a) => create(w, a), async.WaitForCompletion));
 }
        /// <summary>
        /// VOICEROID2 に入力された文字列を保存します
        /// </summary>
        private void Save(string outputFilePath)
        {
            // 「音声保存」ボタン押下
            WPFButtonBase saveButton = new WPFButtonBase(_root.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 3, 5));

            saveButton.EmulateClick(new Async());
            Application.DoEvents();

            // 音声保存設定ダイアログの OK ボタン押下
            var           saveWindow   = WindowControl.GetFromWindowText(_app, "音声保存")[0];
            WPFButtonBase saveOkButton = new WPFButtonBase(saveWindow.IdentifyFromLogicalTreeIndex(0, 1, 0));

            saveOkButton.EmulateClick(new Async());
            Application.DoEvents();

            // 「名前を付けて保存」ダイアログで出力ファイル名を入力して OK ボタン押下
            WindowControl saveDialog          = WindowControl.WaitForIdentifyFromWindowText(_app, "名前を付けて保存");
            NativeButton  saveDialogButton    = new NativeButton(saveDialog.IdentifyFromDialogId(1));
            NativeEdit    saveFileNameTextBox = new NativeEdit(saveDialog.IdentifyFromZIndex(11, 0, 4, 0, 0));

            saveFileNameTextBox.EmulateChangeText(outputFilePath);
            Application.DoEvents();
            saveDialogButton.EmulateClick(new Async());
            Application.DoEvents();

            // 上書き確認ダイアログが出てきたら、 OK ボタンを押下
            // 出てくる前提で作っているけど、なぜか出ない場合でも問題なく動いているっぽい。
            while (true)
            {
                try {
                    WindowControl saveConfirmDialog       = WindowControl.IdentifyFromWindowText(_app, "名前を付けて保存");
                    NativeButton  saveConfirmDialogButton = new NativeButton(saveConfirmDialog.IdentifyFromDialogId(6));
                    saveConfirmDialogButton.EmulateClick(new Async());
                    Application.DoEvents();
                }
                catch (WindowIdentifyException e)
                {
                    // do nothing
                }

                // 保存成功通知ダイアログの OK ボタンを押下
                try {
                    WindowControl infoDialog       = WindowControl.IdentifyFromWindowText(_app, "情報");
                    NativeButton  infoDialogButton = new NativeButton(infoDialog.IdentifyFromDialogId(2));
                    infoDialogButton.EmulateClick(new Async());
                    Application.DoEvents();
                    break;
                }
                catch (WindowIdentifyException e)
                {
                    // do nothing
                }

                Thread.Sleep(100);
            }

            // おまじない
            // 再生の時もこれやっているので、何か意味があるのだろう。
            _isPlaying = false;
            _isRunning = false;
            _timer.Start();
        }
Esempio n. 20
0
        protected override void InitControls()
        {
            this.Text            = "Configuration Editor";
            this.Width           = 480;
            this.Height          = 430;
            this.IconFile        = "App.ico";
            this.StartUpPosition = WindowsStartupPosition.CenterScreen;

            int top       = 10;
            int leftLeft  = 10;
            int rightLeft = 120;


            this._ChkContextMenu = new NativeCheckBox
            {
                Location = new Point(leftLeft, top),
                Width    = 100,
                Height   = 20,
                Text     = "Context-Menu",
            };
            this._ChkContextMenu.Style |= WindowStylesConst.WS_TABSTOP;
            this._ChkDevTools           = new NativeCheckBox
            {
                Location = new Point(rightLeft, top),
                Width    = 100,
                Height   = 20,
                Text     = "Dev-Tools"
            };

            this._ChkStatusBar = new NativeCheckBox
            {
                Location = new Point(rightLeft + 110, top),
                Width    = 100,
                Height   = 20,
                Text     = "Statusbar"
            };


            this._ChkAppStatusBar = new NativeCheckBox
            {
                Location = new Point(this._ChkStatusBar.Left + this._ChkStatusBar.Width + 10, top),
                Width    = 100,
                Height   = 20,
                Text     = "App-Statusbar"
            };

            top += 30;
            NativeLabel lblTitle = new NativeLabel
            {
                Location  = new Point(leftLeft, top),
                Width     = 100,
                Height    = 20,
                Text      = "Title:",
                BackColor = this.BackColor
            };

            this._TxtTitle = new NativeTextBox
            {
                Location = new Point(rightLeft, top),
                Width    = 300,
                Height   = 20,
            };
            this._TxtTitle.Style |= WindowStylesConst.WS_BORDER;


            top += 30;
            NativeLabel lblUrl = new NativeLabel
            {
                Location  = new Point(leftLeft, top),
                Width     = 100,
                Height    = 20,
                Text      = "Url:",
                BackColor = this.BackColor
            };

            this._TxtUrl = new NativeTextBox
            {
                Location = new Point(rightLeft, top),
                Width    = 300,
                Height   = 20
            };
            this._TxtUrl.Style |= WindowStylesConst.WS_BORDER;


            top += 30;
            NativeLabel lblUserFolder = new NativeLabel
            {
                Location  = new Point(leftLeft, top),
                Width     = 100,
                Height    = 20,
                Text      = "Data-Folder:",
                BackColor = this.BackColor
            };

            this._TxtUserDataFolder = new NativeTextBox
            {
                Location = new Point(rightLeft, top),
                Width    = 300,
                Height   = 20
            };
            this._TxtUserDataFolder.Style |= WindowStylesConst.WS_BORDER;

            this._BnSelectUserDataFolder = new NativeButton
            {
                Location = new Point(rightLeft + 301, top),
                Width    = 25,
                Height   = 20,
                Text     = "…"
            };
            this._BnSelectUserDataFolder.Clicked += BnSelectUserDataFolder_Clicked;

            top += 30;
            NativeLabel lblBrowserExecutable = new NativeLabel
            {
                Location  = new Point(leftLeft, top),
                Width     = 100,
                Height    = 20,
                Text      = "Browser-Folder:",
                BackColor = this.BackColor
            };

            this._TxtBrowserExecutable = new NativeTextBox
            {
                Location = new Point(rightLeft, top),
                Width    = 300,
                Height   = 20
            };
            this._TxtBrowserExecutable.Style |= WindowStylesConst.WS_BORDER;

            this._BnSelectBrowserExecutable = new NativeButton
            {
                Location = new Point(rightLeft + 301, top),
                Width    = 25,
                Height   = 20,
                Text     = "…"
            };
            this._BnSelectBrowserExecutable.Clicked += BnSelectBrowserExecutable_Clicked;

            top += 30;
            this._ChkMonitoring = new NativeCheckBox
            {
                Location = new Point(leftLeft, top),
                Width    = 100,
                Height   = 20,
                Text     = "Monitoring"
            };

            top += 30;
            NativeLabel lblMonitoriingUrl = new NativeLabel
            {
                Location  = new Point(leftLeft, top),
                Width     = 100,
                Height    = 20,
                Text      = "Monitoring-Url:",
                BackColor = this.BackColor
            };

            this._TxtMonitoringUlr = new NativeTextBox
            {
                Location = new Point(rightLeft, top),
                Width    = 300,
                Height   = 20
            };
            this._TxtMonitoringUlr.Style |= WindowStylesConst.WS_BORDER;

            top += 30;
            NativeLabel lblMonitoriingPath = new NativeLabel
            {
                Location  = new Point(leftLeft, top),
                Width     = 100,
                Height    = 20,
                Text      = "Monitoring-Path:",
                BackColor = this.BackColor
            };

            this._TxtMonitoringPath = new NativeTextBox
            {
                Location = new Point(rightLeft, top),
                Width    = 300,
                Height   = 20
            };
            this._TxtMonitoringPath.Style |= WindowStylesConst.WS_BORDER;

            this._BnSelectMonitoringPath = new NativeButton
            {
                Location = new Point(rightLeft + 301, top),
                Width    = 25,
                Height   = 20,
                Text     = "…"
            };
            this._BnSelectMonitoringPath.Clicked += BnSelectMonitoringPath_Click;

            top       += 30;
            this._BnOk = new NativeButton
            {
                Width    = 80,
                Height   = 25,
                Location = new Point(this.Width - 33 - 81, top),
                Text     = "&Ok"
            };
            this._BnOk.Clicked += BnOk_Clicked;
            this._BnCancel      = new NativeButton
            {
                Width    = 80,
                Height   = 25,
                Location = new Point(this._BnOk.Left - 10 - 80, top),
                Text     = "&Cancel"
            };
            this._BnCancel.Clicked += BnCancel_Clicked;
            top        += 80;
            this.Height = top;
            this.Controls.Add(this._BnOk);
            this.Controls.Add(this._ChkContextMenu);
            this.Controls.Add(this._ChkDevTools);
            this.Controls.Add(this._ChkStatusBar);
            this.Controls.Add(this._ChkAppStatusBar);
            this.Controls.Add(lblTitle);
            this.Controls.Add(this._TxtTitle);
            this.Controls.Add(lblUrl);
            this.Controls.Add(this._TxtUrl);
            this.Controls.Add(lblUserFolder);
            this.Controls.Add(this._TxtUserDataFolder);
            this.Controls.Add(this._BnSelectUserDataFolder);
            this.Controls.Add(lblBrowserExecutable);
            this.Controls.Add(this._TxtBrowserExecutable);
            this.Controls.Add(this._BnSelectBrowserExecutable);
            this.Controls.Add(this._ChkMonitoring);
            this.Controls.Add(lblMonitoriingUrl);
            this.Controls.Add(this._TxtMonitoringUlr);
            this.Controls.Add(lblMonitoriingPath);
            this.Controls.Add(this._TxtMonitoringPath);
            this.Controls.Add(this._BnSelectMonitoringPath);

            this.Controls.Add(this._BnCancel);
        }
Esempio n. 21
0
        static void Main(string[] args)
        {
            // プロセスの取得
            Process[] ps = Process.GetProcessesByName("VoiceroidEditor");
            if (ps.Length == 0)
            {
                Console.Error.WriteLine("VOICEROID2を起動してください");
                return;
            }

            // WindowsAppFriendをプロセスから作成する
            // 接続できない旨のエラーの場合、別のプロセスでテスト対象のプロセスを操作している場合がある。
            // TestAssistant使いながら動作できないようなので、注意。
            var app = new WindowsAppFriend(ps[0]);

            var mainWindow = WindowControl.FromZTop(app);

            // 茜ちゃんしゃべる
            WPFTextBox txtMessage = new WPFTextBox(mainWindow.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 2));

            txtMessage.EmulateChangeText("アカネチャンカワイイヤッタ");

            WPFButtonBase btnPlay = new WPFButtonBase(mainWindow.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 3, 0));

            btnPlay.EmulateClick();

            // ステータスバーを監視してしゃべり終わるまでまつ
            String sts;

            do
            {
                System.Threading.Thread.Sleep(500);
                var txtStatusItem = mainWindow.IdentifyFromVisualTreeIndex(0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0).Dynamic();;
                sts = txtStatusItem.Text.ToString();
            } while (!sts.Equals("テキストの読み上げは完了しました。"));

            // 保存ボタン押下
            // ダイアログが表示されると引数なしのEmulateClickだと止まるのでAsyncオブジェクトを渡しておく
            var           async   = new Async();
            WPFButtonBase btnSave = new WPFButtonBase(mainWindow.IdentifyFromLogicalTreeIndex(0, 4, 3, 5, 3, 0, 3, 5));

            btnSave.EmulateClick(async);

            // 音声保存ダイアログ操作
            var           dlgSaveWav   = mainWindow.WaitForNextModal();
            var           asyncSaveWin = new Async();
            WPFButtonBase buttonOK     = new WPFButtonBase(dlgSaveWav.IdentifyFromLogicalTreeIndex(0, 1, 0));

            buttonOK.EmulateClick(asyncSaveWin);

            // ファイル名指定後の保存
            var        asyncSaveFile = new Async();
            var        dlgFileSave   = dlgSaveWav.WaitForNextModal();
            NativeEdit editFileName  = new NativeEdit(dlgFileSave.IdentifyFromZIndex(11, 0, 4, 0, 0));

            editFileName.EmulateChangeText(System.DateTime.Now.ToString("yyyymMMddhhmmss") + ".wav");

            NativeButton btnSaveOk = new NativeButton(dlgFileSave.IdentifyFromDialogId(1));

            btnSaveOk.EmulateClick(asyncSaveFile);

            // 情報ダイアログが表示されるまで待機してOKを押下
            var          dlgInfo = WindowControl.WaitForIdentifyFromWindowText(app, "情報");
            NativeButton btn     = new NativeButton(dlgInfo.IdentifyFromWindowText("OK"));

            btn.EmulateClick();


            //非同期で実行した保存ボタン押下の処理が完全に終了するのを待つ
            asyncSaveFile.WaitForCompletion();
            asyncSaveWin.WaitForCompletion();
            async.WaitForCompletion();


            // 葵ちゃんに切り替えてしゃべる
            // UIAutomationだと葵ちゃん切り替えが行えない。
            WPFListView ListView = new WPFListView(mainWindow.IdentifyFromLogicalTreeIndex(0, 4, 3, 3, 0, 1, 0, 2));

            ListView.EmulateChangeSelectedIndex(1);
            txtMessage.EmulateChangeText("オネエチャンカワイイヤッタ");
            btnPlay.EmulateClick();
            ListView.EmulateChangeSelectedIndex(0);
        }
Esempio n. 22
0
 public static IClickable <T> MakeModaleless <T>(this NativeButton button, Func <T> create)
 {
     return(new ClickModeless <T>(button.EmulateClick, () => create()));
 }
Esempio n. 23
0
        protected override void InitControls()
        {


            this.Text = CAPTION;
            this.Name = "Window1";
            //this.StatusBar = false;
            // this.Left = 100;
            //this.Top = 100;
            this.Width = 600;
            this.Height = 400;
            
            this._ControlTest = new ControlTest();
            this._ControlTest.Width = 200;
            this._ControlTest.Height = 30;
            this._ControlTest.Left = 300;
            this._ControlTest.Top = 80;
            this._ControlTest.Name = "TEST_CONTAINER";
            
            //this.BackColor = ColorTool.LightGray;
            this.StartUpPosition = WindowsStartupPosition.CenterScreen;
            this.BackColor = ColorTool.White;
            this._Timer = new NativeTimer();
            this._Timer.Interval = 100;
            //this._Timer.ControlId = 700;
            this._Timer.Tick += Timer_OnTick;
            this._Button = new NativeButton
            {
                Left = 10,
                Top = 10,
                Width = 100,
                Height = 30,
                Text = "Test",
                Name = "bnTest",
                BackColor = ColorTool.Blue,
                ForeColor = ColorTool.Green

            };

            this._Button1 = new NativeButton
            {
                Left = 150,
                Top = 10,
                Width = 100,
                Height = 30,
                Text = "Test",
                Name = "bnTest"//,
                //ControlId = 505
            };
            this._Button.Clicked += button_OnClicked;
            this._Button.DblClicked += button_OnDblClicked;
            this._Button1.Clicked += button1_OnClicked;
            this._Button1.DblClicked += button1_OnDblClicked;

            this._Button3 = new NativeButton
            {
                Location = new Point(300, 10),
                Width = 20,
                Height = 30,
                Name = "SelectFolder",
                Text = "…"
            };

            this._Button3.Clicked += Button3_Click;
            this._ComboBox = new NativeComboBox();
            this._ComboBox.Location = new Point(350, 10);
            
            this._ComboBox.Height = 30;
            this._ComboBox.Width = 200;
            this._ComboBox.Name = "cbbTest";
            this._ComboBox.ForeColor = ColorTool.Blue;
            this._ComboBox.BackColor = ColorTool.Green;
            this._ComboBox.Font = new Font() { Name = "Arial", Size = 10 };
            this._ComboBox.SelChange += ComboBox_SelChange;


            this._TextBox = new NativeTextBox
            {
                Left = 10,
                Top = 50,
                Width = 100,
                Height = 30,
                Text = "ATEST",
                Name = "txtTest",
                Font = new Font() { Name = "Arial", Size = 14 },
                ForeColor = ColorTool.Read
                //ControlId = 502
            };
            this._TextBox.Change += TextBox_Change;

            this._TextBox2 = new NativeTextBox
            {
                Left = 10,
                Top = 150,
                Width = 100,
                Height = 30,
                Text = "",
                Name = "txt2Test",
                //ControlId = 503,
                BackColor = ColorTool.Black,
                ForeColor = ColorTool.White

            };

            this._Label1 = new NativeLabel
            {
                Left = 10,
                Top = 200,
                Width = 100,
                Height = 30,
                Text = "Dies ist ein Label"//,
                                           //BackColor=ColorTool.Read,
                                           //ForeColor = ColorTool.Green,
                                           //ControlId = 504

            };
            this._Label1.Clicked += Label1_Click;
            this._Label1.DblClicked += Label1_DblClick;

            this._Bitmap = new NativeBitmap();
            this._Bitmap.BitMap = "Skype.bmp";
            this._Bitmap.Left = 150;
            this._Bitmap.Top = 50;
            this._Bitmap.Width = 100;
            this._Bitmap.Height = 100;

            this._CheckBox = new NativeCheckBox();
            this._CheckBox.Left = 300;
            this._CheckBox.Top = 50;
            this._CheckBox.Width = 200;
            this._CheckBox.Height = 30;
            this._CheckBox.Text = "TEST CHECKBOX";
            this._CheckBox.BackColor = ColorTool.White;
            this._CheckBox.Checked = true;

            this._ListBox = new NativeListBox();
            this._ListBox.Left = 300;
            this._ListBox.Top = 200;
            this._ListBox.Width = 400;
            this._ListBox.Height = 400;
            this._ListBox.BackColor = ColorTool.Yellow;
            this._ListBox.ForeColor = ColorTool.Read;
            this._ListBox.Font = new Font() { Name = "Arial", Size = 16 };
            this._ListBox.MultiSelect = true;
            this._ListBox.DblClicked+=ListBox_DblClicked;
            
            this._ListBox.SelChange+=ListBox_SelChange;

            this._ProgressBar = new NativeProgress
            {
                Left = 10,
                Top = 250,
                Width = 150,
                Height = 30//,
                //ControlId = 507
            };



            this._TextBox.Clicked += TextBox_Click;
            
            this.Controls.Add(this._Button);
            this.Controls.Add(this._Button1);
            this.Controls.Add(this._Button3);
            this.Controls.Add(this._ComboBox);
            this.Controls.Add(this._TextBox);
            this.Controls.Add(this._TextBox2);
            this.Controls.Add(this._Label1);
            this.Controls.Add(this._Bitmap);
            this.Controls.Add(this._CheckBox);
            this.Controls.Add(this._ListBox);
            this.Controls.Add(this._ProgressBar);
            this.Controls.Add(this._Timer);
            this.Controls.Add(this._ControlTest);
            Click += Window1_Click;
            DoubleClick += Window1_DblClick;
            Create += Window1_Create;
            this.MouseMove += Window1_MoseMove;
        }
Esempio n. 24
0
 public static IClickable <T> MakeModal <T>(this NativeButton button, Func <WindowControl, Async, T> create)
 {
     return(new ClickModal <T>(button.App, button.EmulateClick, (w, a) => create(w, a)));
 }