Skip to content

Commit

Permalink
Merge pull request #71 from FPGSchiba/volts-issue48
Browse files Browse the repository at this point in the history
add orientation change btn for 2 vert and 2 hort
  • Loading branch information
gtodd876 authored Nov 26, 2023
2 parents 7692c4b + 1d3a8a1 commit e221202
Show file tree
Hide file tree
Showing 19 changed files with 279 additions and 67 deletions.
3 changes: 3 additions & 0 deletions DCS-SR-Client/DCS-SR-Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Resource Include="SRS_Orientation_Toggle.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="UI\ClientWindow\vanguardsrsback.png" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
Expand Down
Binary file added DCS-SR-Client/SRS_Orientation_Toggle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions DCS-SR-Client/UI/ClientWindow/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1461,28 +1461,28 @@ private void ToggleOverlay(bool uiButton, int switchTo)
switch (switchTo)
{
case 0:
windows[switchTo] = new RadioOverlayWindowTwoVertical();
windows[switchTo] = new RadioOverlayWindowTwoVertical(ToggleOverlay);
break;
case 1:
windows[switchTo] = new RadioOverlayWindowThreeVertical();
windows[switchTo] = new RadioOverlayWindowThreeVertical(ToggleOverlay);
break;
case 2:
windows[switchTo] = new RadioOverlayWindowFiveVertical();
windows[switchTo] = new RadioOverlayWindowFiveVertical(ToggleOverlay);
break;
case 3:
windows[switchTo] = new RadioOverlayWindowTenVertical();
windows[switchTo] = new RadioOverlayWindowTenVertical(ToggleOverlay);
break;
case 4:
windows[switchTo] = new RadioOverlayWindowTwoHorizontal();
windows[switchTo] = new RadioOverlayWindowTwoHorizontal(ToggleOverlay);
break;
case 5:
windows[switchTo] = new RadioOverlayWindowThreeHorizontal();
windows[switchTo] = new RadioOverlayWindowThreeHorizontal(ToggleOverlay);
break;
case 6:
windows[switchTo] = new RadioOverlayWindowFiveHorizontal();
windows[switchTo] = new RadioOverlayWindowFiveHorizontal(ToggleOverlay);
break;
case 7:
windows[switchTo] = new RadioOverlayWindowTenHorizontal();
windows[switchTo] = new RadioOverlayWindowTenHorizontal(ToggleOverlay);
break;
}
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,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 All @@ -95,7 +114,6 @@
</Grid>
</Button.Content>
</Button>

<Button Height="15"
Margin="2,0,5,0"
VerticalAlignment="Center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public partial class RadioOverlayWindowFiveHorizontal : Window

private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance;

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

public RadioOverlayWindowFiveHorizontal(Action<bool, int> ToggleOverlay)
{
InitializeComponent();

Expand Down Expand Up @@ -69,6 +71,8 @@ public RadioOverlayWindowFiveHorizontal()
_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 @@ -169,6 +173,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

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

private void windowOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Opacity = e.NewValue;
Expand Down
26 changes: 22 additions & 4 deletions DCS-SR-Client/UI/RadioOverlayWindow/RadioOverlayFiveVertical.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,34 @@
ScaleY="{Binding ElementName=RadioOverlayWin,
Path=ScaleValue}" />
</WrapPanel.LayoutTransform>

<TextBlock Name="ControlText"
Width="118"
Width="70"
Height="12"
Margin="5,0,0,0"
VerticalAlignment="Top"
VerticalAlignment="Center"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="" />
Text="5 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 @@ -41,8 +41,10 @@ public partial class RadioOverlayWindowFiveVertical : Window

private long _lastUnitId;

private Action<bool, int> _toggleOverlay;

public RadioOverlayWindowFiveVertical()

public RadioOverlayWindowFiveVertical(Action<bool, int> ToggleOverlay)
{
//load opacity before the intialising as the slider changed
//method fires after initialisation
Expand Down Expand Up @@ -90,6 +92,8 @@ public RadioOverlayWindowFiveVertical()
_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 @@ -247,6 +251,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

private void Button_Swap_Orientation(object sender, RoutedEventArgs e)
{
Close();
_toggleOverlay(true, 6); // index 6 is the horizontal 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 @@ -51,7 +51,7 @@
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock Name="ControlText"
Width="665"
Width="608"
Height="16"
Margin="5,0,0,0"
VerticalAlignment="Center"
Expand Down Expand Up @@ -80,6 +80,22 @@
</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 @@ -32,7 +32,9 @@ public partial class RadioOverlayWindowTenHorizontal : Window

private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance;

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

public RadioOverlayWindowTenHorizontal(Action<bool, int> ToggleOverlay)
{
//load opacity before the intialising as the slider changed
//method fires after initialisation
Expand Down Expand Up @@ -80,6 +82,8 @@ public RadioOverlayWindowTenHorizontal()
_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 @@ -157,6 +161,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

private void Button_Swap_Orientation(object sender, RoutedEventArgs e)
{
Close();
_toggleOverlay(true, 3); // index 3 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/RadioOverlayTenVertical.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,33 @@
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock Name="ControlText"
Width="300"
Width="250"
Height="16"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="13"
Foreground="#E7E7E7"
Padding="0"
Text="10 Vertical" />
<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 @@ -32,7 +32,9 @@ public partial class RadioOverlayWindowTenVertical : Window

private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance;

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

public RadioOverlayWindowTenVertical(Action<bool, int> ToggleOverlay)
{
//load opacity before the intialising as the slider changed
//method fires after initialisation
Expand Down Expand Up @@ -78,6 +80,8 @@ public RadioOverlayWindowTenVertical()
_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 @@ -149,6 +153,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

private void Button_Swap_Orientation(object sender, RoutedEventArgs e)
{
Close();
_toggleOverlay(true, 7); // index 3 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 @@ -47,15 +47,13 @@
Grid.ColumnSpan="5"
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock Name="ControlText"
Width="370"
Height="16"
Margin="5,0,0,0"
VerticalAlignment="Center"
FontSize="13"
Foreground="#E7E7E7"
Padding="0"
Text="3 Radio Panel Horizontal" />
<TextBlock x:Name="ControlText"
Width="310"
Height="12"
FontSize="8"
Foreground="#E7E7E7"
Padding="0"
Text="3 Radio Panel" />
<TextBlock Name="ControlSubText"
Width="100"
Text="VNGD is best"
Expand All @@ -77,6 +75,22 @@
</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 @@ -31,7 +31,9 @@ public partial class RadioOverlayWindowThreeHorizontal : Window

private GlobalSettingsStore _globalSettings = GlobalSettingsStore.Instance;

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

public RadioOverlayWindowThreeHorizontal(Action<bool, int> ToggleOverlay)
{
InitializeComponent();

Expand Down Expand Up @@ -67,6 +69,8 @@ public RadioOverlayWindowThreeHorizontal()
_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 @@ -167,6 +171,12 @@ private void Button_Close(object sender, RoutedEventArgs e)
Close();
}

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

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

0 comments on commit e221202

Please sign in to comment.