caliburn.micro - 如何解析 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);
这些设置会影响 View 的 Height、Width、ShowInTaskbar 和 WindowStartupLocation 属性(Caliburn Micro 会这样做,您不需要手动进行)。
我认为这对存储 CommandLine 参数没有用。
推荐阅读
- sql-server - SQL中序列中按类别划分的最大值
- python - PostgreSQL 数据时间类型的最佳数据类型
- r - 在 R 中使用平衡设计分析重复测量
- docker - 无法从容器外部访问 Angular
- docker - 使用 Docker 映射 Compute Engine 中的端口
- c - C - 指向结构的指针 - 分段错误
- handlebars.js - handlebars.js - 遍历 json 数组以确定是否应选中复选框
- c# - Web API 2 中的依赖注入服务授权
- c# - MVC ActionResult 模型似乎正在使用缓存视图
- typescript - 将字符串转换为 NSData 并将 NSData 转换回字符串