小编der*_*can的帖子

在Windows窗体中嵌入Selenium ChromeDriver

我想将Selenium嵌入ChromeDriverWindows窗体面板中.我已经成功地按照这个例子在Windows窗体中嵌入了记事本.我认为我遇到麻烦的问题是MainWindowHandle从中获取ChromeDriver.这是我到目前为止所得到的:(完整代码的pastebin链接:https://pastebin.com/RNv2vbJ1)

//----------------------TEST---------------------
ChromeDriverService service = ChromeDriverService.CreateDefaultService();
service.HideCommandPromptWindow = true;

ChromeDriver driver = new ChromeDriver(service);
Console.WriteLine(driver.CurrentWindowHandle);

Process chromeDriverProcess = Process.GetProcessById(service.ProcessId);
//EmbeddedWindowHandle = driver.CurrentWindowHandle;
//----------------------TEST---------------------

ProcessStartInfo processInfo = new ProcessStartInfo("notepad.exe");
Process p = Process.Start(processInfo);
p.WaitForInputIdle();
EmbeddedWindowHandle = p.MainWindowHandle;
SetParent(EmbeddedWindowHandle, panel1.Handle);
MoveWindow(EmbeddedWindowHandle, 0, 0, panel1.Width, panel1.Height, true);
SetWindowLong(EmbeddedWindowHandle, GWL_STYLE, WS_VISIBLE);
Run Code Online (Sandbox Code Playgroud)

embed selenium selenium-chromedriver

7
推荐指数
1
解决办法
646
查看次数

在Google Scripts中定义数组

我是一个javascript新手,并试图编写一个电子表格的脚本,将从中提取各种东西.马上,我无法定义spreasheet中的一系列名称.错误显示"丢失;在声明之前(第10行)"

function readRows() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var rows = sheet.getDataRange();
  var numRows = rows.getNumRows();
  //var values = rows.getValues();

  var Names = sheet.getRange("A2:A7");
  var Name = new Array(6);
  var Name_cell = Names.getCell(1, 1);
  var Name[0] = Name_cell.getValue();  //  <-- Here's the issue
  var Name_cell = Names.getCell(2, 1);
  var Name[1] = Name_cell.getValue();
  var Name_cell = Names.getCell(3, 1);
  var Name[2] = Name_cell.getValue();
  var Name_cell = Names.getCell(4, 1);
  var Name[3] = Name_cell.getValue();
  var Name_cell = Names.getCell(5, 1);
  var Name[4] = Name_cell.getValue();
  var …
Run Code Online (Sandbox Code Playgroud)

javascript arrays google-apps-script

6
推荐指数
1
解决办法
8万
查看次数

http请求中的Dart字符编码

刚刚学习Flutter,在尝试调用API时遇到了这个问题:

\n
final response = await http.get(\n  Uri.https(apiBaseUrl, apiBaseEndpoint + "/tasks"),\n  headers: {\n    "Authorization": "Bearer " + apiKey,\n  },\n);\n\nprint(response.body);\n
Run Code Online (Sandbox Code Playgroud)\n

我的部分回复包含\xc3\x84\xc2\xb0ftar并且应该是\xc4\xb0ftar。我想这是一些编码问题?curl给我返回带有正确字符的响应。

\n

基本上:这是文本编码问题吗?如果是这样,我该如何解决我的请求?

\n

character-encoding dart flutter

5
推荐指数
1
解决办法
2733
查看次数

立即更新 toolStripStatusLabel

我有一个WinForms程序,有一个button,一个statusStrip,和toolStripStatusLabelstatusStrip。如果我单击按钮并运行:

private void button1_Click(object sender, EventArgs e)
{
    toolStripStatusLabel1.Text = "Test";

    System.Threading.Thread.Sleep(5000);
}
Run Code Online (Sandbox Code Playgroud)

然后,toolStripStatusLabel直到线程完成睡眠后, 的文本才会更新。如何让它立即更新,然后让线程休眠?

c# multithreading statusstrip toolstripstatuslabel

4
推荐指数
1
解决办法
7010
查看次数

自动转义在文本框中输入的特殊字符

我正在使用Win Forms进行编程,无论用户在文本框中输入的内容都将WYSIWYG转换为字符串,然后通过Sqlcommand以粗略形式发送,Sqlcommand("INSERT INTO dbo.Call VALUES('" + textBox.Text + "');", Connection);但是如果textBox包含双引号,它将与格式固定(这可能会出现单引号,反斜杠等)。是否有一种简单的方法可以将Win Forms或C#代码设置为自动放在\这些字符之前?

c# textbox winforms

3
推荐指数
1
解决办法
656
查看次数

循环嵌入资源并复制到本地路径

我有一个简单的WinForms应用程序,但它有一些嵌入式资源(在"资源"下的子文件夹中),我想将其复制到计算机上的文件夹中.目前,我有后者工作(使用显式方法命名嵌入式资源以及应该去哪里):

string path = @"C:\Users\derek.antrican\";

using (Stream input = Assembly.GetExecutingAssembly().GetManifestResourceStream("WINFORMSAPP.Resources.SUBFOLDER.FILE.txt"))
using (Stream output = File.Create(path + "FILE.txt"))
{
    input.CopyTo(output);
}
Run Code Online (Sandbox Code Playgroud)

但我仍在试图找出如何使前者工作:循环遍历"WINFORMSAPP.Resources.SUBFOLDER"文件夹中的所有资源并移动它们.我已经完成了很多谷歌搜索,但我仍然不确定如何在这个子文件夹中获取每个嵌入式资源的列表.

任何帮助将不胜感激!

c# resources embedded-resource winforms

3
推荐指数
1
解决办法
737
查看次数

无法使用Skype for Business 2016安装Lync 2013 SDK

我正在尝试制作一个简单的WinForms应用程序来改变Skype for Business状态(我正在使用Skype for Business 2016).根据下面的链接,我应该能够安装Lync 2013 SDK(我在这里找到:https://www.microsoft.com/en-in/download/details.aspx?id = 36824).但是,当我试图安装它时,它说Microsoft Lync 2013 not found. Go here to download and install: http://go.microsoft.com/fwlink/?LinkID=248583.有什么建议?我是否还必须安装Lync才能与Skype for Business 2016进行交互?

Lync 2013 Client SDK是否与Skype for Business兼容?

Skype for Business 2016没有客户端SDK

c# sdk client skype-for-business skypedeveloper

3
推荐指数
2
解决办法
3248
查看次数

如何从用户控件里面关闭一个窗口?

我有一个 WPF 程序,有时我会打开一个窗口:

    public object testCommand()
    {
        Window window = new Window
        {
            Title = "My User Control Dialog",
            Content = new OKMessageBox("Error Message"),
            SizeToContent = SizeToContent.WidthAndHeight,
            ResizeMode = ResizeMode.NoResize
        };
        window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
        window.ShowDialog();

        return null;
    }
Run Code Online (Sandbox Code Playgroud)

用户控制 XAML:

<UserControl x:Class="SolidX.Base.MessageBoxes.OKMessageBox"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:SolidX.Base.MessageBoxes"
             xmlns:viewProperties="clr-namespace:AppResources.Properties;assembly=AppResources"
             mc:Ignorable="d" 
             d:DesignHeight="150" d:DesignWidth="400">
    <Grid>
        <TextBlock x:Name="textMessage" Margin="10"/>
        <Grid Height="Auto" VerticalAlignment="Bottom">
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <CheckBox Content="Don't show this again" HorizontalAlignment="Right" Margin="5,5,10,5"/>
            <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button x:Name="btnOk" Content="{x:Static viewProperties:Resources.Common_OK}" Height="25" VerticalAlignment="Center" Width="90" …
Run Code Online (Sandbox Code Playgroud)

c# wpf user-controls

2
推荐指数
1
解决办法
5116
查看次数

将comboBox设置为自定义显示格式

我有一个WinForms comboBox,其中包含“区域”列表(我已设置的自定义类)。每个Region都有属性NameAbbreviation等等。我知道我可以将comboBox设置为comboBox.DisplayMember = "Name";,但是我希望显示格式为"(" + Abbreviation + ") " + Name(例如(OR) Oregon)。

我知道我可以为此创建一个单独的属性(例如DisplayName),然后设置,comboBox.DisplayMember = "DisplayName";但是还有另一种方法吗?诸如此类的comboBox.DisplayMember = "(" + Abbreviation + ") " + Name;东西?

c# combobox properties winforms

2
推荐指数
2
解决办法
3271
查看次数

Google 脚本:给值加 1

当某个事件发生时,我试图将 Google 电子表格中单元格的值加 1。但不是...将 -6 更改为 -5,而是将其更改为 -61。我的代码有什么问题吗?

var Spending = sheet.getRange("B2");
var SPEND = [Spending.getCell(1, 1).getValue()];

**EVENT TRIGGERED**

SPEND = SPEND+1;
    Spending.setValue(SPEND);
Run Code Online (Sandbox Code Playgroud)

google-sheets google-apps-script

1
推荐指数
1
解决办法
1万
查看次数

使用 List.Move 将项目移动到列表底部

我有一个项目列表和一个“选定”列表(完整列表的子集)。我想实现一个将子列表项移动到完整列表底部的函数。

例如,如果我从列表 0,1,2,3,4,5,6,7,8,9 中选择了元素 2,4, & 6,我希望这个函数的最终结果是 0,1, 3,5,7,8,9,2,4,6

目前,我正在尝试使用这样的东西,但我不确定如何定义moveTo

public object MoveLoopToBottom()
{
    if (selectedLoops.Count < 1)
        return null;

    foreach (ProfilerLoop selected in selectedLoops)
    {
        int moveFrom = ClonedLoops.IndexOf(selected);
        int moveTo = ;

        ClonedLoops.Move(moveFrom, moveTo);
    }

    return null;
}
Run Code Online (Sandbox Code Playgroud)

我咨询了它的List.Move工作原理:通用列表 - 在列表中移动一个项目,但它似乎不能“移动到列表末尾”。List.Move可以(最多)移动到“倒数第二个”位置(试图移动到列表的末尾会抛出“OutOfRange Exception”)。

而不是List.Move,我尝试执行List.Removethen List.Add(或List.Addthen List.RemoveAt),但是调用List.Remove给我的 foreach 循环迭代带来了问题(哪里List.Move没有)。

有什么建议?

c# list

1
推荐指数
1
解决办法
8356
查看次数

使用 Google Maps API 估算流量

我正在尝试调用 Google Maps API 来获取两点之间的旅行时间(包括交通)。这是我到目前为止所得到的:

function test(){
  //Info: https://developers.google.com/maps/documentation/directions/intro

  var baseUrl = "https://maps.googleapis.com/maps/api/directions/json?";
  var origin = "Redmond+WA";
  var destination = "Salem+OR";
  var departureTime = "now";
  var trafficModel = "pessimistic";
  var url = baseUrl + "origin=" + origin + "&destination=" + destination + "&departure_time=" + departureTime + "&traffic_model=" + trafficModel;
  var response = UrlFetchApp.fetch(url);
  Logger.log("Google Maps API: " + JSON.parse(response).routes[0].legs[0].duration.text);
  Logger.log("Full response from API: \n" + response);
}
Run Code Online (Sandbox Code Playgroud)

不幸的是,无论我何时运行代码,我总是得到 的结果3 hours 43 mins(尽管我已经定义了departure_timetraffic_model。有什么建议吗? …

google-maps google-apps-script

1
推荐指数
1
解决办法
3426
查看次数