如何解析 ShellViewModel 中的设置对象 (Caliburn.Micro)
How to parse settings object in ShellViewModel (Caliburn.Micro)
我有一个字典对象定义如下
Dictionary<string, object> dictArguments = new Dictionary<string, object>();
dictArguments.Add("CommandLine", strCommandLineArguments);
然后我将 ShellViewModel 传递给它,如下所示。
DisplayRootViewFor<ShellViewModel>(dictArguments);
而我不知道 ShellViewModel 如何以及在哪里解析这个参数,因为就 Caliburn 而言,ShellViewModel 有一个带有 ieventAggregator 的 CTOR。有什么指点吗?
谢谢,
迪帕克
DisplayRootViewFor 的参数接受 Windows 设置作为字典。例如,
Dictionary<string, object> dictArguments = new Dictionary<string, object>();
dictArguments.Add("Height", 1000);
dictArguments.Add("Width", 1500);
dictArguments.Add("ShowInTaskbar", false);
dictArguments.Add("WindowStartupLocation", WindowStartupLocation.CenterScreen);
DisplayRootViewFor<ShellViewModel>(dictArguments);
这些设置会影响视图的高度、宽度、ShowInTaskbar 和 WindowStartupLocation 属性(Caliburn Micro 会这样做,您不需要手动进行)。
我认为这对存储 CommandLine 参数没有用。
我有一个字典对象定义如下
Dictionary<string, object> dictArguments = new Dictionary<string, object>();
dictArguments.Add("CommandLine", strCommandLineArguments);
然后我将 ShellViewModel 传递给它,如下所示。
DisplayRootViewFor<ShellViewModel>(dictArguments);
而我不知道 ShellViewModel 如何以及在哪里解析这个参数,因为就 Caliburn 而言,ShellViewModel 有一个带有 ieventAggregator 的 CTOR。有什么指点吗?
谢谢,
迪帕克
DisplayRootViewFor 的参数接受 Windows 设置作为字典。例如,
Dictionary<string, object> dictArguments = new Dictionary<string, object>();
dictArguments.Add("Height", 1000);
dictArguments.Add("Width", 1500);
dictArguments.Add("ShowInTaskbar", false);
dictArguments.Add("WindowStartupLocation", WindowStartupLocation.CenterScreen);
DisplayRootViewFor<ShellViewModel>(dictArguments);
这些设置会影响视图的高度、宽度、ShowInTaskbar 和 WindowStartupLocation 属性(Caliburn Micro 会这样做,您不需要手动进行)。
我认为这对存储 CommandLine 参数没有用。