worktimehero

git clone https://git.clttr.info/worktimehero.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 61ba7cc813eb4e59caf32a346d310d17fb18af9a
parent a3fc84ad6b265932be06d2074782bc08121cadf2
Author: rwa <apollo@rw-net.de>
Date:   Sat,  8 Sep 2018 21:02:36 +0200

resolves #1

Diffstat:
A.gitignore | 13+++++++++++++
AWorkTimeHero.vssscc | 10++++++++++
MWorkTimeHero/MainForm.cs | 6+++---
MWorkTimeHero/Program.cs | 37++++++++++++++++++++++++++++++++++---
DWorkTimeHero/Properties/vssver2.scc | 0
MWorkTimeHero/WorkTimeHero.csproj | 5+++--
AWorkTimeHero/vssver2.scc | 0
DWorkTimeHeroTest/Properties/vssver2.scc | 0
AWorkTimeHeroTest/vssver2.scc | 0
Avssver2.scc | 0
10 files changed, 63 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,13 @@ +/WorkTimeHero/bin/Debug/WorkTimeHero.exe +/WorkTimeHero/bin/Debug/WorkTimeHero.exe.config +/WorkTimeHero/bin/Debug/WorkTimeHero.pdb +/WorkTimeHero/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs +/WorkTimeHero/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs +/WorkTimeHero/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs +/WorkTimeHero/obj/Debug/WorkTimeHero.csproj.FileListAbsolute.txt +/WorkTimeHero/obj/Debug/WorkTimeHero.csproj.GenerateResource.Cache +/WorkTimeHero/obj/Debug/WorkTimeHero.csprojResolveAssemblyReference.cache +/WorkTimeHero/obj/Debug/WorkTimeHero.exe +/WorkTimeHero/obj/Debug/WorkTimeHero.MainForm.resources +/WorkTimeHero/obj/Debug/WorkTimeHero.pdb +/WorkTimeHero/obj/Debug/WorkTimeHero.Properties.Resources.resources diff --git a/WorkTimeHero.vssscc b/WorkTimeHero.vssscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" +} diff --git a/WorkTimeHero/MainForm.cs b/WorkTimeHero/MainForm.cs @@ -38,7 +38,7 @@ namespace WorkTimeHero string toolTipInfo = string.Empty; if (wtc.AdditionalWorkTime.TotalMinutes > 0) { - toolTipInfo = $"{wtc.AdditionalWorkTime.ToString(TimeFormatter)} Überstunden"; + toolTipInfo = wtc.AdditionalWorkTime.ToString(TimeFormatter) + " Überstunden"; if (!wtc.NotificationShown) { ntiWorkTimeHero.ShowBalloonTip(10, "Fertig!", "Sollzeit für heute erreicht!", ToolTipIcon.Info); @@ -47,10 +47,10 @@ namespace WorkTimeHero } else { - toolTipInfo = $"{wtc.WorkTimePercentage}% - noch {wtc.RemainingWorkTime.ToString(TimeFormatter)} Stunden"; + toolTipInfo = wtc.WorkTimePercentage + "% - noch " + wtc.RemainingWorkTime.ToString(TimeFormatter) + " Stunden"; } - ntiWorkTimeHero.Text = $"{toolTipInfo} - WorkTimeHero"; + ntiWorkTimeHero.Text = toolTipInfo + " - WorkTimeHero"; } private void RefreshIcons() diff --git a/WorkTimeHero/Program.cs b/WorkTimeHero/Program.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -14,9 +15,39 @@ namespace WorkTimeHero [STAThread] static void Main() { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault( false ); - Application.Run( new MainForm() ); + Boolean createdNew; + Mutex mut = new Mutex( true, "WorkTimeHero", out createdNew ); + try + { + if ( createdNew ) + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault( false ); + Application.Run( new MainForm() ); + + // Release the Mutex. + mut.ReleaseMutex(); + } + else + { + MessageBox.Show("Programm läuft schon", "WorkTimeHero"); + } + } + catch ( Exception ex ) + { + MessageBox.Show( ex.ToString() ); + } + finally + { + // Mutex schließen + if ( mut != null ) + { + if ( createdNew ) + { + mut.Close(); + } + } + } } } } diff --git a/WorkTimeHero/Properties/vssver2.scc b/WorkTimeHero/Properties/vssver2.scc Binary files differ. diff --git a/WorkTimeHero/WorkTimeHero.csproj b/WorkTimeHero/WorkTimeHero.csproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> @@ -16,6 +16,7 @@ <SccLocalPath>SAK</SccLocalPath> <SccAuxPath>SAK</SccAuxPath> <SccProvider>SAK</SccProvider> + <NoWin32Manifest>False</NoWin32Manifest> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> @@ -26,7 +27,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> - <RunCodeAnalysis>true</RunCodeAnalysis> + <RunCodeAnalysis>False</RunCodeAnalysis> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> diff --git a/WorkTimeHero/vssver2.scc b/WorkTimeHero/vssver2.scc Binary files differ. diff --git a/WorkTimeHeroTest/Properties/vssver2.scc b/WorkTimeHeroTest/Properties/vssver2.scc Binary files differ. diff --git a/WorkTimeHeroTest/vssver2.scc b/WorkTimeHeroTest/vssver2.scc Binary files differ. diff --git a/vssver2.scc b/vssver2.scc Binary files differ.