Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ZhengDaoWang
Copy link
Contributor

No description provided.

Copy link
Owner

@lindexi lindexi left a 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>
Copy link
Owner

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>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的代码没有对齐

Copy link
Owner

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; }
Copy link
Owner

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
Copy link
Owner

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)
Copy link
Owner

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,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里有要求 parameter 一定就是 TEventArgs 不让就应该给异常

}
return command;
}

Copy link
Owner

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; }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

理论上不应该开放修改

@lindexi
Copy link
Owner

lindexi commented May 16, 2019

请删除 FrameWorkLib/PresentationCore.dll 两个文件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants