mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-18 00:21:33 -07:00
* add background updating * add RobloxState * fix potential race condition with RobloxState * update ForceRobloxReinstallation in menu * disable AssertReadOnlyDirectory * add storage space check * add logging to IsEligibleForBackgroundUpdate * add a setting to toggle background updates * fix mutex names being mixed up * update string * update strings * update strings
146 lines
4.8 KiB
C#
146 lines
4.8 KiB
C#
using System.Windows;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shell;
|
|
|
|
using Bloxstrap.UI.Elements.Bootstrapper.Base;
|
|
using Bloxstrap.UI.ViewModels.Bootstrapper;
|
|
|
|
namespace Bloxstrap.UI.Elements.Bootstrapper
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for ByfronDialog.xaml
|
|
/// </summary>
|
|
public partial class ByfronDialog : IBootstrapperDialog
|
|
{
|
|
private readonly ByfronDialogViewModel _viewModel;
|
|
|
|
public Bloxstrap.Bootstrapper? Bootstrapper { get; set; }
|
|
|
|
private bool _isClosing;
|
|
|
|
#region UI Elements
|
|
public string Message
|
|
{
|
|
get => _viewModel.Message;
|
|
set
|
|
{
|
|
string message = value;
|
|
if (message.EndsWith("..."))
|
|
message = message[..^3];
|
|
|
|
_viewModel.Message = message;
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.Message));
|
|
}
|
|
}
|
|
|
|
public ProgressBarStyle ProgressStyle
|
|
{
|
|
get => _viewModel.ProgressIndeterminate ? ProgressBarStyle.Marquee : ProgressBarStyle.Continuous;
|
|
set
|
|
{
|
|
_viewModel.ProgressIndeterminate = (value == ProgressBarStyle.Marquee);
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.ProgressIndeterminate));
|
|
}
|
|
}
|
|
|
|
public int ProgressMaximum
|
|
{
|
|
get => _viewModel.ProgressMaximum;
|
|
set
|
|
{
|
|
_viewModel.ProgressMaximum = value;
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.ProgressMaximum));
|
|
}
|
|
}
|
|
|
|
public int ProgressValue
|
|
{
|
|
get => _viewModel.ProgressValue;
|
|
set
|
|
{
|
|
_viewModel.ProgressValue = value;
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.ProgressValue));
|
|
}
|
|
}
|
|
|
|
public TaskbarItemProgressState TaskbarProgressState
|
|
{
|
|
get => _viewModel.TaskbarProgressState;
|
|
set
|
|
{
|
|
_viewModel.TaskbarProgressState = value;
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.TaskbarProgressState));
|
|
}
|
|
}
|
|
|
|
public double TaskbarProgressValue
|
|
{
|
|
get => _viewModel.TaskbarProgressValue;
|
|
set
|
|
{
|
|
_viewModel.TaskbarProgressValue = value;
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.TaskbarProgressValue));
|
|
}
|
|
}
|
|
|
|
public bool CancelEnabled
|
|
{
|
|
get => _viewModel.CancelEnabled;
|
|
set
|
|
{
|
|
_viewModel.CancelEnabled = value;
|
|
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelEnabled));
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.CancelButtonVisibility));
|
|
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.VersionTextVisibility));
|
|
_viewModel.OnPropertyChanged(nameof(_viewModel.VersionText));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
public ByfronDialog()
|
|
{
|
|
string version = Utilities.GetRobloxVersionStr(Bootstrapper?.IsStudioLaunch ?? false);
|
|
_viewModel = new ByfronDialogViewModel(this, version);
|
|
DataContext = _viewModel;
|
|
Title = App.Settings.Prop.BootstrapperTitle;
|
|
Icon = App.Settings.Prop.BootstrapperIcon.GetIcon().GetImageSource();
|
|
|
|
if (App.Settings.Prop.Theme.GetFinal() == Theme.Light)
|
|
{
|
|
// Matching the roblox website light theme as close as possible.
|
|
_viewModel.DialogBorder = new Thickness(1);
|
|
_viewModel.Background = new SolidColorBrush(Color.FromRgb(242, 244, 245));
|
|
_viewModel.Foreground = new SolidColorBrush(Color.FromRgb(57, 59, 61));
|
|
_viewModel.IconColor = new SolidColorBrush(Color.FromRgb(57, 59, 61));
|
|
_viewModel.ProgressBarBackground = new SolidColorBrush(Color.FromRgb(189, 190, 190));
|
|
_viewModel.ByfronLogoLocation = new BitmapImage(new Uri("pack://application:,,,/Resources/BootstrapperStyles/ByfronDialog/ByfronLogoLight.jpg"));
|
|
}
|
|
|
|
InitializeComponent();
|
|
}
|
|
private void Window_Closing(object sender, CancelEventArgs e)
|
|
{
|
|
if (!_isClosing)
|
|
Bootstrapper?.Cancel();
|
|
}
|
|
|
|
#region IBootstrapperDialog Methods
|
|
// Referencing FluentDialog
|
|
public void ShowBootstrapper() => this.ShowDialog();
|
|
|
|
public void CloseBootstrapper()
|
|
{
|
|
_isClosing = true;
|
|
Dispatcher.BeginInvoke(this.Close);
|
|
}
|
|
|
|
public void ShowSuccess(string message, Action? callback) => BaseFunctions.ShowSuccess(message, callback);
|
|
#endregion
|
|
}
|
|
}
|