旧格式:
private async Task<Tuple<SomeArray[], AnotherArray[], decimal>>
GetInvoiceDetailAsync(InvoiceHead invoiceHead) { ... }
Run Code Online (Sandbox Code Playgroud)
你怎么能用新的元组格式在C#7中做到这一点?
我使用ShowDialog()与WindowStyle = WindowStyle.SingleBorderWindow;我的WPF(MVVM)应用程序打开一个模态窗口,但它让我浏览到使用Windows任务栏的父窗口(Windows 7).
我在这里找到了答案:WPF和ShowDialog()但它不适合我,因为我不需要"永远在线"工具窗口.
提前致谢
我想在数据注释中使用Fluent API的本地化验证:
[Required(ErrorMessageResourceName = "Domain_Address_AddressTypeRequired", ErrorMessageResourceType = typeof(Resources))]
public virtual AddressType AddressType { get; set; }
Run Code Online (Sandbox Code Playgroud)
不幸的是.IsRequied()没有重载版本来给出如下错误信息:
.IsRequied("That was your last mistake! :D");
Run Code Online (Sandbox Code Playgroud)
那可能吗?怎么样?
谢谢
PumpeR1
entity-framework fluent-interface code-first data-annotations
当我PressCommand.RaiseCanExecuteChanged();在TimerOnElapsed方法中调用时,没有任何反应.
可能是什么问题呢?(GalaSoft.MvvmLight.WPF4 v4.0.30319和GalaSoft.MvvmLight.Extras.WPF4 v4.0.30319)
这是我的测试代码:
using System.Timers;
using System.Windows;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
namespace CommandTest {
public class MainWindowVM : ViewModelBase {
public MainWindowVM() {
PressCommand = new RelayCommand(
() => MessageBox.Show("Pressed"),
() => _canExecute);
PressCommand.CanExecuteChanged += (sender, args) => System.Diagnostics.Debug.WriteLine(System.DateTime.Now.ToLongTimeString() + " CanExecuteChanged");
_timer = new Timer(1000);
_timer.Elapsed += TimerOnElapsed;
_timer.Enabled = true;
}
public RelayCommand PressCommand { get; private set; }
#region Private
private void TimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs) {
_canExecute = !_canExecute;
PressCommand.RaiseCanExecuteChanged(); …Run Code Online (Sandbox Code Playgroud) 我的C#代码中的uri有些麻烦
这是有效的:
var uri = new Uri("d:/Programozas dotNet/Ugyfel/Ugyfel.ClientWpf/Skins/MainSkin.xaml");
Run Code Online (Sandbox Code Playgroud)
但不幸的是没有这些:
var uri = new Uri("/Skins/MainSkin.xaml", UriKind.Relative);
var uri = new Uri("pack://application:,,,/Skins/MainSkin.xaml");
var uri = new Uri("Ugyfel.ClientWpf;/Skins/MainSkin.xaml", UriKind.Relative);
Run Code Online (Sandbox Code Playgroud)
IOException:找不到资源'skins/mainskin.xaml'.
我如何使用绝对的相对 uri insted ?
c# ×2
c#-7.0 ×1
code-first ×1
mvvm-light ×1
relaycommand ×1
showdialog ×1
tuples ×1
uri ×1
wpf ×1