这是我拥有的C#模板代码:
public class PopupFrame : Frame
{
public PopupFrame()
{
this.SetDynamicResource(BackgroundColorProperty, "PopUpBackgroundColor");
this.SetDynamicResource(CornerRadiusProperty, "PopupCornerRadius");
HasShadow = true;
HorizontalOptions = LayoutOptions.FillAndExpand;
Padding = 0;
VerticalOptions = LayoutOptions.Center;
}
}
Run Code Online (Sandbox Code Playgroud)
我是这样使用它的:
<t:PopupFrame>
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<t:PopupHeader Text="Copy Deck" />
<t:PopupEntryHeader Text="New Deck Name" />
More XAML here
</StackLayout>
</t:PopupFrame>
Run Code Online (Sandbox Code Playgroud)
有什么方法可以编码,PopupFrame以便它StackLayout是它的一部分并且它需要内容。
这是我想编码的内容:
<t:PopupFrame>
<t:PopupHeader Text="Copy Deck" />
<t:PopupEntryHeader Text="New Deck Name" />
More XAML here
</t:PopupFrame>
Run Code Online (Sandbox Code Playgroud) 假设我正在创建一个名为ConsoleApp2的应用程序。
由于我使用了一些第三方库,我的默认 app.config 文件正在生成类似的代码
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)
那是因为我的解决方案引用了一个库的不同版本,所以它需要告诉大家:“嘿,如果你要找这个库的任何旧版本,就用新版本”。没关系。
问题是我想定义一个单独的配置文件“test.exe.config”,在那里我有一些设置并摆脱自动生成的设置。
为了告诉我的应用程序有关新配置文件的信息,我使用了如下代码
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", "test.exe.config");
Run Code Online (Sandbox Code Playgroud)
这(几乎)完美地工作。我在那里写了“几乎”,因为虽然该<appSettings>部分被正确读取,但该<runtime>部分并未在我的自定义配置文件中查看,但应用程序在默认配置文件中查找它,这是一个问题,因为我想以后可以删除那个。
那么,我如何告诉我的应用程序也<runtime>从我的自定义配置文件中读取信息?
重现我的问题的简单示例如下:
创建一个名为ClassLibrary2 ( .Net Framework v4.6 )的库,包含一个类,如下所示
using Newtonsoft.Json.Linq;
using System;
namespace ClassLibrary2
{
public class Class1
{
public Class1()
{
var json = new JObject();
json.Add("Succeed?", true);
Reash = json.ToString();
}
public String …Run Code Online (Sandbox Code Playgroud) 该代码似乎适用于Xamarin.Forms中的UWP,但是当我在iOS上尝试此操作时,出现以下错误
捕获异常未找到方法:Microsoft.AspNetCore.Http.Connections.NegotiationResponse Microsoft.AspNetCore.Http.Connections.NegotiateProtocol.ParseResponse
iOS中是否需要更新某些内容才能实现此功能?
我正在使用Microsoft.AspNetcore.SignalrClient v 5.0.4。
这在以前的版本中有效,有什么想法吗?
当我尝试在 iPhone 模拟器上运行 flutter 应用程序时,出现以下错误。
错误(Xcode):../../../../.pub-cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/widgets/selection/gesture_ detector_builder.dart:186:20:错误:参数类型“void Function(TapDownDetails)”无法分配给参数类型“void Function(TapDragDownDetails)?”。
无法为模拟器构建应用程序。在 iPhone 13 Pro Max 上启动应用程序时出错。```
这是我的依赖项
cupertino_icons: ^1.0.2
flutter_redux: ^0.10.0
dio: ^4.0.3
redux_thunk: ^0.4.0
url_launcher: ^6.1.5
modal_bottom_sheet: ^2.0.0
dropdown_search: ^5.0.5
flutter_html: ^2.1.5
linkable: ^3.0.1
lottie: ^2.2.0
flutter_rating_bar: ^4.0.0
shared_preferences: ^2.0.7
device_info_plus: ^8.0.0
percent_indicator: ^4.2.2
animated_widgets: ^1.1.0
skeletons: ^0.0.3
google_mobile_ads:
firebase_core:
firebase_analytics: ^10.1.0
webview_flutter_plus:
gsheets: ^0.4.2
get_it: ^7.2.0
woocommerce_api: ^0.1.0
skeleton_loader: ^2.0.0+4
Run Code Online (Sandbox Code Playgroud)
我已经尝试过以下方法。
我正在使用颤振稳定通道。
flutter cleanflutter upgrade我正在关注 微软的一个小教程。
这基本上将您的文本输入保存到设备的内部存储器中。
String _filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Notes.txt");
Run Code Online (Sandbox Code Playgroud)
结果是:/data/user/0/com.companyname.notes/files/.local/share/Notes.txt对我来说。
现在,虽然一切正常,但我希望在文件夹中看到这个 Notes.txt 文件。
我进行了广泛的搜索,但似乎找不到在我的设备上找到此文件的方法。
我可以转到Android/data/com.companyname.notes/files但随后我只看到一个._override_文件夹,其中包含应用程序项目文件,但没有Notes.txt
有任何想法吗?
谢谢
在尝试Dart的Sound Null Safety 时,我遇到了一个问题:
创建一个新的Flutter项目我发现以下(并且非常熟悉)片段代码
int _counter = 0;
void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear …Run Code Online (Sandbox Code Playgroud) 我正在使用flutter_localizations本地化我的应用程序。
自从更新到Flutter 3.7以来,我收到此错误:
ICU 语法错误:应为“标识符”,但找到了“}”。
这显然 =|(){}[]
This =|\(){}[] obviously是我的.arb文件中的文本。
我知道花括号“{}”有特殊含义,应该转义,但我找不到正确转义它们的方法,有人设法这样做吗?
重现该问题的一种简单方法是按照此处添加本地化支持的步骤操作,然后编写包含字符“”的任何内容,而不是hello world{字符串。
PS: Github 上有一个相关的问题尚未解决。请务必去那里检查更新!
我在Dart 中使用Sound Null Safety,我有以下代码
int? _counter;
void _incrementCounter() {
setState(() {
if (_counter!=null)
_counter++;
});
}
Run Code Online (Sandbox Code Playgroud)
现在,由于 _counter 不是局部变量,因此无法提升它(请参阅此其他线程以了解原因),因此我必须通过添加bang 运算符( )来告诉Dart我确信_counter它不为空。因此我写了!
_counter!++;
Run Code Online (Sandbox Code Playgroud)
但这不起作用:我收到错误消息
非法赋值给不可赋值的表达式。
那么,有没有办法解决这个问题,而无需显式编写
_counter = _counter! + 1;
Run Code Online (Sandbox Code Playgroud) 这真让我抓狂。几个小时以来,我一直在寻找问题的根源,但我开始怀疑这不是我的逻辑问题......也许我错了。
我有一个简单的Entry。它的文本属性绑定到与类型的属性双的视图模型。同时,我订阅了Unfocused 事件,其EventHandler只是将entry.Text属性设置为"1.0"(实际上我可以重现 x.y0 的问题,即最终数字为 0 的任何小数)。如果现在我在条目中写入任何内容(“1”或“1”或“1.0”除外!!!)并离开条目(通过点击外部或点击完成)以便Unfocused触发,应用程序将变得无响应。
注意:我知道entry.Text = 1.0在事件处理程序中设置听起来有点奇怪。事实是,我通过尝试entry.Text按如下方式格式化值时遇到了这个问题。
if (double.TryParse(entry.Text, out double result))
{
entry.Text = String.Format("{0:F2}", result);
}
Run Code Online (Sandbox Code Playgroud)
有String.Format尝试将小数四舍五入到两位小数。如果我给出6.999的预期值应该是7.00,但应用程序反而变得无响应。
<StackLayout>
<Entry Text="{Binding Weight}"
Unfocused="entry_Unfocused"/>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)