Cleanup views

pull/17/head
Alexey Golub 7 years ago
parent 705e60c76d
commit 6709821324

@ -2,24 +2,24 @@
UserControl "DiscordChatExporter.Views.ErrorDialog" { UserControl "DiscordChatExporter.Views.ErrorDialog" {
DataContext: bind ErrorViewModel from $resource Container DataContext: bind ErrorViewModel from $resource Container
Width: 250 Width: 250
StackPanel { StackPanel {
// Message // Message
TextBlock { TextBlock {
Margin: 16 Margin: 16
FontSize: 16 FontSize: 16
TextWrapping: WrapWithOverflow TextWrapping: WrapWithOverflow
Text: bind Message Text: bind Message
} }
// OK // OK
Button { Button {
Margin: 8 Margin: 8
Command: DialogHost.CloseDialogCommand Command: DialogHost.CloseDialogCommand
Content: "OK" Content: "OK"
HorizontalAlignment: Right HorizontalAlignment: Right
Style: resource dyn "MaterialDesignFlatButton" Style: resource dyn "MaterialDesignFlatButton"
}
} }
}
} }

@ -8,7 +8,7 @@ UserControl "DiscordChatExporter.Views.ExportSetupDialog" {
StackPanel { StackPanel {
// File path // File path
TextBox { TextBox {
Margin: "16 16 16 8" Margin: [16, 16, 16, 8]
HintAssist.Hint: "Output file" HintAssist.Hint: "Output file"
HintAssist.IsFloating: true HintAssist.IsFloating: true
IsReadOnly: true IsReadOnly: true
@ -18,18 +18,19 @@ UserControl "DiscordChatExporter.Views.ExportSetupDialog" {
// Format // Format
ComboBox { ComboBox {
Margin: "16 8 16 8" Margin: [16, 8, 16, 8]
HintAssist.Hint: "Export format" HintAssist.Hint: "Export format"
HintAssist.IsFloating: true HintAssist.IsFloating: true
IsReadOnly: true IsReadOnly: true
ItemsSource: bind AvailableFormats ItemsSource: bind AvailableFormats
SelectedItem: bind SelectedFormat
ItemTemplate: DataTemplate { ItemTemplate: DataTemplate {
TextBlock { TextBlock {
Text: bind Text: bind
convert (ExportFormat f) => Extensions.GetDisplayName(f) convert (ExportFormat f) => Extensions.GetDisplayName(f)
} }
} }
SelectedItem: bind SelectedFormat
} }
// Date range // Date range
@ -37,16 +38,16 @@ UserControl "DiscordChatExporter.Views.ExportSetupDialog" {
#TwoColumns("*", "*") #TwoColumns("*", "*")
DatePicker { DatePicker {
Grid.Column: 0 #Cell(0, 0)
Margin: "16 20 8 8" Margin: [16, 20, 8, 8]
HintAssist.Hint: "From (optional)" HintAssist.Hint: "From (optional)"
HintAssist.IsFloating: true HintAssist.IsFloating: true
SelectedDate: bind From SelectedDate: bind From
} }
DatePicker { DatePicker {
Grid.Column: 1 #Cell(0, 1)
Margin: "8 20 16 8" Margin: [8, 20, 16, 8]
HintAssist.Hint: "To (optional)" HintAssist.Hint: "To (optional)"
HintAssist.IsFloating: true HintAssist.IsFloating: true
SelectedDate: bind To SelectedDate: bind To
@ -59,26 +60,27 @@ UserControl "DiscordChatExporter.Views.ExportSetupDialog" {
// Browse // Browse
Button "BrowseButton" { Button "BrowseButton" {
Margin: 8
Click: BrowseButton_Click Click: BrowseButton_Click
Content: "BROWSE" Content: "BROWSE"
Margin: 8
Style: resource dyn "MaterialDesignFlatButton" Style: resource dyn "MaterialDesignFlatButton"
} }
// Export // Export
Button "ExportButton" { Button "ExportButton" {
Margin: 8
Click: ExportButton_Click Click: ExportButton_Click
Command: bind ExportCommand Command: bind ExportCommand
Content: "EXPORT" Content: "EXPORT"
Margin: 8 IsDefault: true
Style: resource dyn "MaterialDesignFlatButton" Style: resource dyn "MaterialDesignFlatButton"
} }
// Cancel // Cancel
Button { Button {
Margin: 8
Command: DialogHost.CloseDialogCommand Command: DialogHost.CloseDialogCommand
Content: "CANCEL" Content: "CANCEL"
Margin: 8
Style: resource dyn "MaterialDesignFlatButton" Style: resource dyn "MaterialDesignFlatButton"
} }
} }

@ -33,32 +33,32 @@ Window "DiscordChatExporter.Views.MainWindow" {
#TwoColumns("*", "Auto") #TwoColumns("*", "Auto")
Card { Card {
Grid.Column: 0 #Cell(0, 0)
Margin: "6 6 0 6" Margin: [6, 6, 0, 6]
Grid { Grid {
#TwoColumns("*", "Auto") #TwoColumns("*", "Auto")
// Token // Token
TextBox "TokenTextBox" { TextBox "TokenTextBox" {
Grid.Column: 0 #Cell(0, 0)
Margin: 6 Margin: 6
BorderThickness: 0 BorderThickness: 0
HintAssist.Hint: "Token" HintAssist.Hint: "Token"
KeyDown: TokenTextBox_KeyDown
FontSize: 16 FontSize: 16
Text: bind Token Text: bind Token
set [ UpdateSourceTrigger: PropertyChanged ] set [ UpdateSourceTrigger: PropertyChanged ]
TextFieldAssist.DecorationVisibility: Hidden TextFieldAssist.DecorationVisibility: Hidden
TextFieldAssist.TextBoxViewMargin: "0 0 2 0" TextFieldAssist.TextBoxViewMargin: [0, 0, 2, 0]
} }
// Submit // Submit
Button { Button {
Grid.Column: 1 #Cell(0, 1)
Margin: "0 6 6 6" Margin: [0, 6, 6, 6]
Padding: 4 Padding: 4
Command: bind PullDataCommand Command: bind PullDataCommand
IsDefault: true
Style: resource dyn "MaterialDesignFlatButton" Style: resource dyn "MaterialDesignFlatButton"
PackIcon { PackIcon {
@ -72,7 +72,7 @@ Window "DiscordChatExporter.Views.MainWindow" {
// Popup menu // Popup menu
PopupBox { PopupBox {
Grid.Column: 1 #Cell(0, 1)
Foreground: resource dyn "PrimaryHueMidForegroundBrush" Foreground: resource dyn "PrimaryHueMidForegroundBrush"
PlacementMode: LeftAndAlignTopEdges PlacementMode: LeftAndAlignTopEdges
@ -122,7 +122,7 @@ Window "DiscordChatExporter.Views.MainWindow" {
TransitioningContent { TransitioningContent {
OpeningEffect: TransitionEffect { OpeningEffect: TransitionEffect {
Duration: "0:0:0.3" Duration: "0:0:0.3"
Kind: SlideInFromRight Kind: SlideInFromLeft
} }
Border { Border {
@ -131,9 +131,11 @@ Window "DiscordChatExporter.Views.MainWindow" {
Cursor: CursorType.Hand Cursor: CursorType.Hand
Image { Image {
Margin: "12 4 12 4" Margin: [12, 4, 12, 4]
Width: 48 Width: 48
Height: 48 Height: 48
Source: bind IconUrl
ToolTip: bind Name
OpacityMask: RadialGradientBrush { OpacityMask: RadialGradientBrush {
GradientStops: [ GradientStops: [
GradientStop { Color: "#FF000000", Offset: 0 } GradientStop { Color: "#FF000000", Offset: 0 }
@ -141,8 +143,6 @@ Window "DiscordChatExporter.Views.MainWindow" {
GradientStop { Color: "#00000000", Offset: 1 } GradientStop { Color: "#00000000", Offset: 1 }
] ]
} }
Source: bind IconUrl
ToolTip: bind Name
} }
} }
} }
@ -177,12 +177,12 @@ Window "DiscordChatExporter.Views.MainWindow" {
] ]
PackIcon { PackIcon {
Margin: "16 7 0 6" Margin: [16, 7, 0, 6]
Kind: PackIconKind.Pound Kind: PackIconKind.Pound
VerticalAlignment: Center VerticalAlignment: Center
} }
TextBlock { TextBlock {
Margin: "3 8 8 8" Margin: [3, 8, 8, 8]
FontSize: 14 FontSize: 14
Text: bind Name Text: bind Name
VerticalAlignment: Center VerticalAlignment: Center
@ -196,7 +196,7 @@ Window "DiscordChatExporter.Views.MainWindow" {
// Content placeholder // Content placeholder
StackPanel { StackPanel {
Margin: "32 32 8 8" Margin: [32, 32, 8, 8]
Visibility: bind IsDataAvailable Visibility: bind IsDataAvailable
convert (bool b) => b ? Visibility.Hidden : Visibility.Visible convert (bool b) => b ? Visibility.Hidden : Visibility.Visible
@ -206,13 +206,13 @@ Window "DiscordChatExporter.Views.MainWindow" {
} }
TextBlock { TextBlock {
Margin: "0 8 0 0" Margin: [0, 8, 0, 0]
FontSize: 16 FontSize: 16
Text: "To obtain it, follow these steps:" Text: "To obtain it, follow these steps:"
} }
TextBlock { TextBlock {
Margin: "8 0 0 0" Margin: [8, 0, 0, 0]
FontSize: 14 FontSize: 14
Run { Run {

@ -1,7 +1,5 @@
using System.Reflection; using System.Reflection;
using System.Windows.Input;
using DiscordChatExporter.Messages; using DiscordChatExporter.Messages;
using DiscordChatExporter.ViewModels;
using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Messaging;
using MaterialDesignThemes.Wpf; using MaterialDesignThemes.Wpf;
using Tyrrrz.Extensions; using Tyrrrz.Extensions;
@ -10,26 +8,20 @@ namespace DiscordChatExporter.Views
{ {
public partial class MainWindow public partial class MainWindow
{ {
private IMainViewModel ViewModel => (IMainViewModel) DataContext;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
Title += $" v{Assembly.GetExecutingAssembly().GetName().Version}"; Title += $" v{Assembly.GetExecutingAssembly().GetName().Version}";
Messenger.Default.Register<ShowErrorMessage>(this, m => DialogHost.Show(new ErrorDialog()).Forget()); // Dialogs
Messenger.Default.Register<ShowExportDoneMessage>(this, m => DialogHost.Show(new ExportDoneDialog()).Forget()); Messenger.Default.Register<ShowErrorMessage>(this,
Messenger.Default.Register<ShowExportSetupMessage>(this, m => DialogHost.Show(new ExportSetupDialog()).Forget()); m => DialogHost.Show(new ErrorDialog()).Forget());
Messenger.Default.Register<ShowSettingsMessage>(this, m => DialogHost.Show(new SettingsDialog()).Forget()); Messenger.Default.Register<ShowExportDoneMessage>(this,
} m => DialogHost.Show(new ExportDoneDialog()).Forget());
Messenger.Default.Register<ShowExportSetupMessage>(this,
public void TokenTextBox_KeyDown(object sender, KeyEventArgs e) m => DialogHost.Show(new ExportSetupDialog()).Forget());
{ Messenger.Default.Register<ShowSettingsMessage>(this,
if (e.Key == Key.Enter) m => DialogHost.Show(new SettingsDialog()).Forget());
{
// Execute command
ViewModel.PullDataCommand.Execute(null);
}
} }
} }
} }

@ -7,7 +7,7 @@ UserControl "DiscordChatExporter.Views.SettingsDialog" {
StackPanel { StackPanel {
// Date format // Date format
TextBox { TextBox {
Margin: "16 16 16 8" Margin: [16, 16, 16, 8]
HintAssist.Hint: "Date format" HintAssist.Hint: "Date format"
HintAssist.IsFloating: true HintAssist.IsFloating: true
Text: bind DateFormat Text: bind DateFormat
@ -15,7 +15,7 @@ UserControl "DiscordChatExporter.Views.SettingsDialog" {
// Group limit // Group limit
TextBox { TextBox {
Margin: "16 8 16 8" Margin: [16, 8, 16, 8]
HintAssist.Hint: "Message group limit" HintAssist.Hint: "Message group limit"
HintAssist.IsFloating: true HintAssist.IsFloating: true
Text: bind MessageGroupLimit Text: bind MessageGroupLimit

Loading…
Cancel
Save