mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
[WIP] Dialog
This commit is contained in:
@@ -119,6 +119,8 @@
|
|||||||
</b:ContentControlExtensions.ContentChangedAnimation>
|
</b:ContentControlExtensions.ContentChangedAnimation>
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
<ContentControl x:Name="DialogPresenter" Grid.RowSpan="3" Visibility="Collapsed" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
using System;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using ZuneModdingHelper.Controls;
|
||||||
|
using ZuneModdingHelper.Messages;
|
||||||
using ZuneModdingHelper.Pages;
|
using ZuneModdingHelper.Pages;
|
||||||
|
|
||||||
namespace ZuneModdingHelper
|
namespace ZuneModdingHelper
|
||||||
@@ -11,7 +14,7 @@ namespace ZuneModdingHelper
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for AppWindow.xaml
|
/// Interaction logic for AppWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class AppWindow
|
public partial class AppWindow : IRecipient<ShowDialogMessage>, IRecipient<CloseDialogMessage>
|
||||||
{
|
{
|
||||||
private IntPtr _windowHandle;
|
private IntPtr _windowHandle;
|
||||||
private int _selectedPivotIdx = -1;
|
private int _selectedPivotIdx = -1;
|
||||||
@@ -22,6 +25,9 @@ namespace ZuneModdingHelper
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Pivot.Loaded += Pivot_Loaded;
|
Pivot.Loaded += Pivot_Loaded;
|
||||||
|
|
||||||
|
WeakReferenceMessenger.Default.Register<ShowDialogMessage>(this);
|
||||||
|
WeakReferenceMessenger.Default.Register<CloseDialogMessage>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Pivot_Loaded(object sender, RoutedEventArgs e)
|
private void Pivot_Loaded(object sender, RoutedEventArgs e)
|
||||||
@@ -79,5 +85,20 @@ namespace ZuneModdingHelper
|
|||||||
|
|
||||||
ContentFrame.Content = Activator.CreateInstance(_pages[_selectedPivotIdx]);
|
ContentFrame.Content = Activator.CreateInstance(_pages[_selectedPivotIdx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IRecipient<ShowDialogMessage>.Receive(ShowDialogMessage message)
|
||||||
|
{
|
||||||
|
DialogPresenter.Content = new ZuneLightDialog
|
||||||
|
{
|
||||||
|
ViewModel = message.ViewModel
|
||||||
|
};
|
||||||
|
DialogPresenter.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IRecipient<CloseDialogMessage>.Receive(CloseDialogMessage message)
|
||||||
|
{
|
||||||
|
DialogPresenter.Visibility = Visibility.Collapsed;
|
||||||
|
DialogPresenter.Content = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:zmhc="clr-namespace:ZuneModdingHelper.Controls">
|
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="/Themes/Zune.xaml"/>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
|
<!-- TODO: Convert to UserControl -->
|
||||||
|
<Style TargetType="zmhc:ZuneLightDialog">
|
||||||
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="zmhc:ZuneLightDialog">
|
||||||
|
<Border Background="#AFFFFFFF">
|
||||||
|
<Border MaxHeight="408" MaxWidth="530" Padding="32">
|
||||||
|
<Border.Background>
|
||||||
|
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
|
||||||
|
<GradientStop Color="#FFFFFF" Offset="0"/>
|
||||||
|
<GradientStop Color="#F0F0F0" Offset="1"/>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Rectangle Height="5" Width="109" Margin="0,-16,0,0"
|
||||||
|
VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||||
|
Fill="{StaticResource ZuneHorizontalGradientAlt}"/>
|
||||||
|
<TextBlock Text="WINDOWS LIVE ID" FontSize="28" Margin="0,-10,0,0"
|
||||||
|
Foreground="{StaticResource ZuneMediumTextBrush}"/>
|
||||||
|
|
||||||
|
<ContentPresenter Grid.Row="1"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||||
|
|
||||||
|
<Button Content="CANCEL" Grid.Row="2" HorizontalAlignment="Right"
|
||||||
|
FontSize="12" Height="24"
|
||||||
|
Style="{StaticResource ActionButtonStyle}"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect Color="Black" Opacity="0.45" BlurRadius="8"
|
||||||
|
Direction="0" ShadowDepth="0"/>
|
||||||
|
</Border.Effect>
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using ZuneModdingHelper.Messages;
|
||||||
|
|
||||||
|
namespace ZuneModdingHelper.Controls;
|
||||||
|
|
||||||
|
public class ZuneLightDialog : ContentControl
|
||||||
|
{
|
||||||
|
static ZuneLightDialog()
|
||||||
|
{
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(ZuneLightDialog), new FrameworkPropertyMetadata(typeof(ZuneLightDialog)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogViewModel ViewModel
|
||||||
|
{
|
||||||
|
get => (DialogViewModel)GetValue(DialogViewModelProperty);
|
||||||
|
set => SetValue(DialogViewModelProperty, value);
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty DialogViewModelProperty = DependencyProperty.Register(
|
||||||
|
nameof(ViewModel), typeof(DialogViewModel), typeof(ZuneLightDialog), new PropertyMetadata(null));
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace ZuneModdingHelper.Messages;
|
||||||
|
|
||||||
|
public record ShowDialogMessage(DialogViewModel ViewModel);
|
||||||
|
public record CloseDialogMessage();
|
||||||
|
|
||||||
|
public partial class DialogViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _title;
|
||||||
|
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class ProgressDialogViewModel : DialogViewModel
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private double _progress;
|
||||||
|
}
|
||||||
@@ -35,9 +35,9 @@
|
|||||||
<!--<Image Source="D:\Repos\ZuneDev\ZuneShell.dll\ZuneShell\Resources\RCDATA\ATTENTION.PNG"
|
<!--<Image Source="D:\Repos\ZuneDev\ZuneShell.dll\ZuneShell\Resources\RCDATA\ATTENTION.PNG"
|
||||||
Width="17" Height="18" SnapsToDevicePixels="True"
|
Width="17" Height="18" SnapsToDevicePixels="True"
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Right"/>-->
|
VerticalAlignment="Center" HorizontalAlignment="Right"/>-->
|
||||||
<Button Content="RESET" Margin="0,0,8,0"
|
<Button Content="RESET" Margin="0,0,8,0" Click="ResetButton_Click"
|
||||||
Style="{StaticResource ActionButtonStyle}"/>
|
Style="{StaticResource ActionButtonStyle}"/>
|
||||||
<Button Content="APPLY"
|
<Button Content="APPLY" Click="ApplyButton_Click"
|
||||||
Style="{StaticResource ActionButtonStyle}"/>
|
Style="{StaticResource ActionButtonStyle}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Windows.Controls;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
using System.Windows.Controls;
|
||||||
using ZuneModCore;
|
using ZuneModCore;
|
||||||
|
using ZuneModdingHelper.Messages;
|
||||||
|
|
||||||
namespace ZuneModdingHelper.Pages
|
namespace ZuneModdingHelper.Pages
|
||||||
{
|
{
|
||||||
@@ -13,5 +15,21 @@ namespace ZuneModdingHelper.Pages
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ModList.ItemsSource = Mod.AvailableMods;
|
ModList.ItemsSource = Mod.AvailableMods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ResetButton_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
WeakReferenceMessenger.Default.Send(new ShowDialogMessage(new DialogViewModel
|
||||||
|
{
|
||||||
|
Title = "RESET"
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyButton_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
WeakReferenceMessenger.Default.Send(new ShowDialogMessage(new DialogViewModel
|
||||||
|
{
|
||||||
|
Title = "APPLY"
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,6 @@
|
|||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="/Controls/PathButton.xaml"/>
|
<ResourceDictionary Source="/Controls/PathButton.xaml"/>
|
||||||
<ResourceDictionary Source="/Controls/TextButton.xaml"/>
|
<ResourceDictionary Source="/Controls/TextButton.xaml"/>
|
||||||
|
<ResourceDictionary Source="/Controls/ZuneLightDialog.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
<Color x:Key="ZunePink">#F10DA1</Color>
|
<Color x:Key="ZunePink">#F10DA1</Color>
|
||||||
<Color x:Key="ZuneOrange">#E95214</Color>
|
<Color x:Key="ZuneOrange">#E95214</Color>
|
||||||
|
|
||||||
|
<Color x:Key="ZunePinkAlt">#EC0D91</Color>
|
||||||
|
<Color x:Key="ZuneOrangeAlt">#F8A347</Color>
|
||||||
|
|
||||||
<SolidColorBrush x:Key="ZuneMediumTextBrush" Color="#3C3C3C"/>
|
<SolidColorBrush x:Key="ZuneMediumTextBrush" Color="#3C3C3C"/>
|
||||||
<SolidColorBrush x:Key="ZuneLightTextBrush" Color="#868686"/>
|
<SolidColorBrush x:Key="ZuneLightTextBrush" Color="#868686"/>
|
||||||
<SolidColorBrush x:Key="ZuneExtraLightTextBrush" Color="#B4B4B4"/>
|
<SolidColorBrush x:Key="ZuneExtraLightTextBrush" Color="#B4B4B4"/>
|
||||||
@@ -21,6 +24,13 @@
|
|||||||
<GradientStop Color="{StaticResource ZunePink}" Offset="1"/>
|
<GradientStop Color="{StaticResource ZunePink}" Offset="1"/>
|
||||||
</LinearGradientBrush.GradientStops>
|
</LinearGradientBrush.GradientStops>
|
||||||
</LinearGradientBrush>
|
</LinearGradientBrush>
|
||||||
|
|
||||||
|
<LinearGradientBrush x:Key="ZuneHorizontalGradientAlt" EndPoint="1,0" StartPoint="0,0">
|
||||||
|
<LinearGradientBrush.GradientStops>
|
||||||
|
<GradientStop Color="{StaticResource ZuneOrangeAlt}" Offset="0"/>
|
||||||
|
<GradientStop Color="{StaticResource ZunePinkAlt}" Offset="1"/>
|
||||||
|
</LinearGradientBrush.GradientStops>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
|
||||||
<Style x:Key="ZuneTextBlock" TargetType="TextBlock">
|
<Style x:Key="ZuneTextBlock" TargetType="TextBlock">
|
||||||
<Setter Property="FontFamily" Value="Segoe UI"/>
|
<Setter Property="FontFamily" Value="Segoe UI"/>
|
||||||
@@ -54,6 +64,7 @@
|
|||||||
</LinearGradientBrush>
|
</LinearGradientBrush>
|
||||||
</Style.Resources>
|
</Style.Resources>
|
||||||
|
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource ZuneMediumTextBrush}"/>
|
||||||
<Setter Property="FontWeight" Value="Bold"/>
|
<Setter Property="FontWeight" Value="Bold"/>
|
||||||
<Setter Property="FontSize" Value="10"/>
|
<Setter Property="FontSize" Value="10"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
|
|||||||
Reference in New Issue
Block a user