-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ A bit of deisgn change for MessageDialog too
- Loading branch information
1 parent
96bbe11
commit 23e8fe7
Showing
8 changed files
with
206 additions
and
33 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
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,87 @@ | ||
using RudeFox.Models; | ||
using RudeFox.Mvvm; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace RudeFox.ViewModels | ||
{ | ||
class ErrorDialogVM : BindableBase | ||
{ | ||
#region Contructor | ||
public ErrorDialogVM(string title, string message, Exception exception) | ||
{ | ||
Title = title; | ||
Message = message; | ||
MessageIcon = MessageIcon.Error; | ||
Details = GetExceptionInfo(exception); | ||
OkButton = "Okay"; | ||
} | ||
#endregion | ||
|
||
#region Properties | ||
private string _title; | ||
public string Title | ||
{ | ||
get { return _title; } | ||
set { SetProperty(ref _title, value); } | ||
} | ||
|
||
private string _details; | ||
public string Details | ||
{ | ||
get { return _details; } | ||
set { SetProperty(ref _details, value); } | ||
} | ||
|
||
private string _message; | ||
public string Message | ||
{ | ||
get { return _message; } | ||
set { SetProperty(ref _message, value); } | ||
} | ||
|
||
private string _okButton; | ||
public string OkButton | ||
{ | ||
get { return _okButton; } | ||
set { SetProperty(ref _okButton, value); } | ||
} | ||
|
||
private MessageIcon _messageIcon; | ||
public MessageIcon MessageIcon | ||
{ | ||
get { return _messageIcon; } | ||
set | ||
{ | ||
if (SetProperty(ref _messageIcon, value)) | ||
RaisePropertyChanged(nameof(Icon)); | ||
} | ||
} | ||
|
||
public string Icon | ||
{ | ||
get { return "/Images/" + MessageIcon.ToString().ToLower() + ".png"; } | ||
} | ||
#endregion | ||
|
||
#region Private Methods | ||
private string GetExceptionInfo(Exception e) | ||
{ | ||
string info = string.Empty; | ||
info += e.ToString(); | ||
|
||
if (e.InnerException != null) | ||
{ | ||
info += "\n\n"; | ||
info += "========== Inner Exception ========= \n"; | ||
info += GetExceptionInfo(e.InnerException); | ||
} | ||
|
||
return info; | ||
} | ||
#endregion | ||
} | ||
} |
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,41 @@ | ||
<Window x:Class="RudeFox.Views.ErrorDialog" | ||
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:RudeFox.Views" | ||
xmlns:controls="clr-namespace:RudeFox.Controls" | ||
mc:Ignorable="d" | ||
WindowStartupLocation="CenterScreen" ResizeMode="NoResize" | ||
Icon="/Images/icon_24.png" | ||
Title="{Binding Title}" MinWidth="350" MinHeight="120" MaxHeight="350" MaxWidth="450" | ||
SizeToContent="WidthAndHeight" Loaded="Window_Loaded" SnapsToDevicePixels="True"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="48" /> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="72"/> | ||
<ColumnDefinition /> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Image VerticalAlignment="Center" Width="32" HorizontalAlignment="Center" Source="{Binding Icon}" /> | ||
<ScrollViewer Grid.Column="1" Margin="10" VerticalAlignment="Center" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> | ||
<TextBlock x:Name="txtMessage" FontSize="14" Text="{Binding Message}" TextWrapping="Wrap" /> | ||
</ScrollViewer> | ||
|
||
<Expander Padding="5" FontWeight="SemiBold" Margin="0, 3" Header="Details" Grid.Row="1" Grid.Column="1"> | ||
<Grid Background="#FFE9ECEE"> | ||
<TextBox Text="{Binding Details}" VerticalScrollBarVisibility="Auto" MaxHeight="100" FontWeight="Normal" BorderThickness="0" IsReadOnly="True" Background="Transparent" TextWrapping="Wrap"/> | ||
</Grid> | ||
</Expander> | ||
|
||
<Grid Background="#efefef" Grid.ColumnSpan="2" Grid.Row="2"> | ||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | ||
<controls:FlatButton x:Name="okButton" Content="{Binding OkButton}" Margin="10,0,0,0" Padding="10,5" TabIndex="0" Click="okButton_Click" IsCancel="True"/> | ||
</StackPanel> | ||
</Grid> | ||
</Grid> | ||
</Window> |
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,39 @@ | ||
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.Shapes; | ||
|
||
namespace RudeFox.Views | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ErrorDialog.xaml | ||
/// </summary> | ||
public partial class ErrorDialog : Window | ||
{ | ||
public ErrorDialog() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void Window_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
okButton.Focus(); | ||
} | ||
|
||
private void okButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
DialogResult = true; | ||
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