-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
新增关于事件转命令的类已经类库文件 #9
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢 政道大佬的贡献,但是存在一点小问题,期望修改
@@ -21,6 +21,18 @@ | |||
<None Remove="ViewModel\MasterDetail\**" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup> | |||
<Reference Include="PresentationCore"> | |||
<HintPath>..\FrameWorkLib\PresentationCore.dll</HintPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
从本来的设计上,在 Framework 是不包含 WPF 和 UWP 的实现的
|
||
namespace lindexi.MVVM.Framework.ViewModel | ||
{ | ||
public class EventInfomation<TEventArgs> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的代码没有对齐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该限制 TEventArgs 是参数也就是加上 where TEventArgs 是具体的什么
{ | ||
public class EventInfomation<TEventArgs> | ||
{ | ||
public object Sender { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
理论上作为参数都应该只能 get 不能修改
|
||
namespace lindexi.MVVM.Framework.ViewModel | ||
{ | ||
public abstract class MapEventToCommandBase<TEventArgs>:TriggerAction<DependencyObject> where TEventArgs:EventArgs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在 abstract 和 class 存在两个空格
|
||
protected override void Invoke(object parameter) | ||
{ | ||
if (base.AssociatedObject!=null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在表达式左右需要加上空格
EventInfomation<TEventArgs> eventInfomation = new EventInfomation<TEventArgs>() | ||
{ | ||
Sender=base.AssociatedObject, | ||
EventArgs=parameter as TEventArgs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里有要求 parameter 一定就是 TEventArgs 不让就应该给异常
} | ||
return command; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
多余的空行
public Action<object> ViewModelAction | ||
{ | ||
get { return _viewModelAction; } | ||
set { _viewModelAction = value; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
理论上不应该开放修改
请删除 FrameWorkLib/PresentationCore.dll 两个文件 |
No description provided.