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

Add orientation swap to radio panels 1, 10HW, 10VL #86

Merged
merged 3 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1743,20 +1743,16 @@ private void ToggleOverlay(bool uiButton, int switchTo)
windows[switchTo] = new RadioOverlayWindowTenHorizontal(ToggleOverlay);
break;
case 8:
// TODO: Add Toggle Overlay for Horizontal Swap
windows[switchTo] = new RadioOverlayWindowOneVertical();
windows[switchTo] = new RadioOverlayWindowOneVertical(ToggleOverlay);
break;
case 9:
// TODO: Add Toggle Overlay for Horizontal Swap
windows[switchTo] = new RadioOverlayWindowOneHorizontal();
windows[switchTo] = new RadioOverlayWindowOneHorizontal(ToggleOverlay);
break;
case 10:
// TODO: Add Toggle Overlay for Horizontal Swap
windows[switchTo] = new RadioOverlayWindowTenVerticalLong();
windows[switchTo] = new RadioOverlayWindowTenVerticalLong(ToggleOverlay);
break;
case 11:
// TODO: Add Toggle Overlay for Horizontal Swap
windows[switchTo] = new RadioOverlayWindowTenHorizontalWide();
windows[switchTo] = new RadioOverlayWindowTenHorizontalWide(ToggleOverlay);
break;
}
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@
</TextBlock.Style>
</TextBlock>
<TextBlock Name="Orientation"
Width="38"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="Horizontal" />
Width="38"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="Horizontal" />
<Button
Height="15"
Margin="0,0,2,0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock Name="ControlText"
Width="200"
Width="140"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
Expand Down Expand Up @@ -76,6 +76,25 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Name="Orientation"
Width="38"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="Horizontal" />
<Button
Height="15"
Margin="0,0,2,0"
ToolTip="Swap to vertical orientation"
Click="Button_Swap_Orientation"
Style="{StaticResource DarkStyle-Button}">
<Grid Width="10" Height="10">
<Image Source="../../SRS_Orientation_Toggle.png" />
</Grid>
</Button>
<Button Height="15"
Margin="0,0,0,0"
VerticalAlignment="Center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public partial class RadioOverlayWindowOneHorizontal : Window

private long _lastUnitId;


public RadioOverlayWindowOneHorizontal()
private Action<bool, int> _toggleOverlay;

public RadioOverlayWindowOneHorizontal(Action<bool, int> ToggleOverlay)
{
//load opacity before the intialising as the slider changed
//method fires after initialisation
Expand Down Expand Up @@ -89,6 +89,8 @@ public RadioOverlayWindowOneHorizontal()
_updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)};
_updateTimer.Tick += RadioRefresh;
_updateTimer.Start();

this._toggleOverlay = ToggleOverlay;
}

private void Location_Changed(object sender, EventArgs e)
Expand Down Expand Up @@ -238,6 +240,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

private void Button_Swap_Orientation(object sender, RoutedEventArgs e)
{
Close();
_toggleOverlay(true, 8); // index 8 is the vertical orientation
}

private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Opacity = e.NewValue;
Expand Down
21 changes: 20 additions & 1 deletion DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayOneVertical.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,33 @@
</WrapPanel.LayoutTransform>

<TextBlock Name="ControlText"
Width="118"
Width="72"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="1 Radio Panel" />
<TextBlock Name="Orientation"
Width="28"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="Vertical" />
<Button Margin="0,0,0,0"
Click="Button_Swap_Orientation"
Style="{StaticResource DarkStyle-Button}"
ToolTip="Swap to horizon orientation">
<Button.Content>
<Grid Width="10" Height="10">
<Image Source="../../SRS_Orientation_Toggle.png" />
</Grid>
</Button.Content>
</Button>
<Button Margin="0,0,0,0"
Click="Button_About"
Style="{StaticResource DarkStyle-Button}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ public partial class RadioOverlayWindowOneVertical : Window

private long _lastUnitId;

private Action<bool, int> _toggleOverlay;

public RadioOverlayWindowOneVertical()

public RadioOverlayWindowOneVertical(Action<bool, int> ToggleOverlay)
{
//load opacity before the intialising as the slider changed
//method fires after initialisation
Expand Down Expand Up @@ -88,6 +90,8 @@ public RadioOverlayWindowOneVertical()
_updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)};
_updateTimer.Tick += RadioRefresh;
_updateTimer.Start();

this._toggleOverlay = ToggleOverlay;
}

private void Location_Changed(object sender, EventArgs e)
Expand Down Expand Up @@ -255,6 +259,11 @@ private void Button_Close(object sender, RoutedEventArgs e)
{
Close();
}
private void Button_Swap_Orientation(object sender, RoutedEventArgs e)
{
Close();
_toggleOverlay(true, 9); // index 9 is the horizontal orientation
}

private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,25 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Name="Orientation"
Width="38"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="Horizontal" />
<Button
Height="15"
Margin="0,0,2,0"
ToolTip="Swap to vertical orientation"
Click="Button_Swap_Orientation"
Style="{StaticResource DarkStyle-Button}">
<Grid Width="10" Height="10">
<Image Source="../../SRS_Orientation_Toggle.png" />
</Grid>
</Button>
<Button Height="15"
Margin="0,0,0,0"
VerticalAlignment="Center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public partial class RadioOverlayWindowTenHorizontalWide : Window

private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance;

public RadioOverlayWindowTenHorizontalWide()
private Action<bool, int> _toggleOverlay;

public RadioOverlayWindowTenHorizontalWide(Action<bool, int> ToggleOverlay)
{
//load opacity before the intialising as the slider changed
//method fires after initialisation
Expand Down Expand Up @@ -83,6 +85,8 @@ public RadioOverlayWindowTenHorizontalWide()
_updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)};
_updateTimer.Tick += RadioRefresh;
_updateTimer.Start();

this._toggleOverlay = ToggleOverlay;
}

private void Location_Changed(object sender, EventArgs e)
Expand Down Expand Up @@ -184,6 +188,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

private void Button_Swap_Orientation(object sender, RoutedEventArgs e)
{
Close();
_toggleOverlay(true, 10); // index 10 is the vertical orientation
}

private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Opacity = e.NewValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,33 @@
HorizontalAlignment="Left"
Orientation="Horizontal" Margin="5,0,0,0" Width="160">
<TextBlock Name="ControlText"
Width="125"
Width="80"
Height="12"
Margin="2,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="10 Radio Panel" />
<TextBlock Name="Orientation"
Width="28"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="Vertical" />
<Button Margin="0,0,0,0"
Click="Button_Swap_Orientation"
Style="{StaticResource DarkStyle-Button}"
ToolTip="Swap to horizon orientation">
<Button.Content>
<Grid Width="10" Height="10">
<Image Source="../../SRS_Orientation_Toggle.png" />
</Grid>
</Button.Content>
</Button>
<Button Height="15"
Margin="0,0,0,0"
VerticalAlignment="Center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public partial class RadioOverlayWindowTenVerticalLong : Window

private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance;

public RadioOverlayWindowTenVerticalLong()
private Action<bool, int> _toggleOverlay;

public RadioOverlayWindowTenVerticalLong(Action<bool, int> ToggleOverlay)
{
//load opacity before the intialising as the slider changed
//method fires after initialisation
Expand Down Expand Up @@ -81,6 +83,8 @@ public RadioOverlayWindowTenVerticalLong()
_updateTimer = new DispatcherTimer {Interval = TimeSpan.FromMilliseconds(80)};
_updateTimer.Tick += RadioRefresh;
_updateTimer.Start();

this._toggleOverlay = ToggleOverlay;
}

private void RadioRefresh(object sender, EventArgs eventArgs)
Expand Down Expand Up @@ -176,6 +180,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

private void Button_Swap_Orientation(object sender, RoutedEventArgs e)
{
Close();
_toggleOverlay(true, 11); // index 11 is the horizontal orientation
}

private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Opacity = e.NewValue;
Expand Down
Loading