From 6bec8f1651ef79dbd600e6a0c38c5dc1032b079a Mon Sep 17 00:00:00 2001 From: shinichi Date: Wed, 14 Oct 2020 14:35:02 +0200 Subject: [PATCH] wip --- ClientApp/App.xaml | 24 ++++---- ClientApp/ClientApp.csproj | 18 ++++++ ClientApp/Styles/Buttons.xaml | 43 +++++++++++++++ ClientApp/Styles/Colors.xaml | 4 ++ ClientApp/Styles/Texts.xaml | 6 ++ ClientApp/ViewModels/MainWindowViewModel.cs | 36 ++++++++++++ ClientApp/Views/LoginView.xaml | 8 +-- ClientApp/Views/MainWindow.xaml | 61 ++++++++++++++++++--- 8 files changed, 177 insertions(+), 23 deletions(-) diff --git a/ClientApp/App.xaml b/ClientApp/App.xaml index 98442cf..61cadcc 100644 --- a/ClientApp/App.xaml +++ b/ClientApp/App.xaml @@ -6,22 +6,24 @@ xmlns:views="clr-namespace:ClientApp.Views" StartupUri="Views/MainWindow.xaml"> - - - - - - - - + + + + + + + + + + - + - + + diff --git a/ClientApp/ClientApp.csproj b/ClientApp/ClientApp.csproj index 0adf26c..e60c9f4 100644 --- a/ClientApp/ClientApp.csproj +++ b/ClientApp/ClientApp.csproj @@ -7,6 +7,24 @@ + + + + + + + + + Always + + + Always + + + Always + + + diff --git a/ClientApp/Styles/Buttons.xaml b/ClientApp/Styles/Buttons.xaml index 6593716..c951dd8 100644 --- a/ClientApp/Styles/Buttons.xaml +++ b/ClientApp/Styles/Buttons.xaml @@ -19,4 +19,47 @@ + + + + + + \ No newline at end of file diff --git a/ClientApp/Styles/Colors.xaml b/ClientApp/Styles/Colors.xaml index 3fa8d23..8e4f8ef 100644 --- a/ClientApp/Styles/Colors.xaml +++ b/ClientApp/Styles/Colors.xaml @@ -9,6 +9,9 @@ #fafafa + #d7d7d7 + + #686868 @@ -18,4 +21,5 @@ #fff + \ No newline at end of file diff --git a/ClientApp/Styles/Texts.xaml b/ClientApp/Styles/Texts.xaml index b0e7544..4fdba93 100644 --- a/ClientApp/Styles/Texts.xaml +++ b/ClientApp/Styles/Texts.xaml @@ -2,4 +2,10 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ClientApp"> + \ No newline at end of file diff --git a/ClientApp/ViewModels/MainWindowViewModel.cs b/ClientApp/ViewModels/MainWindowViewModel.cs index b4251b1..e2eb00c 100644 --- a/ClientApp/ViewModels/MainWindowViewModel.cs +++ b/ClientApp/ViewModels/MainWindowViewModel.cs @@ -1,9 +1,12 @@ using ClientApp.Models; using ClientApp.Utils; +using GalaSoft.MvvmLight.Command; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Text; using System.Windows; +using System.Windows.Input; namespace ClientApp.ViewModels { @@ -18,6 +21,18 @@ namespace ClientApp.ViewModels #endregion + #region commands + + public ICommand MinimizeCommand { get; set; } + + public ICommand MaximizeCommand { get; set; } + + public ICommand CloseCommand { get; set; } + + public ICommand MenuCommand { get; set; } + + #endregion + #region public properties public Info InfoModel { get; set; } @@ -28,6 +43,11 @@ namespace ClientApp.ViewModels /// /// size of the resize border around the window /// + + public double MinimumWidth { get; set; } = 250; + + public double MinimumHeight { get; set; } = 250; + public int ResizeBorder { get; set; } = 6; public Thickness ResizeBorderThickness { get { return new Thickness(ResizeBorder + OuterMarginSize); } } @@ -84,7 +104,23 @@ namespace ClientApp.ViewModels LoginViewModel loginViewModel = new LoginViewModel(this); SelectedViewModel = loginViewModel; this.client.SetLoginViewModel(loginViewModel); + + this.MinimizeCommand = new RelayCommand(() => this.mWindow.WindowState = WindowState.Minimized); + this.MaximizeCommand = new RelayCommand(() => this.mWindow.WindowState ^= WindowState.Maximized); + this.CloseCommand = new RelayCommand(() => this.mWindow.Close()); + this.MenuCommand = new RelayCommand(() => SystemCommands.ShowSystemMenu(this.mWindow, GetMousePosition())); } + + #region helper + + private Point GetMousePosition() + { + Debug.WriteLine("getmousePosition called"); + var p = Mouse.GetPosition(this.mWindow); + return new Point(p.X + this.mWindow.Left, p.Y + this.mWindow.Top); + } + + #endregion } } diff --git a/ClientApp/Views/LoginView.xaml b/ClientApp/Views/LoginView.xaml index 472674d..0bad787 100644 --- a/ClientApp/Views/LoginView.xaml +++ b/ClientApp/Views/LoginView.xaml @@ -7,10 +7,10 @@ xmlns:viewModels="clr-namespace:ClientApp.ViewModels" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> - - + + + +