我在Prism Unity,WPF和Mvvm的应用程序中创建了一个自定义确认窗口.我需要有关需要发送回viewmodel的通知的帮助.我在详细记录视图中有这个,我们称之为MyDetailView.
<!-- Custom Confirmation Window -->
<ie:Interaction.Triggers>
<interactionRequest:InteractionRequestTrigger
SourceObject="{Binding ConfirmationRequest, Mode=TwoWay}">
<mycontrols:PopupWindowAction1 IsModal="True"/>
</interactionRequest:InteractionRequestTrigger>
</ie:Interaction.Triggers>
Run Code Online (Sandbox Code Playgroud)
如上所示,我进行了交互Mode = TwoWay,以便确认弹出窗口可以发回OK或取消按钮的按钮点击结果.确认窗口应该出现,但我不知道如何将按钮点击结果发送回我的viewmodel,比如MyDetailViewModel.这是主要问题.
编辑:这是引发InteractionRequest的MyDetailViewMmodel方法.
private void RaiseConfirmation()
{ConfirmationRequest
.Raise(new Confirmation()
{
Title = "Confirmation Popup",
Content = "Save Changes?"
}, c =>{if (c.Confirmed)
{ UoW.AdrTypeRos.Submit();}
Run Code Online (Sandbox Code Playgroud)
这是PopupWindowAction1类.问题的部分答案可能是如何实现Notification和FinishedInteraction方法.
class PopupWindowAction1 : PopupWindowAction, IInteractionRequestAware
{
protected override Window GetWindow(INotification notification)
{ // custom metrowindow using mahapps
MetroWindow wrapperWindow = new ConfirmWindow1();
wrapperWindow.DataContext = notification;
wrapperWindow.Title = notification.Title;
this.PrepareContentForWindow(notification, wrapperWindow);
return wrapperWindow;
}
public INotification Notification
{
get …Run Code Online (Sandbox Code Playgroud) 我试图string.Join使用以下参数调用(第一个参数是分隔符):
string.Join(";", null, "string", 0); //returns empty string ???.
string.Join(";", null, null, 0); //returns empty string ???.
string.Join(";", null, null, null); //returns ";;;" - Good
string.Join(";", 0, 0, 0); //returns "0;0;0" - Good
string.Join(";", 0, null, 0); // "0;;0" - Good
string.Join(";", null, 0, null); // empty
Run Code Online (Sandbox Code Playgroud)
任何人都可以解释为什么它这样做?如何依赖string.Join在这种情况下?
时态表是 中及以上版本的一个新功能SQL Server 2016,它就像一种SQL Server自动保存表中数据历史记录的有趣方法,但是引入了一些新的 T-SQL 语法SQL Server 2016来支持时态表。我对其中一些人产生了误解。
从官方文档来看,其描述BETWEEN <start_date_time> AND <end_date_time>如下:
与上面的 FOR SYSTEM_TIME FROM TO 描述相同,只是返回的行表包含在端点定义的上边界上变为活动状态的行。
其描述CONTAINED IN (<start_date_time>, <end_date_time>)如下:-
返回一个表,其中包含在 CONTAINED IN 参数的两个日期时间值定义的指定时间范围内打开和关闭的所有行版本的值。包括恰好在下边界处变为活动状态或恰好在上边界处停止活动的行。
CONTAINED IN (@start,@end)所以我明白,和BETWEEN子句之间唯一的区别是CONTAINED IN (@start, @end)包括@start边界,而BETWEEN子句则不包括。我对吗?
Imports System.Reflection
Public Class Test
Private Field As String
End Class
Module Module1
Sub Main()
Dim field = GetType(Test).GetField("Field", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance)
Dim test = New Test
Dim GetValue = New Func(Of Test, String)(Function(t As Test) field.GetValue(test))
'This line indicates a compile error: 'Expression does not produce a value':
Dim SetValue = New Action(Of Test, String)(Function(t As Test, value As String) field.SetValue(test, value))
End Sub
End Module
Module Module2
Dim field = GetType(Test).GetField("Field", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance) 'Is Shared (Module)
Sub …Run Code Online (Sandbox Code Playgroud) 我希望asp应用程序创建一个只能访问应用程序运行的帐户的文件夹(即asp帐号?)
我实际上想要使用这个,但我不知道如何动态使用"Computer\CurrentAccount".
我想获得当前的工作帐户.
谢谢.
是否SET IDENTITY_INSERT [Table] ON仍然超出SQL脚本的范围?我想知道是否需要将其显式设置为"OFF",或者SQL Server是否知道它应该只对当前脚本使用该设置.
谢谢!
有没有办法获取对象上下文的所有SQL更改脚本?
注意:我不是在谈论ObjectQuery.ToTraceString();
我想设置WPF WebBrowser控件的内联内容:
<WebBrowser>
<html>
<body><b>Inline content.</b></body>
</html>
</WebBrowser>
Run Code Online (Sandbox Code Playgroud)
或者:
Dim wb As New WebBrowser
wb.Content = "<html><body><b>Programmatic content</b></body></html>"
Run Code Online (Sandbox Code Playgroud) 以下是文字示例:
String id = "A:abc,X:def,F:xyz,A:jkl";
Run Code Online (Sandbox Code Playgroud)
以下是正则表达式:
Pattern p = Pattern.compile("(.*,)?[AC]:[^:]+$");
if(p.matcher(id).matches()) {
System.out.println("Hello world!")
}
Run Code Online (Sandbox Code Playgroud)
执行上面代码时应打印Hello world!.
是否可以修改此正则表达式以获得更高的性能?
使用vb.net中的"With"关键字而不是反复使用实例名称会产生什么后果?
vb.net ×3
.net ×2
c# ×2
performance ×2
sql-scripts ×2
wpf ×2
.net-3.5 ×1
action ×1
filesystems ×1
html ×1
interaction ×1
java ×1
lambda ×1
mvvm ×1
prism ×1
regex ×1
sql-server ×1
string ×1