我使用QnAMaker、Azure Bot Service和JavaScript 中的Bot Framework Web Chat客户端创建了一个 Azure QnA Web Chat Bot 。
这是我如何使用 HTML + JS 初始化机器人的示例:
<script src="https://cdn.botframework.com/botframework-webchat/4.6.0/webchat-es5.js"></script>
<div id="projekt-webchat" role="main"></div>
Run Code Online (Sandbox Code Playgroud)
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
secret: 'SECRETHERE'
}),
userID: 'YOUR_USER_ID',
username: 'Web Chat User',
locale: 'en-US',
botAvatarInitials: 'WC',
userAvatarInitials: 'WW'
},
document.getElementById('projekt-webchat')
);
Run Code Online (Sandbox Code Playgroud)
我的机器人连接到来自 QnA Maker 的知识库,其中有一个QnA 对,如下所示:
问题:gimmenumber
答案:+49 5251 123456
某些浏览器会将其呈现为可点击的超链接,然后我选择拨打该号码。但是,其他浏览器没有将电话号码视为超链接,所以我无法点击它
我目前通过Xamarin书自己工作.在那里你可以看到这个代码:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Xamarin.Forms;
namespace BookCode
{
public class Greetings : ContentPage
{
public Greetings()
{
Label label;
label = new Label
{
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center
};
Content = label;
SizeChanged += OnPageSizeChanged;
void OnPageSizeChanged(object sender, EventArgs args)
{
label.Text = String.Format("{0} \u00D7 {1}", Width, Height);
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在代码的解释中,您可以阅读:
"相反,事件处理程序访问Label元素(方便地保存为字段)以显示页面的Width和Height属性.Btring.Format调用中的Unicode字符是一个时间(×)符号."
我目前对领域和属性的了解基本上是这样的:
public class ClassName
{
private string field;
public string property {get …Run Code Online (Sandbox Code Playgroud) With this HTML the function myFunc() can be executed. https://myurl.de/myjs.js has the function myFunc in it.
<head>
<script type="text/javascript" src="https://myurl.de/myjs.js"></script>
<body>
<script type="text/javascript">
myFunc();
</script>
</body>
</head>
Run Code Online (Sandbox Code Playgroud)
But with the second HTML I get an Error: Uncaught ReferenceError: myFunc is not defined.
https://myurl.de/settingsFile.js is a file that includes this url in a var: https://myurl.de/myjs.js so basically SettingsFile.UrlToMyJS is this https://myurl.de/myjs.js
<head>
<script src="https://myurl.de/settingsFile.js"></script>
<script type="text/javascript" id="myid"></script>
</head>
<body>
<script type="text/javascript">
document.getElementById('myid').src = SettingsFile.UrlToMyJS;
myFunc();
</script>
</body>
Run Code Online (Sandbox Code Playgroud)
When I …
我目前正在阅读这本书。
在本书的开头我就遇到了一个问题。我有PrimaryToolbarItems 和SecondaryToolbarItems。但它们都没有显示。我究竟做错了什么?
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BookCode"
x:Class="BookCode.MainPage"
Title="Visuals">
<StackLayout Padding="10,0">
<Label Text="Hello, Xamarin.Forms!"
FontSize="Large"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"/>
<Button Text="Click Me!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"/>
<Switch VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"/>
</StackLayout>
<ContentPage.ToolbarItems>
<ToolbarItem Text="edit" Order="Primary">
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource"
iOS="edit.png"
Android="ic_action_edit.png"
WinPhone="Images/edit.png"/>
</ToolbarItem.Icon>
</ToolbarItem>
<ToolbarItem Text="search" Order="Primary">
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource"
iOS="search.png"
Android="ic_action_search.png"
WinPhone="Images/feature.search.png"/>
</ToolbarItem.Icon>
</ToolbarItem>
<ToolbarItem Text="refresh" Order="Primary">
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource"
iOS="reload.png"
Android="ic_action_refresh.png"
WinPhone="Images/refresh.png"/>
</ToolbarItem.Icon>
</ToolbarItem>
<ToolbarItem Text="explore" Order="Secondary"/>
<ToolbarItem Text="discover" Order="Secondary"/>
<ToolbarItem Text="evolve" Order="Secondary" />
</ContentPage.ToolbarItems> …Run Code Online (Sandbox Code Playgroud) 是否可以在搜索中包含评论?或者甚至可以排除代码并仅搜索评论?
比如说
int a = 1;
//int b = 2;
Run Code Online (Sandbox Code Playgroud)
如果我搜索,int我只会找到int未评论的内容.我想找到评论的那个.
编辑
我注意到的另一件事.当我在xaml中搜索内容时,我也找不到它们.例:
<TextBlock x:Name="veryImportant"/>
Run Code Online (Sandbox Code Playgroud)
通过搜索例如TextBlock或Name或找不到 veryImportant
有可能以某种方式找到它吗?
在我的本地文件夹中,我有一个文件sample.txt。
右键单击 -> 属性 -> 详细信息
我可以看到它的修改日期。例如 2018 年 10 月 30 日 09:00。
我可以通过 UWP 更改此属性吗?以2018年10月20日 09:00 为例。
我有一个带有PDFReader的UWP应用。PDFReader有一个搜索窗口。在搜索文本框中输入单词后,便可以开始搜索。当前,这样一来,如果您开始搜索,则必须等待3秒钟,直到看到一条消息,该单词的出现频率很高。
现在,我想用“正在搜索...”消息填充这3秒钟。
我有一个解决方案是:
private async void DoSearch(...)
{
//...
Task<string> searchingText = setSearchMsg();
infoBox.Text = await searchingText;
//...
}
private async Task<string> setSearchMsg()
{
infoBox.Text = "Searching...";
await Task.Delay(1);
return "";
}
Run Code Online (Sandbox Code Playgroud)
但这看起来并不正确。我注意到的一件事是,当我正在寻找一个单词并且可以在80页中找到3000次该单词时,infoBox跳过“正在搜索...”消息,并再次将信息框填充为空。为了解决这个问题,我可以将更Task.Delay改为like Task.Delay(100),这并不是我认为正确的解决方案。
Is it possible to have a variable in StringContent?
Currently my Code looks like this (It's about \"text\": \"this is my message\"):
myRequestMessage.Content = new StringContent("{\"type\": \"message\", \"text\": \"this is my message\", \"from\": {\"id\": \"myID\", \"name\": \"myName\"}}", System.Text.Encoding.UTF8, "application/json");
Run Code Online (Sandbox Code Playgroud)
But I want to have it like this (\"text\": "+myOwnString+"):
myOwnString = "this is my text";
myRequestMessage.Content = new StringContent("{\"type\": \"message\", \"text\": "+myOwnString+", \"from\": {\"id\": \"myID\", \"name\": \"myName\"}}", System.Text.Encoding.UTF8, "application/json");
Run Code Online (Sandbox Code Playgroud)
My problem is when doing it like …
c# ×5
uwp ×3
html ×2
xamarin ×2
async-await ×1
asynchronous ×1
azure ×1
field ×1
file ×1
javascript ×1
json ×1
properties ×1
string ×1
task ×1
tel ×1
toolbar ×1
toolbaritems ×1
xaml ×1