This commit is contained in:
adelikat 2019-12-22 13:58:00 -06:00
parent 60c789df22
commit 0b57b4c5f6
3 changed files with 12 additions and 22 deletions

View File

@ -166,9 +166,9 @@ namespace BizHawk.Client.EmuHawk
public readonly string Button;
public readonly ModifierKey Modifiers;
public bool Alt { get { return ((Modifiers & ModifierKey.Alt) != 0); } }
public bool Control { get { return ((Modifiers & ModifierKey.Control) != 0); } }
public bool Shift { get { return ((Modifiers & ModifierKey.Shift) != 0); } }
public bool Alt => (Modifiers & ModifierKey.Alt) != 0;
public bool Control => (Modifiers & ModifierKey.Control) != 0;
public bool Shift => (Modifiers & ModifierKey.Shift) != 0;
public override string ToString()
{
@ -257,8 +257,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
LogicalButton buttonModifierState;
if (ModifierState.TryGetValue(button, out buttonModifierState))
if (ModifierState.TryGetValue(button, out var buttonModifierState))
{
if (buttonModifierState != ie.LogicalButton && !IgnoreEventsNextPoll)
{
@ -312,8 +311,7 @@ namespace BizHawk.Client.EmuHawk
{
lock (this)
{
if (InputEvents.Count == 0) return null;
else return InputEvents.Dequeue();
return InputEvents.Count == 0 ? null : InputEvents.Dequeue();
}
}
void EnqueueEvent(InputEvent ie)

View File

@ -16,14 +16,14 @@ namespace BizHawk.Client.EmuHawk
public string ButtonName
{
get { return ButtonNameLabel.Text; }
set { ButtonNameLabel.Text = value; }
get => ButtonNameLabel.Text;
set => ButtonNameLabel.Text = value;
}
public double Probability
{
get { return (double)ProbabilityUpDown.Value; }
set { ProbabilityUpDown.Value = (decimal)value; }
get => (double)ProbabilityUpDown.Value;
set => ProbabilityUpDown.Value = (decimal)value;
}
private void ProbabilityUpDown_ValueChanged(object sender, EventArgs e)
@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
{
_programmaticallyChangingValues = true;
ProbabilitySlider.Value = (int)ProbabilityUpDown.Value;
ChangedCallback();
ProbabilityChangedCallback?.Invoke();
_programmaticallyChangingValues = false;
}
}
@ -43,17 +43,9 @@ namespace BizHawk.Client.EmuHawk
{
_programmaticallyChangingValues = true;
ProbabilityUpDown.Value = ProbabilitySlider.Value;
ChangedCallback();
ProbabilityChangedCallback?.Invoke();
_programmaticallyChangingValues = false;
}
}
private void ChangedCallback()
{
if (ProbabilityChangedCallback != null)
{
ProbabilityChangedCallback();
}
}
}
}

View File

@ -91,7 +91,7 @@ namespace BizHawk.Client.EmuHawk
protected void RefreshFloatingWindowControl(bool floatingWindow)
{
Owner = floatingWindow ? null : GlobalWin.MainForm;
Owner = floatingWindow ? null : MainForm;
}
protected bool IsOnScreen(Point topLeft)