Added main page + started notify icon implementation.

This commit is contained in:
Patrick Fic
2020-01-16 14:37:05 -08:00
parent e34ffebf53
commit 0daf17a3f0
9 changed files with 166 additions and 9 deletions

View File

@@ -53,6 +53,9 @@
<ApplicationIcon>favicon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
@@ -99,6 +102,9 @@
<Compile Include="Utils\RelayCommand.cs" />
<Compile Include="ViewModels\LoginViewModel.commands.cs" />
<Compile Include="ViewModels\LoginViewModel.cs" />
<Compile Include="ViewModels\MainViewModel.commands.cs" />
<Compile Include="ViewModels\MainViewModel.cs" />
<Compile Include="ViewModels\MainViewModel.props.cs" />
<Compile Include="Views\Login.xaml.cs">
<DependentUpon>Login.xaml</DependentUpon>
</Compile>
@@ -106,10 +112,17 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Views\Main.xaml.cs">
<DependentUpon>Main.xaml</DependentUpon>
</Compile>
<Page Include="Views\Login.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\Main.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">

View File

@@ -5,18 +5,18 @@ namespace BodyshopUploader.ViewModels
{
public partial class LoginViewModel : BaseViewModel
{
private ICommand _testCommand;
public ICommand TestCommand
private ICommand _openMainCommand;
public ICommand OpenMainCommand
{
get
{
if (_testCommand == null)
if (_openMainCommand == null)
{
_testCommand = new RelayCommand(
_openMainCommand = new RelayCommand(
p => true,
p => Console.WriteLine("Hi"));
p => { Views.Main m = new Views.Main(); m.Show(); });
}
return _testCommand;
return _openMainCommand;
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Windows.Input;
namespace BodyshopUploader.ViewModels
{
public partial class MainViewModel : BaseViewModel
{
private ICommand _testCommand;
public ICommand TestCommand
{
get
{
if (_testCommand == null)
{
_testCommand = new RelayCommand(
p => true,
p =>
{
logger.Info("test command clicked");
});
}
return _testCommand;
}
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BodyshopUploader.ViewModels
{
public partial class MainViewModel:BaseViewModel
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public MainViewModel()
{
logger.Trace("Main VM Created.");
}
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BodyshopUploader.ViewModels
{
public partial class MainViewModel : BaseViewModel
{
private int _progress = 5;
public int Progress
{
get { return _progress; }
set { SetProperty(ref _progress, value); }
}
}
}

View File

@@ -6,14 +6,18 @@
xmlns:local="clr-namespace:BodyshopUploader.Views"
xmlns:vm="clr-namespace:BodyshopUploader.ViewModels"
mc:Ignorable="d"
Title="{x:Static p:Resources.Title_Login}" Height="450" Width="800"
xmlns:p = "clr-namespace:BodyshopUploader.Properties">
Title="{x:Static p:Resources.Title_Login}"
Height="450"
Width="800"
xmlns:p="clr-namespace:BodyshopUploader.Properties">
<Window.DataContext>
<vm:LoginViewModel />
</Window.DataContext>
<StackPanel>
<TextBlock Text="{x:Static p:Resources.Login}" />
<Button Command="{Binding OpenMainCommand}"
Content="{x:Static p:Resources.Login}" />
<TextBlock Text="{Binding Progress, TargetNullValue=QUE, FallbackValue=QUE2}" />
</StackPanel>
</Window>

View File

@@ -0,0 +1,46 @@
<Window x:Class="BodyshopUploader.Views.Main"
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:BodyshopUploader.Views"
mc:Ignorable="d"
Title="Main"
Height="450"
xmlns:vm="clr-namespace:BodyshopUploader.ViewModels"
Width="800"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:p="clr-namespace:BodyshopUploader.Properties">
<Window.DataContext>
<vm:MainViewModel />
</Window.DataContext>
<StackPanel>
<tb:TaskbarIcon IconSource="../favicon.ico"
PopupActivation="LeftClick"
MenuActivation="RightClick"
ToolTipText="Bodyshop Uploader">
<tb:TaskbarIcon.TrayPopup>
<Border Background="White"
BorderBrush="Orange"
BorderThickness="2"
Width="160"
Height="40">
<Button Content="Click Me!"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
</tb:TaskbarIcon.TrayPopup>
<tb:TaskbarIcon.ContextMenu>
<ContextMenu Background="LightCoral">
<MenuItem Header="First Menu Item" />
<MenuItem Header="Second Menu Item" />
</ContextMenu>
</tb:TaskbarIcon.ContextMenu>
</tb:TaskbarIcon>
<TextBlock>
Main Window
</TextBlock>
<TextBlock Text="{Binding Progress}" />
<Button Command="{Binding TestCommand}" />
</StackPanel>
</Window>

View File

@@ -0,0 +1,30 @@
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 BodyshopUploader.Views
{
/// <summary>
/// Interaction logic for Main.xaml
/// </summary>
public partial class Main : Window
{
public Main()
{
InitializeComponent();
}
}
}

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
<package id="NLog" version="4.6.8" targetFramework="net472" />
<package id="NLog.Config" version="4.6.8" targetFramework="net472" />