Minimize to tray andd icon
This commit is contained in:
@@ -61,6 +61,8 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@@ -124,19 +126,12 @@
|
|||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Page Include="Views\Settings.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
<Page Include="Views\SettingsPage.xaml">
|
<Page Include="Views\SettingsPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Views\Settings.xaml.cs">
|
|
||||||
<DependentUpon>Settings.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Views\SettingsPage.xaml.cs">
|
<Compile Include="Views\SettingsPage.xaml.cs">
|
||||||
<DependentUpon>SettingsPage.xaml</DependentUpon>
|
<DependentUpon>SettingsPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -181,6 +176,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<SplashScreen Include="Splash.png" />
|
<SplashScreen Include="Splash.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Content Include="app.ico">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -9,7 +9,9 @@
|
|||||||
SizeToContent="WidthAndHeight"
|
SizeToContent="WidthAndHeight"
|
||||||
d:DataContext="{d:DesignInstance viewModels:ApplicationViewModel}"
|
d:DataContext="{d:DesignInstance viewModels:ApplicationViewModel}"
|
||||||
Title="ApplicationWindow"
|
Title="ApplicationWindow"
|
||||||
ShowInTaskbar="True" d:DesignWidth="517.579" d:DesignHeight="260.977"
|
Icon="../app.ico"
|
||||||
|
ShowInTaskbar="True"
|
||||||
|
d:DesignWidth="517.579" d:DesignHeight="260.977"
|
||||||
>
|
>
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<DataTemplate DataType="{x:Type viewModels:MainPageViewModel}">
|
<DataTemplate DataType="{x:Type viewModels:MainPageViewModel}">
|
||||||
|
|||||||
@@ -1,15 +1,38 @@
|
|||||||
namespace JiraTimeBot.Ui
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace JiraTimeBot.Ui
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for MainWindow.xaml
|
/// Interaction logic for MainWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow
|
public partial class MainWindow
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
NotifyIcon trayIcon = new System.Windows.Forms.NotifyIcon();
|
||||||
|
trayIcon.Icon = new Icon("app.ico");
|
||||||
|
trayIcon.Visible = true;
|
||||||
|
trayIcon.DoubleClick += (sender, args) =>
|
||||||
|
{
|
||||||
|
Show();
|
||||||
|
ShowInTaskbar = true;
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStateChanged(EventArgs e)
|
||||||
|
{
|
||||||
|
if (WindowState == WindowState.Minimized)
|
||||||
|
{
|
||||||
|
ShowInTaskbar = false;
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
base.OnStateChanged(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
<UserControl x:Class="JiraTimeBot.Ui.Settings"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:local="clr-namespace:JiraTimeBot.Ui"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Width="100"
|
|
||||||
Height="200">
|
|
||||||
<Grid>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</UserControl>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
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.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace JiraTimeBot.Ui
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for Settings.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class Settings : UserControl
|
|
||||||
{
|
|
||||||
public Settings()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
Reference in New Issue
Block a user