Skip to content

Commit

Permalink
Split Bootstrapper tab into Appearance/Behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Feb 16, 2023
1 parent fb4a417 commit e075e9b
Show file tree
Hide file tree
Showing 11 changed files with 210 additions and 149 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using CommunityToolkit.Mvvm.Input;

using Bloxstrap.Dialogs;
using Bloxstrap.Enums;
using Bloxstrap.Helpers.Extensions;
using Bloxstrap.Views;
using CommunityToolkit.Mvvm.Input;
using Wpf.Ui.Mvvm.Services;
using Wpf.Ui.Mvvm.Contracts;

namespace Bloxstrap.ViewModels
{
public class BootstrapperViewModel : INotifyPropertyChanged
public class AppearanceViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
Expand All @@ -35,36 +31,11 @@ private void PreviewBootstrapper()
dialog.ShowBootstrapper();
}


public BootstrapperViewModel(Page page)
public AppearanceViewModel(Page page)
{
_page = page;
}

public bool CreateDesktopIcon
{
get => App.Settings.Prop.CreateDesktopIcon;
set => App.Settings.Prop.CreateDesktopIcon = value;
}

public bool UpdateCheckingEnabled
{
get => App.Settings.Prop.CheckForUpdates;
set => App.Settings.Prop.CheckForUpdates = value;
}

public bool ChannelChangePromptingEnabled
{
get => App.Settings.Prop.PromptChannelChange;
set => App.Settings.Prop.PromptChannelChange = value;
}

public bool MultiInstanceLaunchingEnabled
{
get => App.Settings.Prop.MultiInstanceLaunching;
set => App.Settings.Prop.MultiInstanceLaunching = value;
}

