Added ability for competition overlay to stay on top of other windows and be clicked through.
This commit is contained in:
@@ -18,6 +18,7 @@ namespace osrs_toolbox
|
|||||||
private bool _hideZeroKC = false;
|
private bool _hideZeroKC = false;
|
||||||
|
|
||||||
private ICommand _toggleCompetitionOverlay;
|
private ICommand _toggleCompetitionOverlay;
|
||||||
|
private ICommand _toggleCompetitionOverlayClickThrough;
|
||||||
|
|
||||||
public int CompetitionID
|
public int CompetitionID
|
||||||
{
|
{
|
||||||
@@ -50,5 +51,10 @@ namespace osrs_toolbox
|
|||||||
get { return _toggleCompetitionOverlay; }
|
get { return _toggleCompetitionOverlay; }
|
||||||
set { SetProperty(ref _toggleCompetitionOverlay, value, nameof(ToggleCompetitionOverlay)); }
|
set { SetProperty(ref _toggleCompetitionOverlay, value, nameof(ToggleCompetitionOverlay)); }
|
||||||
}
|
}
|
||||||
|
public ICommand ToggleCompetitionOverlayClickThrough
|
||||||
|
{
|
||||||
|
get { return _toggleCompetitionOverlayClickThrough; }
|
||||||
|
set { SetProperty(ref _toggleCompetitionOverlayClickThrough, value, nameof(ToggleCompetitionOverlayClickThrough)); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -67,6 +67,7 @@ namespace osrs_toolbox
|
|||||||
private void DoUpdate(object obj)
|
private void DoUpdate(object obj)
|
||||||
{
|
{
|
||||||
GridOutput = new StackPanel();
|
GridOutput = new StackPanel();
|
||||||
|
GridOutput.IsHitTestVisible = false;
|
||||||
Competition c = new Competition();
|
Competition c = new Competition();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -85,7 +86,8 @@ namespace osrs_toolbox
|
|||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
HorizontalAlignment = HorizontalAlignment.Left,
|
HorizontalAlignment = HorizontalAlignment.Left,
|
||||||
FontWeight = FontWeights.ExtraBold,
|
FontWeight = FontWeights.ExtraBold,
|
||||||
TextWrapping = TextWrapping.Wrap
|
TextWrapping = TextWrapping.Wrap,
|
||||||
|
IsHitTestVisible = false
|
||||||
});
|
});
|
||||||
OnPropertyChanged(nameof(GridOutput));
|
OnPropertyChanged(nameof(GridOutput));
|
||||||
return;
|
return;
|
||||||
@@ -106,13 +108,15 @@ namespace osrs_toolbox
|
|||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
HorizontalAlignment = HorizontalAlignment.Left,
|
HorizontalAlignment = HorizontalAlignment.Left,
|
||||||
FontWeight = FontWeights.ExtraBold,
|
FontWeight = FontWeights.ExtraBold,
|
||||||
TextWrapping = TextWrapping.Wrap
|
TextWrapping = TextWrapping.Wrap,
|
||||||
|
IsHitTestVisible = false
|
||||||
});
|
});
|
||||||
foreach (CompetitionParticipation cp in c.participations)
|
foreach (CompetitionParticipation cp in c.participations)
|
||||||
{
|
{
|
||||||
StackPanel SubStack = new StackPanel()
|
StackPanel SubStack = new StackPanel()
|
||||||
{
|
{
|
||||||
Orientation = Orientation.Horizontal
|
Orientation = Orientation.Horizontal,
|
||||||
|
IsHitTestVisible = false
|
||||||
};
|
};
|
||||||
|
|
||||||
Image typeImage = new Image();
|
Image typeImage = new Image();
|
||||||
|
@@ -27,6 +27,7 @@ namespace osrs_toolbox
|
|||||||
private void InitializeCommands()
|
private void InitializeCommands()
|
||||||
{
|
{
|
||||||
ToggleCompetitionOverlay = new RelayCommand(DoToggleCompetitionOverlay);
|
ToggleCompetitionOverlay = new RelayCommand(DoToggleCompetitionOverlay);
|
||||||
|
ToggleCompetitionOverlayClickThrough = new RelayCommand(DoToggleCompetitionOverlayClickThrough);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoToggleCompetitionOverlay(object obj)
|
private void DoToggleCompetitionOverlay(object obj)
|
||||||
@@ -53,5 +54,11 @@ namespace osrs_toolbox
|
|||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DoToggleCompetitionOverlayClickThrough(object obj)
|
||||||
|
{
|
||||||
|
if (CompetitionOverlayView.Current == null) { return; }
|
||||||
|
(CompetitionOverlayView.Current as CompetitionOverlayView).MakeClickThrough();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:osrs_toolbox"
|
xmlns:local="clr-namespace:osrs_toolbox"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Competition Info" Height="800" Width="500" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ResizeMode="NoResize" SizeToContent="WidthAndHeight" MouseDown="Window_MouseDown">
|
Title="Competition Info" Height="800" Width="500" AllowsTransparency="True" Background="Transparent" WindowStyle="None" ResizeMode="NoResize" SizeToContent="WidthAndHeight" MouseDown="Window_MouseDown" Topmost="True">
|
||||||
<Window.DataContext>
|
<Window.DataContext>
|
||||||
<local:CompetitionOverlayViewModel/>
|
<local:CompetitionOverlayViewModel/>
|
||||||
</Window.DataContext>
|
</Window.DataContext>
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<local:OutlinedTextBlock Grid.Column="0" Text="Competition Tracker" Margin="3" FontWeight="ExtraBold" FontSize="16" Stroke="Black" Fill="White" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
<local:OutlinedTextBlock Grid.Column="0" Text="Competition Tracker" Margin="3" FontWeight="ExtraBold" FontSize="16" Stroke="Black" Fill="White" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Border Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderBrush="Black" BorderThickness="0" Margin="3" Padding="3" CornerRadius="4">
|
<Border Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderBrush="Black" BorderThickness="0" Margin="3" Padding="3" CornerRadius="4" IsHitTestVisible="False">
|
||||||
<ContentControl Content="{Binding GridOutput, UpdateSourceTrigger=PropertyChanged}"/>
|
<ContentControl Content="{Binding GridOutput, UpdateSourceTrigger=PropertyChanged}" IsHitTestVisible="False"/>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@@ -8,6 +8,7 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
@@ -32,5 +33,11 @@ namespace osrs_toolbox
|
|||||||
if (e.LeftButton == MouseButtonState.Pressed)
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
DragMove();
|
DragMove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void MakeClickThrough()
|
||||||
|
{
|
||||||
|
var hwnd = new WindowInteropHelper(this).Handle;
|
||||||
|
WindowsServices.SetWindowExTransparent(hwnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
@@ -35,5 +36,6 @@
|
|||||||
<CheckBox IsChecked="{Binding HideOtherPlayers, UpdateSourceTrigger=PropertyChanged}" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
<CheckBox IsChecked="{Binding HideOtherPlayers, UpdateSourceTrigger=PropertyChanged}" Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||||
<CheckBox IsChecked="{Binding HideZeroGained, UpdateSourceTrigger=PropertyChanged}" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
<CheckBox IsChecked="{Binding HideZeroGained, UpdateSourceTrigger=PropertyChanged}" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||||
<Button Command="{Binding ToggleCompetitionOverlay, UpdateSourceTrigger=PropertyChanged}" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3" Padding="3" Content="Toggle Competition Overlay"/>
|
<Button Command="{Binding ToggleCompetitionOverlay, UpdateSourceTrigger=PropertyChanged}" Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3" Padding="3" Content="Toggle Competition Overlay"/>
|
||||||
|
<Button Command="{Binding ToggleCompetitionOverlayClickThrough, UpdateSourceTrigger=PropertyChanged}" Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3" Padding="3" Content="Make Overlay Click-Through"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
Reference in New Issue
Block a user