progress
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
using Autofac.Extras.AggregateService;
|
using Autofac.Extras.AggregateService;
|
||||||
using JiraTimeBot.Ui.Models;
|
using JiraTimeBot.Ui.Models;
|
||||||
using JiraTimeBot.Ui.ViewModels;
|
using JiraTimeBot.Ui.ViewModels;
|
||||||
|
using JiraTimeBot.UI.Tray;
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace JiraTimeBot.Ui
|
namespace JiraTimeBot.Ui
|
||||||
@@ -12,16 +15,28 @@ namespace JiraTimeBot.Ui
|
|||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
private IContainer _container;
|
private IContainer _container;
|
||||||
|
|
||||||
|
private static readonly Mutex Mutex = new Mutex(true, "{5B245110-FD79-4EC9-AF86-A98F29792B9D}");
|
||||||
|
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
|
if (Mutex.WaitOne(TimeSpan.Zero, true))
|
||||||
|
{
|
||||||
|
Mutex.ReleaseMutex();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SingleInstance.ShowFirstInstance();
|
||||||
|
this.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
var builder = new ContainerBuilder();
|
var builder = new ContainerBuilder();
|
||||||
|
|
||||||
builder.Register<MainWindow>(c =>
|
builder.Register(c =>
|
||||||
{
|
{
|
||||||
var result = new MainWindow();
|
var result = new MainWindow();
|
||||||
result.DataContext = c.Resolve<ApplicationViewModel>();
|
result.DataContext = c.Resolve<ApplicationViewModel>();
|
||||||
|
|||||||
@@ -181,5 +181,11 @@
|
|||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\JiraTimeBot\JiraTimeBot.csproj">
|
||||||
|
<Project>{f3b89316-c38c-4ce6-9d88-0b1373cfba1a}</Project>
|
||||||
|
<Name>JiraTimeBot</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -4,7 +4,10 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:JiraTimeBot.Ui"
|
xmlns:local="clr-namespace:JiraTimeBot.Ui"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
d:DesignWidth="250"
|
||||||
|
d:DesignHeight="300"
|
||||||
>
|
>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -68,9 +71,17 @@
|
|||||||
<TextBox Grid.Row="7" Grid.Column="1" />
|
<TextBox Grid.Row="7" Grid.Column="1" />
|
||||||
|
|
||||||
<TextBlock Grid.Row="8" Grid.Column="0"
|
<TextBlock Grid.Row="8" Grid.Column="0"
|
||||||
Text="Время запуска" />
|
Text="Время запуска"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
<DatePicker Grid.Row="8" Grid.Column="1"/>
|
<xctk:DateTimePicker Grid.Row="8" Grid.Column="1"
|
||||||
|
Format="ShortTime"
|
||||||
|
ShowDropDownButton="False"
|
||||||
|
TimePickerAllowSpin="True"
|
||||||
|
TimePickerShowButtonSpinner="True"
|
||||||
|
TimePickerVisibility="Visible"
|
||||||
|
/>
|
||||||
<StackPanel Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="2"
|
<StackPanel Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="2"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
Orientation="Vertical"
|
Orientation="Vertical"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using JiraTimeBot.UI;
|
using JiraTimeBot.UI;
|
||||||
|
using JiraTimeBot.UI.Tray;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using JiraTimeBot.UI.Tray;
|
|
||||||
|
|
||||||
namespace JiraTimeBot
|
namespace JiraTimeBot
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace JiraTimeBot.UI.Tray
|
namespace JiraTimeBot.UI.Tray
|
||||||
{
|
{
|
||||||
static class SingleInstance
|
public static class SingleInstance
|
||||||
{
|
{
|
||||||
public static readonly int WM_SHOWFIRSTINSTANCE = RegisterWindowMessage($"WM_SHOWFIRSTINSTANCE|{AssemblyGuid}");
|
public static readonly int WM_SHOWFIRSTINSTANCE = RegisterWindowMessage($"WM_SHOWFIRSTINSTANCE|{AssemblyGuid}");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user