当前位置: 首页>>代码示例>>C#>>正文


C# Button.Click方法代码示例

本文整理汇总了C#中Button.Click方法的典型用法代码示例。如果您正苦于以下问题:C# Button.Click方法的具体用法?C# Button.Click怎么用?C# Button.Click使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Button的用法示例。


在下文中一共展示了Button.Click方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BrowseForValue

 public virtual void BrowseForValue()
 {
     Click();
     AutomationElement browseButtonElement = gridElementFinder.FindBrowseButton();
     if (browseButtonElement == null) throw new WhiteException(string.Format("Property {0} isn't browsable.", Text));
     var button = new Button(browseButtonElement, actionListener);
     button.Click();
 }
开发者ID:EricBlack,项目名称:White,代码行数:8,代码来源:PropertyGridProperty.cs

示例2: Test_Checkpoint2

        public void Test_Checkpoint2()
        {
            //checkpoint1
            UICondition uIcondition = UICondition.Create("@ControlType=Window and @Name='IronPython Direct3D'", new object[0]);
            WindowOpenedWaiter wait1 = new WindowOpenedWaiter(uIcondition);
            Process.Start(CMD, ".\\checkpoints\\checkpoint2.py");

            wait1.Wait(20000);
            UIObject ui = UIObject.Root.Children.Find(uIcondition);
            UIObject uiClose = ui.FirstChild.Children.Find("Close");
            Button buttonClose = new Button(uiClose);
            Thread.Sleep(2000);
            buttonClose.Click();
        }
开发者ID:TerabyteX,项目名称:main,代码行数:14,代码来源:WinClass.cs

示例3: SetDisplayState

 private void SetDisplayState(Button button)
 {
     if (button == null) return;
     button.Click();
 }
开发者ID:tmandersson,项目名称:FastGTD,代码行数:5,代码来源:TitleBar.cs

示例4: Test_Close

 public void Test_Close()
 {
     UIObject uIClose = this.uImain.Descendants.Find("Close");
     Button bu = new Button(uIClose);
     bu.Click();
 }
开发者ID:TerabyteX,项目名称:main,代码行数:6,代码来源:WinClass.cs

示例5: Test_StopAll

 public void Test_StopAll()
 {
     UICondition uICoStopAll = UICondition.Create("@Name='Stop All'", new Object[0]);
     UIObject uIStopAll = this.uImain.Children.Find(uICoStopAll);
     Button button = new Button(uIStopAll);
     button.Click();
 }
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:WinClass.cs

示例6: Test_Scrollbar

 public void Test_Scrollbar()
 {
     UICondition uICoScro = UICondition.Create("@Name='Amplitude'and @ControlType=ScrollBar", new Object[0]);
     UIObject uIScor= this.uImain.Children.Find(uICoScro);
     ScrollBar scrollBar = new ScrollBar(uIScor);
     Button button = new Button(scrollBar.Children.Find(UICondition.Create("@Name='Page left'",new Object[0])));
     for (int i = 1; i < 7; i++)
     {
         button.Click();
     }
 }
开发者ID:TerabyteX,项目名称:main,代码行数:11,代码来源:WinClass.cs

示例7: Test_RemoveSource

 public void Test_RemoveSource()
 {
     UICondition uICoRem = UICondition.Create("@Name='Remove Source'", new Object[0]);
     UIObject uIRem = this.uImain.Children.Find(uICoRem);
     Button button = new Button(uIRem);
     while (this.CarNum >2)
     {
         button.Click();
         this.CarNum--;
     }
 }
开发者ID:TerabyteX,项目名称:main,代码行数:11,代码来源:WinClass.cs

