Skip to content

Commit

Permalink
Extract local function in mousecomboviewmodel
Browse files Browse the repository at this point in the history
  • Loading branch information
FaithBeam committed Oct 5, 2024
1 parent 7385ac9 commit 8908209
Showing 1 changed file with 13 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,41 +80,20 @@ IShowSimulatedKeystrokesDialogService showSimulatedKeystrokesDialogService
switch (next.Direction)
{
case WheelScrollDirection.VerticalUp when mouseButton == MouseButton.Mwu:
BackgroundColor = themeService.CurHighlight;
if (!_wheelTimer.Enabled)
{
_wheelTimer.Start();
}
break;
case WheelScrollDirection.VerticalDown when mouseButton == MouseButton.Mwd:
BackgroundColor = themeService.CurHighlight;
if (!_wheelTimer.Enabled)
{
_wheelTimer.Start();
}
break;
case WheelScrollDirection.HorizontalRight
when mouseButton == MouseButton.Mwr:
BackgroundColor = themeService.CurHighlight;
if (!_wheelTimer.Enabled)
{
_wheelTimer.Start();
}
break;
case WheelScrollDirection.HorizontalLeft
when mouseButton == MouseButton.Mwl:
BackgroundColor = themeService.CurHighlight;
if (!_wheelTimer.Enabled)
{
_wheelTimer.Start();
}
MouseWheelDoHighlight();
break;
}
});
break;
default:
throw new ArgumentOutOfRangeException(nameof(mouseButton), mouseButton, null);
}

_profilesService = profilesService;
SourceCache<BaseButtonMappingVm, int> sourceButtonMappings = new(x => x.Index);
var myOp = sourceButtonMappings.Connect().AutoRefresh().Bind(out _btnMappings).Subscribe();
Expand Down Expand Up @@ -166,13 +145,24 @@ await ShowSimulatedKeystrokesDialogService.ShowSimulatedKeystrokesDialog(
},
canClickUserClickedSettingsBtn
);
return;

void MouseWheelDoHighlight()
{
BackgroundColor = themeService.CurHighlight;
if (!_wheelTimer.Enabled)
{
_wheelTimer.Start();
}
}
}

public IBrush BackgroundColor
{
get => _backgroundColor;
set => this.RaiseAndSetIfChanged(ref _backgroundColor, value);
}

public IShowSimulatedKeystrokesDialogService ShowSimulatedKeystrokesDialogService { get; }

public BaseButtonMappingVm? SelectedBtnMap
Expand Down

0 comments on commit 8908209

Please sign in to comment.