Refactored competition overlay settings to its own window and removed references from home page.
This commit is contained in:
53
osrs-toolbox/Models/CompetitionOverlaySettingsModel.cs
Normal file
53
osrs-toolbox/Models/CompetitionOverlaySettingsModel.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace osrs_toolbox
|
||||
{
|
||||
public abstract class CompetitionOverlaySettingsModel : ModelBase
|
||||
{
|
||||
private int _competitionId = -1;
|
||||
private int _groupId = -1;
|
||||
private string _playerName = string.Empty;
|
||||
private bool _hideOtherPlayers = false;
|
||||
private bool _hideZeroKC = false;
|
||||
|
||||
private ICommand _toggleCompetitionOverlay;
|
||||
private ICommand _toggleCompetitionOverlayClickThrough;
|
||||
|
||||
public int CompetitionID
|
||||
{
|
||||
get { return _competitionId; }
|
||||
set { SetProperty(ref _competitionId, value, nameof(CompetitionID)); }
|
||||
}
|
||||
public int GroupID
|
||||
{
|
||||
get { return _groupId; }
|
||||
set { SetProperty(ref _groupId, value, nameof(GroupID)); }
|
||||
}
|
||||
public string PlayerName
|
||||
{
|
||||
get { return _playerName; }
|
||||
set { SetProperty(ref _playerName, value, nameof(PlayerName)); }
|
||||
}
|
||||
public bool HideOtherPlayers
|
||||
{
|
||||
get { return _hideOtherPlayers; }
|
||||
set { SetProperty(ref _hideOtherPlayers, value, nameof(HideOtherPlayers)); }
|
||||
}
|
||||
public bool HideZeroGained
|
||||
{
|
||||
get { return _hideZeroKC; }
|
||||
set { SetProperty(ref _hideZeroKC, value, nameof(HideZeroGained)); }
|
||||
}
|
||||
|
||||
public ICommand ToggleCompetitionOverlay
|
||||
{
|
||||
get { return _toggleCompetitionOverlay; }
|
||||
set { SetProperty(ref _toggleCompetitionOverlay, value, nameof(ToggleCompetitionOverlay)); }
|
||||
}
|
||||
public ICommand ToggleCompetitionOverlayClickThrough
|
||||
{
|
||||
get { return _toggleCompetitionOverlayClickThrough; }
|
||||
set { SetProperty(ref _toggleCompetitionOverlayClickThrough, value, nameof(ToggleCompetitionOverlayClickThrough)); }
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,50 +11,12 @@ namespace osrs_toolbox
|
||||
{
|
||||
public abstract class HomePageModel : ModelBase
|
||||
{
|
||||
private int _competitionId = -1;
|
||||
private int _groupId = -1;
|
||||
private string _playerName = string.Empty;
|
||||
private bool _hideOtherPlayers = false;
|
||||
private bool _hideZeroKC = false;
|
||||
private ICommand _openCompetitionOverlaySettings;
|
||||
|
||||
private ICommand _toggleCompetitionOverlay;
|
||||
private ICommand _toggleCompetitionOverlayClickThrough;
|
||||
|
||||
public int CompetitionID
|
||||
public ICommand OpenCompetitionOverlaySettings
|
||||
{
|
||||
get { return _competitionId; }
|
||||
set { SetProperty(ref _competitionId, value, nameof(CompetitionID)); }
|
||||
}
|
||||
public int GroupID
|
||||
{
|
||||
get { return _groupId; }
|
||||
set { SetProperty(ref _groupId, value, nameof(GroupID)); }
|
||||
}
|
||||
public string PlayerName
|
||||
{
|
||||
get { return _playerName; }
|
||||
set { SetProperty(ref _playerName, value, nameof(PlayerName)); }
|
||||
}
|
||||
public bool HideOtherPlayers
|
||||
{
|
||||
get { return _hideOtherPlayers; }
|
||||
set { SetProperty(ref _hideOtherPlayers, value, nameof(HideOtherPlayers)); }
|
||||
}
|
||||
public bool HideZeroGained
|
||||
{
|
||||
get { return _hideZeroKC; }
|
||||
set { SetProperty(ref _hideZeroKC, value, nameof(HideZeroGained)); }
|
||||
}
|
||||
|
||||
public ICommand ToggleCompetitionOverlay
|
||||
{
|
||||
get { return _toggleCompetitionOverlay; }
|
||||
set { SetProperty(ref _toggleCompetitionOverlay, value, nameof(ToggleCompetitionOverlay)); }
|
||||
}
|
||||
public ICommand ToggleCompetitionOverlayClickThrough
|
||||
{
|
||||
get { return _toggleCompetitionOverlayClickThrough; }
|
||||
set { SetProperty(ref _toggleCompetitionOverlayClickThrough, value, nameof(ToggleCompetitionOverlayClickThrough)); }
|
||||
get { return _openCompetitionOverlaySettings; }
|
||||
set { SetProperty(ref _openCompetitionOverlaySettings, value, nameof(OpenCompetitionOverlaySettings)); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osrs_toolbox
|
||||
{
|
||||
public class CompetitionOverlaySettingsViewModel : CompetitionOverlaySettingsModel
|
||||
{
|
||||
public CompetitionOverlaySettingsViewModel()
|
||||
{
|
||||
InitializeVariables();
|
||||
InitializeCommands();
|
||||
}
|
||||
|
||||
private void InitializeVariables()
|
||||
{
|
||||
CompetitionID = Properties.Settings.Default.LastCompetitionID;
|
||||
GroupID = Properties.Settings.Default.LastGroupID;
|
||||
PlayerName = Properties.Settings.Default.LastUserName;
|
||||
HideOtherPlayers = Properties.Settings.Default.LastHideOthers;
|
||||
HideZeroGained = Properties.Settings.Default.LastHideZeroGained;
|
||||
}
|
||||
|
||||
private void InitializeCommands()
|
||||
{
|
||||
ToggleCompetitionOverlay = new RelayCommand(DoToggleCompetitionOverlay);
|
||||
ToggleCompetitionOverlayClickThrough = new RelayCommand(DoToggleCompetitionOverlayClickThrough);
|
||||
}
|
||||
|
||||
private void DoToggleCompetitionOverlay(object obj)
|
||||
{
|
||||
if (CompetitionOverlayView.Current != null)
|
||||
{
|
||||
CompetitionOverlayView.Current.Close();
|
||||
CompetitionOverlayView.Current = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
CompetitionOverlayView cov = new CompetitionOverlayView();
|
||||
(cov.DataContext as CompetitionOverlayViewModel).PlayerName = PlayerName;
|
||||
(cov.DataContext as CompetitionOverlayViewModel).GroupID = GroupID;
|
||||
(cov.DataContext as CompetitionOverlayViewModel).CompetitionID = CompetitionID;
|
||||
(cov.DataContext as CompetitionOverlayViewModel).HideOtherPlayers = HideOtherPlayers;
|
||||
(cov.DataContext as CompetitionOverlayViewModel).HideZeroGained = HideZeroGained;
|
||||
cov.Show();
|
||||
Properties.Settings.Default.LastUserName = PlayerName;
|
||||
Properties.Settings.Default.LastGroupID = GroupID;
|
||||
Properties.Settings.Default.LastCompetitionID = CompetitionID;
|
||||
Properties.Settings.Default.LastHideOthers = HideOtherPlayers;
|
||||
Properties.Settings.Default.LastHideZeroGained = HideZeroGained;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void DoToggleCompetitionOverlayClickThrough(object obj)
|
||||
{
|
||||
if (CompetitionOverlayView.Current == null) { return; }
|
||||
(CompetitionOverlayView.Current as CompetitionOverlayView).MakeClickThrough();
|
||||
}
|
||||
}
|
||||
}
|
@@ -17,48 +17,26 @@ namespace osrs_toolbox
|
||||
|
||||
private void InitializeVariables()
|
||||
{
|
||||
CompetitionID = Properties.Settings.Default.LastCompetitionID;
|
||||
GroupID = Properties.Settings.Default.LastGroupID;
|
||||
PlayerName = Properties.Settings.Default.LastUserName;
|
||||
HideOtherPlayers = Properties.Settings.Default.LastHideOthers;
|
||||
HideZeroGained = Properties.Settings.Default.LastHideZeroGained;
|
||||
|
||||
}
|
||||
|
||||
private void InitializeCommands()
|
||||
{
|
||||
ToggleCompetitionOverlay = new RelayCommand(DoToggleCompetitionOverlay);
|
||||
ToggleCompetitionOverlayClickThrough = new RelayCommand(DoToggleCompetitionOverlayClickThrough);
|
||||
OpenCompetitionOverlaySettings = new RelayCommand(DoOpenCompetitionOverlaySettings);
|
||||
}
|
||||
|
||||
private void DoToggleCompetitionOverlay(object obj)
|
||||
private void DoOpenCompetitionOverlaySettings(object obj)
|
||||
{
|
||||
if (CompetitionOverlayView.Current != null)
|
||||
if (CompetitionOverlaySettingsView.Current != null)
|
||||
{
|
||||
CompetitionOverlayView.Current.Close();
|
||||
CompetitionOverlayView.Current = null;
|
||||
CompetitionOverlaySettingsView.Current.Close();
|
||||
CompetitionOverlaySettingsView.Current = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
CompetitionOverlayView cov = new CompetitionOverlayView();
|
||||
(cov.DataContext as CompetitionOverlayViewModel).PlayerName = PlayerName;
|
||||
(cov.DataContext as CompetitionOverlayViewModel).GroupID = GroupID;
|
||||
(cov.DataContext as CompetitionOverlayViewModel).CompetitionID = CompetitionID;
|
||||
(cov.DataContext as CompetitionOverlayViewModel).HideOtherPlayers = HideOtherPlayers;
|
||||
(cov.DataContext as CompetitionOverlayViewModel).HideZeroGained = HideZeroGained;
|
||||
cov.Show();
|
||||
Properties.Settings.Default.LastUserName = PlayerName;
|
||||
Properties.Settings.Default.LastGroupID = GroupID;
|
||||
Properties.Settings.Default.LastCompetitionID = CompetitionID;
|
||||
Properties.Settings.Default.LastHideOthers = HideOtherPlayers;
|
||||
Properties.Settings.Default.LastHideZeroGained = HideZeroGained;
|
||||
Properties.Settings.Default.Save();
|
||||
CompetitionOverlaySettingsView cosv = new CompetitionOverlaySettingsView();
|
||||
cosv.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void DoToggleCompetitionOverlayClickThrough(object obj)
|
||||
{
|
||||
if (CompetitionOverlayView.Current == null) { return; }
|
||||
(CompetitionOverlayView.Current as CompetitionOverlayView).MakeClickThrough();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
41
osrs-toolbox/Views/CompetitionOverlaySettingsView.xaml
Normal file
41
osrs-toolbox/Views/CompetitionOverlaySettingsView.xaml
Normal file
@@ -0,0 +1,41 @@
|
||||
<Window x:Class="osrs_toolbox.CompetitionOverlaySettingsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:osrs_toolbox"
|
||||
mc:Ignorable="d"
|
||||
Title="Wise Old Man Competition Overlay Settings" d:Height="450" d:Width="800" SizeToContent="WidthAndHeight" Closed="Window_Closed">
|
||||
<Window.DataContext>
|
||||
<local:CompetitionOverlaySettingsViewModel/>
|
||||
</Window.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Competition Overlay Testing" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" TextDecorations="Underline" Margin="3"/>
|
||||
<TextBlock Text="Player Name:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||
<!--TextBlock Text="Group ID:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/-->
|
||||
<TextBlock Text="Competition ID:" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||
<TextBlock Text="Hide Other Players:" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||
<TextBlock Text="Hide Zero Gained:" Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||
<TextBox Text="{Binding PlayerName, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="3"/>
|
||||
<!--TextBox Text="{Binding GroupID, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="3"/-->
|
||||
<TextBox Text="{Binding CompetitionID, UpdateSourceTrigger=PropertyChanged}" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" 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"/>
|
||||
<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>
|
||||
</Window>
|
35
osrs-toolbox/Views/CompetitionOverlaySettingsView.xaml.cs
Normal file
35
osrs-toolbox/Views/CompetitionOverlaySettingsView.xaml.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace osrs_toolbox
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CompetitionOverlaySettingsView.xaml
|
||||
/// </summary>
|
||||
public partial class CompetitionOverlaySettingsView : Window
|
||||
{
|
||||
public static CompetitionOverlaySettingsView Current;
|
||||
|
||||
public CompetitionOverlaySettingsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
Current = this;
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
Current = null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -10,32 +10,6 @@
|
||||
<local:HomePageViewModel/>
|
||||
</Window.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="Competition Overlay Testing" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" TextDecorations="Underline" Margin="3"/>
|
||||
<TextBlock Text="Player Name:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||
<!--TextBlock Text="Group ID:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/-->
|
||||
<TextBlock Text="Competition ID:" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||
<TextBlock Text="Hide Other Players:" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||
<TextBlock Text="Hide Zero Gained:" Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="3"/>
|
||||
<TextBox Text="{Binding PlayerName, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="3"/>
|
||||
<!--TextBox Text="{Binding GroupID, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="3"/-->
|
||||
<TextBox Text="{Binding CompetitionID, UpdateSourceTrigger=PropertyChanged}" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" 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"/>
|
||||
<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"/>
|
||||
<Button Command="{Binding OpenCompetitionOverlaySettings, UpdateSourceTrigger=PropertyChanged}" Content="Open Competition Overlay Settings" Margin="3" Padding="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
Reference in New Issue
Block a user