-
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.
WatchList.WPF - Add window "DataReplaceMessage" and change interface …
…app. (#97)
- Loading branch information
1 parent
2d9415f
commit d2a0699
Showing
13 changed files
with
185 additions
and
37 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
16 changes: 16 additions & 0 deletions
16
WatchList.WPF/Models/ModelDataLoad/DialogReplaceQuestionManager.cs
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,16 @@ | ||
using WatchList.Core.Model.QuestionResult; | ||
|
||
namespace WatchList.WPF.Models.ModelDataLoad | ||
{ | ||
public class DialogReplaceQuestionManager | ||
{ | ||
public DialogReplaceQuestionManager() | ||
{ | ||
} | ||
|
||
public DialogReplaceItemQuestion DialogReplaceItemQuestion { get; private set; } = DialogReplaceItemQuestion.Unknown; | ||
|
||
public void UpdateData(DialogReplaceItemQuestion dialogReplaceItemQuestion) | ||
=> DialogReplaceItemQuestion = dialogReplaceItemQuestion; | ||
} | ||
} |
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,58 @@ | ||
using System.Windows; | ||
using CommunityToolkit.Mvvm.Input; | ||
using WatchList.Core.Model.QuestionResult; | ||
using WatchList.WPF.Models.ModelDataLoad; | ||
|
||
namespace WatchList.WPF.ViewModel | ||
{ | ||
public class DataReplaceMessageViewModel | ||
{ | ||
public const string Question = "The append item is a duplicate.Replace element?"; | ||
|
||
private readonly string _titleLabel; | ||
|
||
public DataReplaceMessageViewModel(string titleItem, DialogReplaceQuestionManager questionResult) | ||
{ | ||
_titleLabel = titleItem; | ||
ResultQuestion = questionResult; | ||
} | ||
|
||
public string QuestionLabel => Question; | ||
public string TitleLabel => _titleLabel; | ||
|
||
public DialogReplaceQuestionManager ResultQuestion { get; private set; } | ||
|
||
public RelayCommand<Window> MoveYesCommand => new(MoveYesClick); | ||
public RelayCommand<Window> MoveAllYesCommand => new(MoveAllYesClick); | ||
public RelayCommand<Window> MoveNoCommand => new(MoveNoClick); | ||
public RelayCommand<Window> MoveAllNoCommand => new(MoveAllNoClick); | ||
|
||
private void MoveYesClick(Window window) | ||
{ | ||
ResultQuestion.UpdateData(DialogReplaceItemQuestion.Yes); | ||
window.DialogResult = true; | ||
window?.Close(); | ||
} | ||
|
||
private void MoveAllYesClick(Window window) | ||
{ | ||
ResultQuestion.UpdateData(DialogReplaceItemQuestion.AllYes); | ||
window.DialogResult = true; | ||
window?.Close(); | ||
} | ||
|
||
private void MoveNoClick(Window window) | ||
{ | ||
ResultQuestion.UpdateData(DialogReplaceItemQuestion.No); | ||
window.DialogResult = true; | ||
window?.Close(); | ||
} | ||
|
||
private void MoveAllNoClick(Window window) | ||
{ | ||
ResultQuestion.UpdateData(DialogReplaceItemQuestion.AllNo); | ||
window.DialogResult = true; | ||
window?.Close(); | ||
} | ||
} | ||
} |
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,73 @@ | ||
<mah:MetroWindow | ||
x:Name="ReplaceItemWindow" | ||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:WatchList.WPF.Views.Message" | ||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" x:Class="WatchList.WPF.Views.Message.DataReplaceMessageWindow" | ||
mc:Ignorable="d" | ||
Title="DataReplaceMessageWindow" Height="200" Width="600" | ||
ResizeMode="NoResize" | ||
DataContext="{Binding DataReplaceMessageViewModel, Source={StaticResource ViewModelLocator}}"> | ||
<Grid Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition/> | ||
<ColumnDefinition/> | ||
<ColumnDefinition/> | ||
<ColumnDefinition/> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition/> | ||
<RowDefinition/> | ||
<RowDefinition/> | ||
</Grid.RowDefinitions> | ||
<Label Grid.Row="0" | ||
Grid.Column="0" | ||
Grid.ColumnSpan="4" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Content = "{Binding QuestionLabel}"/> | ||
<Label Grid.Row="1" | ||
Grid.Column="0" | ||
Grid.ColumnSpan="4" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Content = "{Binding TitleLabel}"/> | ||
<StackPanel Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Center"> | ||
<ui:Button Content="Yes" | ||
HorizontalAlignment="Center" | ||
Margin="4,4,4,4" | ||
MinWidth="90" | ||
MinHeight="30" | ||
VerticalAlignment="Center" | ||
Command="{Binding MoveYesCommand}" | ||
CommandParameter="{Binding ElementName=ReplaceItemWindow}"/> | ||
<ui:Button Content="All Yes" | ||
HorizontalAlignment="Center" | ||
Margin="4,4,4,4" | ||
MinWidth="90" | ||
MinHeight="30" | ||
VerticalAlignment="Center" | ||
Command="{Binding MoveAllYesCommand}" | ||
CommandParameter="{Binding ElementName=ReplaceItemWindow}"/> | ||
<ui:Button Content="No" | ||
HorizontalAlignment="Center" | ||
Margin="4,4,4,4" | ||
MinWidth="90" | ||
MinHeight="30" | ||
VerticalAlignment="Center" | ||
Command="{Binding MoveNoCommand}" | ||
CommandParameter="{Binding ElementName=ReplaceItemWindow}"/> | ||
<ui:Button Content="All No" | ||
HorizontalAlignment="Center" | ||
Margin="4,4,4,4" | ||
MinWidth="90" | ||
MinHeight="30" | ||
VerticalAlignment="Center" | ||
Command="{Binding MoveAllNoCommand}" | ||
CommandParameter="{Binding ElementName=ReplaceItemWindow}"/> | ||
</StackPanel> | ||
</Grid> | ||
</mah:MetroWindow> |
17 changes: 17 additions & 0 deletions
17
WatchList.WPF/Views/Message/DataReplaceMessageWindow.xaml.cs
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,17 @@ | ||
using WatchList.WPF.Models.ModelDataLoad; | ||
using WatchList.WPF.ViewModel; | ||
|
||
namespace WatchList.WPF.Views.Message | ||
{ | ||
/// <summary> | ||
/// Interaction logic for DataReplaceMessageWindow.xaml | ||
/// </summary> | ||
public partial class DataReplaceMessageWindow | ||
{ | ||
public DataReplaceMessageWindow(string titleName, DialogReplaceQuestionManager replaceQuestionManager) | ||
{ | ||
InitializeComponent(); | ||
DataContext = new DataReplaceMessageViewModel(titleName, replaceQuestionManager); | ||
} | ||
} | ||
} |
20 changes: 9 additions & 11 deletions
20
WatchList.WPF/Views/MessageWindow.xaml.cs → WatchList.WPF/Views/Message/MessageWindow.cs
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 was deleted.
Oops, something went wrong.
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