I am wondering how to achive clean architecture in my solution. I have projects: Core (Models, Messages, ViewModels), Mobile (Maui project), Shared (Dto projects). I have:
<PanGestureRecognizer PanUpdated="PanGestureRecognizer_PanUpdated"/>
in my View, which I pass it to the MyViewModel
via:
<code>private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
{
var panUpdatedCommand = ((MyViewModel)BindingContext).PanUpdatedCommand;
panUpdatedCommand.Execute(e);
}
</code>
<code>private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
{
var panUpdatedCommand = ((MyViewModel)BindingContext).PanUpdatedCommand;
panUpdatedCommand.Execute(e);
}
</code>
private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
{
var panUpdatedCommand = ((MyViewModel)BindingContext).PanUpdatedCommand;
panUpdatedCommand.Execute(e);
}
Here I pass the EventArgs: PanUpdatedEventArgs
which depends on Maui.
Then I can’t use RelayCommand
in MyViewModel
like this:
<code> [RelayCommand]
private void PanUpdated(PanUpdatedEventArgs e)
{
switch (e.StatusType)
{
case GestureStatus.Started:
...
case GestureStatus.Running:
...
case GestureStatus.Canceled:
...
case GestureStatus.Completed:
...
}
}
</code>
<code> [RelayCommand]
private void PanUpdated(PanUpdatedEventArgs e)
{
switch (e.StatusType)
{
case GestureStatus.Started:
...
case GestureStatus.Running:
...
case GestureStatus.Canceled:
...
case GestureStatus.Completed:
...
}
}
</code>
[RelayCommand]
private void PanUpdated(PanUpdatedEventArgs e)
{
switch (e.StatusType)
{
case GestureStatus.Started:
...
case GestureStatus.Running:
...
case GestureStatus.Canceled:
...
case GestureStatus.Completed:
...
}
}
because PanUpdatedEventArgs
and GestureStatus
come from Maui library but my MyViewModel
should be independent due to clean architecture. How can I achive that?