diff --git a/ClientApp/ClientApp.csproj b/ClientApp/ClientApp.csproj index d8da9bf..4194162 100644 --- a/ClientApp/ClientApp.csproj +++ b/ClientApp/ClientApp.csproj @@ -8,25 +8,25 @@ - - - - + + + + - - Always - - - Always - - - Always - - - Always - + + Always + + + Always + + + Always + + + Always + @@ -42,7 +42,7 @@ - + diff --git a/ClientApp/Images/Icons/CheckMark.png b/ClientApp/Images/Icons/CheckMark.png new file mode 100644 index 0000000..6bb2ed3 Binary files /dev/null and b/ClientApp/Images/Icons/CheckMark.png differ diff --git a/ClientApp/Images/Icons/CrossMark.png b/ClientApp/Images/Icons/CrossMark.png new file mode 100644 index 0000000..4a30bac Binary files /dev/null and b/ClientApp/Images/Icons/CrossMark.png differ diff --git a/ClientApp/ValueConverters/BoolToMarkConverter.cs b/ClientApp/ValueConverters/BoolToMarkConverter.cs new file mode 100644 index 0000000..ea03634 --- /dev/null +++ b/ClientApp/ValueConverters/BoolToMarkConverter.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Data; +using System.Windows.Media.Imaging; + +namespace ClientApp.ValueConverters +{ + //[ValueConversion(typeof(bool), typeof(BitmapImage))] + + class BoolToMarkConverter : IValueConverter + { + public BitmapImage TrueImage { get; set; } = new BitmapImage(new Uri("pack://application:,,,/Images/Icons/CheckMark.png")); + public BitmapImage FalseImage { get; set; } = new BitmapImage(new Uri("pack://application:,,,/Images/Icons/CrossMark.png")); + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (!(value is bool)) + { + return null; + } + + bool b = (bool)value; + if (b) + { + return this.TrueImage; + } + else + { + return this.FalseImage; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/ClientApp/ViewModels/LoginViewModel.cs b/ClientApp/ViewModels/LoginViewModel.cs index 1179ec2..7b9bfcf 100644 --- a/ClientApp/ViewModels/LoginViewModel.cs +++ b/ClientApp/ViewModels/LoginViewModel.cs @@ -20,14 +20,14 @@ namespace ClientApp.ViewModels public bool InvertedLoginStatus { get; set; } - private MainWindowViewModel mainWindowViewModel; + private MainWindowViewModel MainWindowViewModel; public LoginViewModel(MainWindowViewModel mainWindowViewModel) { - this.mainWindowViewModel = mainWindowViewModel; + this.MainWindowViewModel = mainWindowViewModel; LoginCommand = new RelayCommand((parameter) => { //TODO send username and password to server - this.mainWindowViewModel.client.tryLogin(Username, ((PasswordBox)parameter).Password); + this.MainWindowViewModel.client.tryLogin(Username, ((PasswordBox)parameter).Password); }); } @@ -35,11 +35,11 @@ namespace ClientApp.ViewModels internal void setLoginStatus(bool status) { - this.mainWindowViewModel.InfoModel.ConnectedToServer = status; + this.MainWindowViewModel.InfoModel.ConnectedToServer = status; this.InvertedLoginStatus = !status; if (status) { - this.mainWindowViewModel.SelectedViewModel = new MainViewModel(mainWindowViewModel); + this.MainWindowViewModel.SelectedViewModel = new MainViewModel(MainWindowViewModel); } } } diff --git a/ClientApp/ViewModels/MainWindowViewModel.cs b/ClientApp/ViewModels/MainWindowViewModel.cs index b5caccc..5bcc936 100644 --- a/ClientApp/ViewModels/MainWindowViewModel.cs +++ b/ClientApp/ViewModels/MainWindowViewModel.cs @@ -89,7 +89,7 @@ namespace ClientApp.ViewModels public int TitleHeight { get; set; } = 42; - public GridLength TitleHeightGridLegth { get { return new GridLength(TitleHeight + ResizeBorder); } } + public GridLength TitleHeightGridLength { get { return new GridLength(TitleHeight + ResizeBorder); } } #endregion diff --git a/ClientApp/Views/MainView.xaml b/ClientApp/Views/MainView.xaml index 4633a01..cb486f4 100644 --- a/ClientApp/Views/MainView.xaml +++ b/ClientApp/Views/MainView.xaml @@ -4,9 +4,13 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ClientApp.Views" + xmlns:converter="clr-namespace:ClientApp.ValueConverters" ShowsNavigationUI="False" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> + + + @@ -21,8 +25,9 @@ -