public IReadOnlyDictionary<string, Theme> Themes { get; set; } = new Dictionary<string, Theme>()
{
{ "System Default", Enums.Theme.Default },
Expand Down
47 changes: 47 additions & 0 deletions Bloxstrap/ViewModels/BehaviourViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Bloxstrap.Dialogs;
using Bloxstrap.Enums;
using Bloxstrap.Helpers.Extensions;
using Bloxstrap.Views;
using CommunityToolkit.Mvvm.Input;
using Wpf.Ui.Mvvm.Services;
using Wpf.Ui.Mvvm.Contracts;

namespace Bloxstrap.ViewModels
{
public class BehaviourViewModel
{
public bool CreateDesktopIcon
{
get => App.Settings.Prop.CreateDesktopIcon;
set => App.Settings.Prop.CreateDesktopIcon = value;
}

public bool UpdateCheckingEnabled
{
get => App.Settings.Prop.CheckForUpdates;
set => App.Settings.Prop.CheckForUpdates = value;
}

public bool ChannelChangePromptingEnabled
{
get => App.Settings.Prop.PromptChannelChange;
set => App.Settings.Prop.PromptChannelChange = value;
}

public bool MultiInstanceLaunchingEnabled
{
get => App.Settings.Prop.MultiInstanceLaunching;
set => App.Settings.Prop.MultiInstanceLaunching = value;
}
}
}
3 changes: 2 additions & 1 deletion Bloxstrap/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
<ui:NavigationFluent.Items>
<ui:NavigationItem Content="Integrations" PageType="{x:Type pages:IntegrationsPage}" Icon="Add28" Tag="integrations" />
<ui:NavigationItem Content="Mods" PageType="{x:Type pages:ModsPage}" Icon="WrenchScrewdriver20" Tag="mods" />
<ui:NavigationItem Content="Bootstrapper" PageType="{x:Type pages:BootstrapperPage}" Icon="WindowWrench48" Tag="bootstrapper" />
<ui:NavigationItem Content="Appearance" PageType="{x:Type pages:AppearancePage}" Icon="PaintBrush24" Tag="appearance" />
<ui:NavigationItem Content="Behaviour" PageType="{x:Type pages:BehaviourPage}" Icon="Settings24" Tag="behaviour" />
<ui:NavigationItem Content="Installation" PageType="{x:Type pages:InstallationPage}" Icon="HardDrive20" Tag="installation" />
<ui:NavigationItem Content="About" PageType="{x:Type pages:AboutPage}" Icon="QuestionCircle48" Tag="about" />
</ui:NavigationFluent.Items>
Expand Down
55 changes: 55 additions & 0 deletions Bloxstrap/Views/Pages/AppearancePage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<ui:UiPage x:Class="Bloxstrap.Views.Pages.AppearancePage"
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:Bloxstrap.Views.Pages"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="AppearancePage"
Scrollable="True">
<StackPanel Margin="0,0,14,14">
<TextBlock Text="Configure how Bloxstrap should look." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Theme" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Dark theme does not apply to Legacy or Vista styles." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ComboBox Width="200" Padding="10,5,10,5" ItemsSource="{Binding Themes.Keys, Mode=OneTime}" Text="{Binding Theme, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Style" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose how the bootstrapper should look." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ComboBox Width="200" Padding="10,5,10,5" ItemsSource="{Binding Dialogs.Keys, Mode=OneTime}" Text="{Binding Dialog, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Icon" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Choose what icon the bootstrapper should use." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<Grid Width="200">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Width="28" Height="28" Margin="0,0,5,0">
<Border.Background>
<ImageBrush ImageSource="{Binding IconPreviewSource, Mode=OneWay}" />
</Border.Background>
</Border>
<ComboBox Grid.Column="1" Margin="5,0,0,0" Padding="10,5,10,5" ItemsSource="{Binding Icons.Keys, Mode=OneTime}" Text="{Binding Icon, Mode=TwoWay}" />
</Grid>
</ui:CardControl>
<ui:Button Content="Preview" HorizontalAlignment="Stretch" Margin="0,8,0,0" Command="{Binding PreviewBootstrapperCommand}" />
</StackPanel>
</ui:UiPage>
30 changes: 30 additions & 0 deletions Bloxstrap/Views/Pages/AppearancePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Bloxstrap.ViewModels;
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.Navigation;
using System.Windows.Shapes;

namespace Bloxstrap.Views.Pages
{
/// <summary>
/// Interaction logic for AppearancePage.xaml
/// </summary>
public partial class AppearancePage
{
public AppearancePage()
{
DataContext = new AppearanceViewModel(this);
InitializeComponent();
}
}
}
53 changes: 53 additions & 0 deletions Bloxstrap/Views/Pages/BehaviourPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<ui:UiPage x:Class="Bloxstrap.Views.Pages.BehaviourPage"
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:models="clr-namespace:Bloxstrap.ViewModels"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800"
Title="BehaviourPage"
Scrollable="True">

<StackPanel Margin="0,0,14,14">
<TextBlock Text="Configure what Bloxstrap should do when starting up." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />

<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Create desktop icon" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Bloxstrap will place an icon on the desktop that launches Roblox the next time it launches." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:ToggleSwitch IsChecked="{Binding CreateDesktopIcon, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Automatically update Bloxstrap" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Bloxstrap will check and automatically update itself when launching Roblox." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:ToggleSwitch IsChecked="{Binding UpdateCheckingEnabled, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Allow multi-game instance launching" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Roblox will allow having more than one game instance open simultaneously." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:ToggleSwitch IsChecked="{Binding MultiInstanceLaunchingEnabled, Mode=TwoWay}" />
</ui:CardControl>
<ui:CardControl Margin="0,8,0,0" Padding="16,13,16,12">
<ui:CardControl.Header>
<StackPanel>
<TextBlock FontSize="14" Text="Prompt on Roblox-forced channel change" />
<TextBlock Margin="0,2,0,0" FontSize="12" Text="Confirm change if Roblox mandates when launching. Otherwise, it'll change automatically." Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
</StackPanel>
</ui:CardControl.Header>
<ui:ToggleSwitch IsChecked="{Binding ChannelChangePromptingEnabled, Mode=TwoWay}" />
</ui:CardControl>
</StackPanel>
</ui:UiPage>
16 changes: 16 additions & 0 deletions Bloxstrap/Views/Pages/BehaviourPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Bloxstrap.ViewModels;

namespace Bloxstrap.Views.Pages
{
/// <summary>
/// Interaction logic for BehaviourPage.xaml
/// </summary>
public partial class BehaviourPage
{
public BehaviourPage()
{
DataContext = new BehaviourViewModel();
InitializeComponent();
}
}
}
96 changes: 0 additions & 96 deletions Bloxstrap/Views/Pages/BootstrapperPage.xaml

This file was deleted.

16 changes: 0 additions & 16 deletions Bloxstrap/Views/Pages/BootstrapperPage.xaml.cs

This file was deleted.

Loading

0 comments on commit e075e9b

Please sign in to comment.