示例8: ImportMultipleFilesFromMenu

        public void ImportMultipleFilesFromMenu()
        {
            IDPickerAllSettings settings = null;

            Func<AppRunner> createTestCase = () =>
            {
                return (app, windowStack) =>
                {
                    var window = app.GetWindow(SearchCriteria.ByAutomationId("IDPickerForm"), InitializeOption.NoCache);
                    var statusBar = window.Get<StatusStrip>();
                    var statusText = statusBar.Get<TextBox>();
                    windowStack.Push(window);

                    settings = app.GetAndSetTestSettings(windowStack);

                    var menu = window.RawGet<MenuBar>(SearchCriteria.ByAutomationId("menuStrip1"), 2);
                    //menu.MenuItemBy(SearchCriteria.ByAutomationId("toolsToolStripMenuItem"), SearchCriteria.ByAutomationId("optionsToolStripMenuItem")).Click();
                    menu.MenuItem("File", "Import files").Click(); // FIXME: not localized, but the AutomationIds aren't being set properly so the above line won't work

                    var importFilesForm = window.ModalWindow(SearchCriteria.ByAutomationId("IDPOpenDialog"), InitializeOption.WithCache);
                    windowStack.Push(importFilesForm);

                    // make sure "all importable IDPicker formats" is selected, should be the first option
                    var sourceType = importFilesForm.Get<ComboBox>("sourceTypeComboBox");
                    sourceType.Select(0);

                    var fileTree = importFilesForm.Get<Tree>(SearchCriteria.ByAutomationId("FileTree"));
                    List<string> pathSegments = TestContext.TestOutputPath().Split('\\').ToList();
                    pathSegments[0] += '\\';
                    var node = fileTree.Node(pathSegments.ToArray());
                    node.Select();
                    importFilesForm.Get<Button>("AddNode").Click(); // TODO: fix variable names in Jay's code to be consistent with my code
                    Thread.Sleep(500);
                    importFilesForm.Get<Button>("openButton").RaiseClickEvent();
                    window.WaitWhileBusy();

                    // check:
                    // - trying to save to a read only location prompts for a new location
                    // - choosing an existing filepath asks user to confirm overwriting
                    // - that the automatically generated merged filepath is correct
                    Window saveDialog = null;
                    IDPicker.Util.TryRepeatedly<ArgumentOutOfRangeException>(() => saveDialog = window.ModalWindows()[0], 10, 500);
                    windowStack.Push(saveDialog);

                    // HACK: saveDialog.Get<TextBox>() won't work because of some unsupported control types in the Save Dialog (at least on Windows 7); I'm not sure if the 1001 id is stable
                    var saveTarget = new TextBox(saveDialog.AutomationElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "1001")), new NullActionListener());
                    Assert.AreEqual(TestContext.TestOutputPath("201208-378803.idpDB"), saveTarget.Text);

                    var saveButton = new Button(saveDialog.AutomationElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "1")), new NullActionListener());
                    saveButton.Click();
                    windowStack.Pop();

                    var progressForm = window.ModalWindow(SearchCriteria.ByAutomationId("ProgressForm"), InitializeOption.NoCache);
                    windowStack.Push(progressForm);

                    var importSettings = window.ModalWindow(SearchCriteria.ByAutomationId("UserDialog"));
                    windowStack.Push(importSettings);

                    var settingsTable = importSettings.GetFastTable("dataGridView");
                    Assert.IsNotNull(settingsTable);
                    Assert.AreEqual(4, settingsTable.Rows.Count);

                    Assert.AreEqual(7, settingsTable.Rows[0].Cells.Count);
                    UnitTestExtensions.AssertSequenceEquals(new Object[] { "Comet 2014.02", FilepathOrFilename(settingsTable.Rows[0].Cells[1].Value.ToString()), "XXX_", "2", 0.1m.ToString(CultureInfo.CurrentCulture), "False", "Comet optimized" }, settingsTable.Rows[0].Cells.Select(o => o.Value).ToArray());
                    UnitTestExtensions.AssertSequenceEquals(new Object[] { "MyriMatch 2.2.140", FilepathOrFilename(settingsTable.Rows[1].Cells[1].Value.ToString()), "XXX_", "2", 0.1m.ToString(CultureInfo.CurrentCulture), "False", "MyriMatch optimized" }, settingsTable.Rows[1].Cells.Select(o => o.Value).ToArray());
                    UnitTestExtensions.AssertSequenceEquals(new Object[] { "MS-GF+ Beta (v10072)", FilepathOrFilename(settingsTable.Rows[2].Cells[1].Value.ToString()), "XXX", "2", 0.1m.ToString(CultureInfo.CurrentCulture), "False", "MS-GF+" }, settingsTable.Rows[2].Cells.Select(o => o.Value).ToArray());
                    UnitTestExtensions.AssertSequenceEquals(new Object[] { "Mascot 2.2.06", "cow.protein.PRG2012-subset.fasta", "DECOY_", "2", 0.1m.ToString(CultureInfo.CurrentCulture), "False", "Mascot ionscore" }, settingsTable.Rows[3].Cells.Select(o => o.Value).ToArray());

                    // HACK: for some reason White's TableCell.Value property isn't sending keyboard input correctly;
                    // with this workaround, be careful while debugging around this code because the keyboard input might be sent to the debugger!
                    settingsTable.Rows[0].Cells[1].Click();
                    importSettings.Keyboard.Enter(TestContext.TestDataFilePath("cow.protein.PRG2012-subset.fasta"));

                    // TODO: add interface testing
                    // test qonverter settings
                    // test error conditions (bad values for max rank and max FDR score)
                    // test invalid decoy prefix
                    // test analysis parameters tree

                    var ok = importSettings.Get<Button>("okButton");
                    ok.Click();
                    windowStack.Pop();

                    while (!progressForm.IsClosed)
                        Thread.Sleep(1000);

                    windowStack.Pop();

                    if (settings.GUISettings.WarnAboutNoGeneMetadata)
                    {
                        // handle prompt for gene metadata embedding
                        var prompt = window.ModalWindow(SearchCriteria.ByAutomationId("EmbedGeneMetadataWarningForm"), InitializeOption.NoCache);
                        prompt.Get<Button>("embedButton").RaiseClickEvent();
                    }

                    statusText.WaitForReady();

                    window = app.GetWindow(SearchCriteria.ByAutomationId("IDPickerForm"), InitializeOption.NoCache);
                    var dockableForms = window.GetDockableForms();

//.........这里部分代码省略.........
开发者ID:lgatto,项目名称:proteowizard,代码行数:101,代码来源:ImportFileTests.cs

示例9: ImportMultipleFilesOnOpen

        public void ImportMultipleFilesOnOpen()
        {
            // get settings in a separate invocation because import starts immediately when a file is passed on the command-line
            var settings = TestContext.GetAndSetTestSettings();

            // this lambda allow reusing of the testing code; we can change only UI parameters to create a specific AppRunner
            Func<string, AppRunner> createTestCase = (mergedOutputFilepath) =>
            {
                return (app, windowStack) =>
                {
                    var window = app.GetWindow(SearchCriteria.ByAutomationId("IDPickerForm"), InitializeOption.NoCache);
                    var statusBar = window.Get<StatusStrip>();
                    var statusText = statusBar.Get<TextBox>();
                    windowStack.Push(window);

                    if (String.IsNullOrEmpty(mergedOutputFilepath))
                    {
                        // check:
                        // - trying to save to a read only location prompts for a new location
                        // - choosing an existing filepath asks user to confirm overwriting
                        // - that the automatically generated merged filepath is correct
                        Window saveDialog = null;
                        IDPicker.Util.TryRepeatedly(() => saveDialog = window.ModalWindows()[0]);
                        windowStack.Push(saveDialog);

                        // HACK: saveDialog.Get<TextBox>() won't work because of some unsupported control types in the Save Dialog (at least on Windows 7); I'm not sure if the 1001 id is stable
                        var saveTarget = new TextBox(saveDialog.AutomationElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "1001")), new NullActionListener());
                        Assert.AreEqual(TestContext.TestOutputPath("201208-378803.idpDB"), saveTarget.Text);

                        var saveButton = new Button(saveDialog.AutomationElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "1")), new NullActionListener());
                        saveButton.Click();
                    }

                    var progressForm = window.ModalWindow(SearchCriteria.ByAutomationId("ProgressForm"), InitializeOption.NoCache);
                    windowStack.Push(progressForm);

                    var importSettings = window.ModalWindow(SearchCriteria.ByAutomationId("UserDialog"));
                    windowStack.Push(importSettings);

                    var settingsTable = importSettings.GetFastTable("dataGridView");
                    Assert.IsNotNull(settingsTable);
                    Assert.AreEqual(4, settingsTable.Rows.Count);

                    Assert.AreEqual(7, settingsTable.Rows[0].Cells.Count);
                    UnitTestExtensions.AssertSequenceEquals(new Object[] { "Comet 2014.02", FilepathOrFilename(settingsTable.Rows[0].Cells[1].Value.ToString()), "XXX_", "2", 0.1m.ToString(CultureInfo.CurrentCulture), "False", "Comet optimized" }, settingsTable.Rows[0].Cells.Select(o => o.Value).ToArray());
                    UnitTestExtensions.AssertSequenceEquals(new Object[] { "MyriMatch 2.2.140", FilepathOrFilename(settingsTable.Rows[1].Cells[1].Value.ToString()), "XXX_", "2", 0.1m.ToString(CultureInfo.CurrentCulture), "False", "MyriMatch optimized" }, settingsTable.Rows[1].Cells.Select(o => o.Value).ToArray());
                    UnitTestExtensions.AssertSequenceEquals(new Object[] { "MS-GF+ Beta (v10072)", FilepathOrFilename(settingsTable.Rows[2].Cells[1].Value.ToString()), "XXX", "2", 0.1m.ToString(CultureInfo.CurrentCulture), "False", "MS-GF+" }, settingsTable.Rows[2].Cells.Select(o => o.Value).ToArray());
                    UnitTestExtensions.AssertSequenceEquals(new Object[] { "Mascot 2.2.06", "cow.protein.PRG2012-subset.fasta", "DECOY_", "2", 0.1m.ToString(CultureInfo.CurrentCulture), "False", "Mascot ionscore" }, settingsTable.Rows[3].Cells.Select(o => o.Value).ToArray());

                    // HACK: for some reason White's TableCell.Value property isn't sending keyboard input correctly;
                    // with this workaround, be careful while debugging around this code because the keyboard input might be sent to the debugger!
                    settingsTable.Rows[0].Cells[1].Click();
                    importSettings.Keyboard.Enter(TestContext.TestDataFilePath("cow.protein.PRG2012-subset.fasta"));

                    // TODO: add interface testing
                    // test qonverter settings
                    // test error conditions (bad values for max rank and max FDR score)
                    // test invalid decoy prefix
                    // test analysis parameters tree

                    var ok = importSettings.Get<Button>("okButton");
                    ok.RaiseClickEvent();
                    windowStack.Pop();

                    while (!progressForm.IsClosed)
                        Thread.Sleep(500);

                    windowStack.Pop();

                    bool willEmbedGeneMetadata = settings.GUISettings.WarnAboutNoGeneMetadata;

                    // handle prompt for gene metadata embedding if necessary
                    if (willEmbedGeneMetadata)
                    {
                        var prompt = window.ModalWindow(SearchCriteria.ByAutomationId("EmbedGeneMetadataWarningForm"), InitializeOption.NoCache);
                        windowStack.Push(prompt);

                        prompt.Get<CheckBox>("doNotShowCheckBox").Click();
                        prompt.Get<Button>("embedButton").RaiseClickEvent();

                        while (!prompt.IsClosed)
                            Thread.Sleep(500);

                        // refresh settings
                        settings = app.GetSettings(windowStack);
                        Assert.AreEqual(false, settings.GUISettings.WarnAboutNoGeneMetadata);

                        // reset to original state
                        settings.GUISettings.WarnAboutNoGeneMetadata = true;
                        app.SetSettings(windowStack, settings);
                    }

                    statusText.WaitForReady();

                    window = app.GetWindow(SearchCriteria.ByAutomationId("IDPickerForm"), InitializeOption.NoCache);
                    var dockableForms = window.GetDockableForms();

                    var proteinTableForm = dockableForms.Single(o => o.Id == "ProteinTableForm");
                    if (willEmbedGeneMetadata)
                        Assert.AreEqual("Protein View: 6 clusters, 8 protein groups, 13 proteins, 0% protein FDR, 8 gene groups, 13 genes", proteinTableForm.Name);
//.........这里部分代码省略.........
开发者ID:lgatto,项目名称:proteowizard,代码行数:101,代码来源:ImportFileTests.cs


注:本文中的Button.Click方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。