mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Add results to dialog
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ZuneModdingHelper"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
StartupUri="AppWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
@@ -18,6 +19,9 @@
|
||||
<FontFamily x:Key="SegoeMDL2">Segoe MDL2 Assets</FontFamily>
|
||||
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
|
||||
<sys:Boolean x:Key="FalseValue">False</sys:Boolean>
|
||||
<sys:Boolean x:Key="TrueValue">True</sys:Boolean>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
||||
@@ -33,21 +33,35 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Rectangle Height="5" Width="109" Margin="0,-16,0,0"
|
||||
<Rectangle Height="5" Width="109" Margin="0,-16,0,0" Grid.ColumnSpan="2"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Fill="{StaticResource ZuneHorizontalGradientAlt}"/>
|
||||
<TextBlock Text="{Binding Title}" d:Text="WINDOWS LIVE ID" FontSize="28" Margin="0,-10,0,12"
|
||||
Foreground="{StaticResource ZuneMediumTextBrush}"/>
|
||||
|
||||
<StackPanel Grid.Row="1">
|
||||
<StackPanel Grid.Row="1" Grid.ColumnSpan="2">
|
||||
<TextBlock Text="{Binding Description}" FontSize="14" TextWrapping="Wrap" Margin="0,0,0,12"
|
||||
Foreground="{StaticResource ZuneLightTextBrush}"/>
|
||||
<ContentControl x:Name="InnerPresenter" />
|
||||
</StackPanel>
|
||||
|
||||
<Button Content="OK" Grid.Row="2" HorizontalAlignment="Right"
|
||||
FontSize="12" Height="24" Visibility="{Binding ShowPrimaryButton, Converter={StaticResource BoolToVis}}"
|
||||
<Button Grid.Row="2" HorizontalAlignment="Right"
|
||||
FontSize="12" Height="24"
|
||||
Content="{Binding AffirmativeText}"
|
||||
Visibility="{Binding ShowAffirmativeButton, Converter={StaticResource BoolToVis}}"
|
||||
Command="{Binding OnAction}" CommandParameter="{StaticResource TrueValue}"
|
||||
Style="{StaticResource ActionButtonStyle}"/>
|
||||
|
||||
<Button Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right"
|
||||
FontSize="12" Height="24" Margin="12,0,0,0"
|
||||
Content="{Binding NegativeText}"
|
||||
Visibility="{Binding ShowNegativeButton, Converter={StaticResource BoolToVis}}"
|
||||
Command="{Binding OnAction}" CommandParameter="{StaticResource FalseValue}"
|
||||
Style="{StaticResource ActionButtonStyle}"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -60,6 +60,15 @@ namespace ZuneModdingHelper.Controls
|
||||
};
|
||||
progressBar.SetBinding(ProgressBar.IsIndeterminateProperty, progIndetBinding);
|
||||
|
||||
Binding maxValueBinding = new()
|
||||
{
|
||||
Source = vm,
|
||||
Path = new PropertyPath(nameof(ProgressDialogViewModel.Maximum)),
|
||||
Mode = BindingMode.OneWay,
|
||||
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
|
||||
};
|
||||
progressBar.SetBinding(ProgressBar.MaximumProperty, maxValueBinding);
|
||||
|
||||
dialog.InnerPresenter.Content = progressBar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
namespace ZuneModdingHelper.Messages;
|
||||
|
||||
@@ -10,15 +12,32 @@ public partial class DialogViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _title;
|
||||
|
||||
|
||||
[ObservableProperty]
|
||||
private string _description;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _showPrimaryButton = true;
|
||||
private bool _showAffirmativeButton = true;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _showNegativeButton = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _affirmativeText = "OK";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _negativeText = "CANCEL";
|
||||
|
||||
[ObservableProperty]
|
||||
private int? _height;
|
||||
|
||||
[ObservableProperty]
|
||||
private IAsyncRelayCommand<bool> _onAction = DefaultCloseCommand;
|
||||
|
||||
protected static IAsyncRelayCommand<bool> DefaultCloseCommand { get; } = new AsyncRelayCommand<bool>(_ =>
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send<CloseDialogMessage>();
|
||||
return System.Threading.Tasks.Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
||||
public partial class ProgressDialogViewModel : DialogViewModel
|
||||
@@ -26,6 +45,9 @@ public partial class ProgressDialogViewModel : DialogViewModel
|
||||
[ObservableProperty]
|
||||
private double _progress;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _maximum = 1.0;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isIndeterminate = true;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ZuneModdingHelper.Pages
|
||||
{
|
||||
Title = "RESET MOD",
|
||||
Description = $"Preparing to reset '{mod.Title}'...",
|
||||
ShowPrimaryButton = false,
|
||||
ShowAffirmativeButton = false,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user