Develop #10
@@ -8,25 +8,25 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Images\CoolBackground.jpg" />
|
||||
<None Remove="Images\Logo\icon1.ico" />
|
||||
<None Remove="Images\re15.jpg" />
|
||||
<None Remove="Images\stone.png" />
|
||||
<None Remove="Images\CoolBackground.jpg" />
|
||||
<None Remove="Images\Logo\icon1.ico" />
|
||||
<None Remove="Images\re15.jpg" />
|
||||
<None Remove="Images\stone.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Images\CoolBackground.jpg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\Logo\icon1.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\re15.jpg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\stone.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\CoolBackground.jpg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\Logo\icon1.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\re15.jpg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\stone.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -42,7 +42,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\Hashing\Hashing.projitems" Label="Shared" />
|
||||
|
||||
BIN
ClientApp/Images/Icons/CheckMark.png
Normal file
BIN
ClientApp/Images/Icons/CheckMark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
ClientApp/Images/Icons/CrossMark.png
Normal file
BIN
ClientApp/Images/Icons/CrossMark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
39
ClientApp/ValueConverters/BoolToMarkConverter.cs
Normal file
39
ClientApp/ValueConverters/BoolToMarkConverter.cs
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<object>((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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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">
|
||||
<Page.Resources>
|
||||
<converter:BoolToMarkConverter x:Key="BoolToMarkConverter"/>
|
||||
</Page.Resources>
|
||||
<DockPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -21,8 +25,9 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0" Grid.Row="0" Orientation="Horizontal" Margin="10">
|
||||
<Label Content="Connected to server:"/>
|
||||
<Label Content="true"/>
|
||||
<Label Content="Connected to server:"/>
|
||||
<Label Content="{Binding Path=MainWindowViewModel.InfoModel.ConnectedToServer}"/>
|
||||
<Image Source="{Binding Path=MainWindowViewModel.InfoModel.ConnectedToServer, Converter={StaticResource BoolToMarkConverter}}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1" Grid.Row="0" Orientation="Horizontal" Margin="10">
|
||||
|
||||
Reference in New Issue
Block a user