-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
114 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using Microsoft.Toolkit.Mvvm.Input; | ||
|
||
namespace HUDMerger.ViewModels; | ||
|
||
public class SettingsWindowViewModel : ViewModelBase | ||
{ | ||
private string _teamFortress2Folder; | ||
public string TeamFortress2Folder | ||
{ | ||
get => _teamFortress2Folder; | ||
set | ||
{ | ||
_teamFortress2Folder = value; | ||
OnPropertyChanged(); | ||
} | ||
} | ||
|
||
public ICommand CancelCommand { get; } | ||
public ICommand ApplyCommand { get; } | ||
|
||
public event EventHandler? Close; | ||
|
||
public SettingsWindowViewModel() | ||
{ | ||
_teamFortress2Folder = ((App)Application.Current).Settings.Value.TeamFortress2Folder; | ||
CancelCommand = new RelayCommand(Cancel); | ||
ApplyCommand = new RelayCommand(Apply); | ||
} | ||
|
||
private void Cancel() | ||
{ | ||
Close?.Invoke(this, new EventArgs()); | ||
} | ||
|
||
private void Apply() | ||
{ | ||
((App)Application.Current).Settings.Value.TeamFortress2Folder = TeamFortress2Folder; | ||
|
||
Properties.Settings.Default.TeamFortress2Folder = TeamFortress2Folder; | ||
Properties.Settings.Default.Save(); | ||
|
||
Close?.Invoke(this, new EventArgs()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<UserControl x:Class="HUDMerger.Views.SettingsWindowView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:HUDMerger.Views" | ||
xmlns:viewmodels="clr-namespace:HUDMerger.ViewModels" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type={x:Type viewmodels:SettingsWindowViewModel}}"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
<Label FontSize="22" Grid.Row="0" Margin="10,0,0,0">Settings</Label> | ||
<StackPanel Name="SettingsContainer" Grid.Row="1" Margin="10,0,10,10"> | ||
<Label Content="Team Fortress 2 Folder" FontSize="15" ToolTip="Path to Team Fortress 2 Installation. Used for extracting required HUD files." /> | ||
<TextBox Style="{StaticResource TextBoxStyle1}" HorizontalAlignment="Left" MinWidth="480" Text="{Binding TeamFortress2Folder, Mode=TwoWay}" /> | ||
</StackPanel> | ||
<WrapPanel HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Row="2" Margin="10,5,10,10"> | ||
<Button Style="{StaticResource EnabledButton}" FontSize="14" Padding="20,8" Command="{Binding CancelCommand}" Margin="0,0,10,0" IsCancel="True">Cancel</Button> | ||
<Button Style="{StaticResource AccentButton}" FontSize="14" Padding="20,8" Command="{Binding ApplyCommand}">Apply</Button> | ||
</WrapPanel> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Windows.Controls; | ||
|
||
namespace HUDMerger.Views; | ||
|
||
/// <summary> | ||
/// Interaction logic for SettingsWindowView.xaml | ||
/// </summary> | ||
public partial class SettingsWindowView : UserControl | ||
{ | ||
public SettingsWindowView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |