Implemented update system

This commit is contained in:
Andre Beging
2019-01-06 15:44:03 +01:00
parent bc1a0e2118
commit 5887b27aaa
10 changed files with 345 additions and 90 deletions

View File

@@ -0,0 +1,31 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace DebtMgr.Converters
{
[ValueConversion(typeof(bool), typeof(Visibility))]
public class BoolToVisibilityConverter : IValueConverter
{
public Visibility TrueValue { get; set; }
public Visibility FalseValue { get; set; }
public BoolToVisibilityConverter()
{
// set defaults
FalseValue = Visibility.Hidden;
TrueValue = Visibility.Visible;
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value ? TrueValue : FalseValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -56,6 +56,15 @@
<Reference Include="CurrencyTextBoxControl"> <Reference Include="CurrencyTextBoxControl">
<HintPath>.\CurrencyTextBoxControl.dll</HintPath> <HintPath>.\CurrencyTextBoxControl.dll</HintPath>
</Reference> </Reference>
<Reference Include="DeltaCompressionDotNet, Version=1.1.0.0, Culture=neutral, PublicKeyToken=1d14d6e5194e7f4a, processorArchitecture=MSIL">
<HintPath>packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.dll</HintPath>
</Reference>
<Reference Include="DeltaCompressionDotNet.MsDelta, Version=1.1.0.0, Culture=neutral, PublicKeyToken=46b2138a390abf55, processorArchitecture=MSIL">
<HintPath>packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.MsDelta.dll</HintPath>
</Reference>
<Reference Include="DeltaCompressionDotNet.PatchApi, Version=1.1.0.0, Culture=neutral, PublicKeyToken=3e8888ee913ed789, processorArchitecture=MSIL">
<HintPath>packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.PatchApi.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL"> <Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath> <HintPath>packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
</Reference> </Reference>
@@ -68,9 +77,30 @@
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath> <HintPath>packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference> </Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="NuGet.Squirrel, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\squirrel.windows.1.9.0\lib\Net45\NuGet.Squirrel.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.17.1.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<HintPath>packages\SharpCompress.0.17.1\lib\net45\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Splat.1.6.2\lib\Net45\Splat.dll</HintPath>
</Reference>
<Reference Include="SQLite.Net, Version=3.0.5.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SQLite.Net, Version=3.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\SQLite.Net-PCL.3.0.5\lib\net40\SQLite.Net.dll</HintPath> <HintPath>packages\SQLite.Net-PCL.3.0.5\lib\net40\SQLite.Net.dll</HintPath>
</Reference> </Reference>
@@ -83,6 +113,9 @@
<Reference Include="SQLiteNetExtensions, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SQLiteNetExtensions, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\SQLiteNetExtensions.1.3.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\SQLiteNetExtensions.dll</HintPath> <HintPath>packages\SQLiteNetExtensions.1.3.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\SQLiteNetExtensions.dll</HintPath>
</Reference> </Reference>
<Reference Include="Squirrel, Version=1.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\squirrel.windows.1.9.0\lib\Net45\Squirrel.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Windows.Controls.Ribbon" /> <Reference Include="System.Windows.Controls.Ribbon" />
@@ -108,7 +141,9 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="Converters\AmountToColorConverter.cs" /> <Compile Include="Converters\AmountToColorConverter.cs" />
<Compile Include="Converters\BoolToVisibilityConverter.cs" />
<Compile Include="Data\Database.cs" /> <Compile Include="Data\Database.cs" />
<Compile Include="Data\EJaySettings.cs" />
<Compile Include="Extensions\ExtensionMethods.cs" /> <Compile Include="Extensions\ExtensionMethods.cs" />
<Compile Include="Helper\PrintHelper.cs" /> <Compile Include="Helper\PrintHelper.cs" />
<Compile Include="Model\Enums.cs" /> <Compile Include="Model\Enums.cs" />
@@ -176,19 +211,12 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<None Include="packages.config" /> <None Include="packages.config">
<None Include="Properties\Settings.settings"> <SubType>Designer</SubType>
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
<None Include="sgKey.snk" /> <None Include="sgKey.snk" />
</ItemGroup> </ItemGroup>
@@ -240,6 +268,14 @@
<ItemGroup> <ItemGroup>
<Resource Include="Content\db_plus.ico" /> <Resource Include="Content\db_plus.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="nuspec\ejay.nuspec">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="nuget\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\Fody.2.0.0\build\dotnet\Fody.targets" Condition="Exists('packages\Fody.2.0.0\build\dotnet\Fody.targets')" /> <Import Project="packages\Fody.2.0.0\build\dotnet\Fody.targets" Condition="Exists('packages\Fody.2.0.0\build\dotnet\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
@@ -250,4 +286,26 @@
<Error Condition="!Exists('packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets'))" /> <Error Condition="!Exists('packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets'))" />
</Target> </Target>
<Import Project="packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets" Condition="Exists('packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" /> <Import Project="packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets" Condition="Exists('packages\Costura.Fody.1.6.2\build\dotnet\Costura.Fody.targets')" />
<Target Name="PostBuildMacros">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="Targets" />
</GetAssemblyIdentity>
<ItemGroup>
<VersionNumber Include="@(Targets->'%(Version)')" />
</ItemGroup>
</Target>
<PropertyGroup>
<PostBuildEventDependsOn>
$(PostBuildEventDependsOn);
PostBuildMacros;
</PostBuildEventDependsOn>
<PostBuildEvent>set releaseDir="C:\Squirrel\eJay"
set longVersion=@(VersionNumber)
set version=%25longVersion:~0,5%25
echo %25version%25
cd ..\..\nuget
nuget pack ..\nuspec\ejay.nuspec
Squirrel --releasify ..\nuget\eJay.%25version%25.nupkg --releaseDir %25releaseDir%25
echo RELEASED IN %25releaseDir%25</PostBuildEvent>
</PropertyGroup>
</Project> </Project>

View File

@@ -1,50 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DebtMgr.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string Database {
get {
return ((string)(this["Database"]));
}
set {
this["Database"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string TelegramPath {
get {
return ((string)(this["TelegramPath"]));
}
set {
this["TelegramPath"] = value;
}
}
}
}

View File

@@ -1,12 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="DebtMgr.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="Database" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="TelegramPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@@ -10,6 +10,7 @@
Title="eJay" Height="600" MinHeight="600" Width="900" MinWidth="900" Title="eJay" Height="600" MinHeight="600" Width="900" MinWidth="900"
Background="White"> Background="White">
<Window.Resources> <Window.Resources>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
<converters:AmountToColorConverter x:Key="AmountToColorConverter" /> <converters:AmountToColorConverter x:Key="AmountToColorConverter" />
<Style TargetType="ListViewItem"> <Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" />
@@ -49,6 +50,11 @@
<RibbonButton Label="Open Database Location" SmallImageSource="../Content/db_info.ico" Command="{Binding OpenDatabaseLocationMenuCommand}"></RibbonButton> <RibbonButton Label="Open Database Location" SmallImageSource="../Content/db_info.ico" Command="{Binding OpenDatabaseLocationMenuCommand}"></RibbonButton>
<RibbonButton Label="Select Telegram Path" SmallImageSource="../Content/telegram.png" Command="{Binding SetTelegramLocationCommand}"></RibbonButton> <RibbonButton Label="Select Telegram Path" SmallImageSource="../Content/telegram.png" Command="{Binding SetTelegramLocationCommand}"></RibbonButton>
</RibbonGroup> </RibbonGroup>
<RibbonGroup Header="Application">
<Label Content="{Binding CurrentVersionLabelContent}"></Label>
<Label Content="{Binding UpdateInfoLabelContent}" Visibility="{Binding UpdateInfoLabelVisible, Converter={StaticResource BoolToVisibilityConverter}}"></Label>
<RibbonButton SmallImageSource="../Content/moneybag.ico" Label="{Binding UpdateButtonLabel}" IsEnabled="{Binding UpdateButtonEnabled}" Visibility="{Binding UpdateButtonVisible, Converter={StaticResource BoolToVisibilityConverter}}" Command="{Binding UpdateButtonCommand}"></RibbonButton>
</RibbonGroup>
</RibbonTab> </RibbonTab>
</Ribbon> </Ribbon>
<!-- #endregion --> <!-- #endregion -->

View File

@@ -1,7 +1,9 @@
using System.Windows; using System;
using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using Squirrel;
namespace DebtMgr.View namespace DebtMgr.View
{ {

View File

@@ -59,7 +59,7 @@ namespace DebtMgr.ViewModel.Dialogs
var openFileDialog = new OpenFileDialog var openFileDialog = new OpenFileDialog
{ {
CheckFileExists = true, CheckFileExists = true,
Filter = "Debt Manager Database|*.dmdb|All files|*.*" Filter = "eJay Database|*.dmdb|All files|*.*"
}; };
//Application.Current.Shutdown(); //Application.Current.Shutdown();
@@ -72,8 +72,8 @@ namespace DebtMgr.ViewModel.Dialogs
{ {
x.Table<Person>().ToList(); x.Table<Person>().ToList();
Properties.Settings.Default["Database"] = openFileDialog.FileName; App.Settings.Database = openFileDialog.FileName;
Properties.Settings.Default.Save(); App.SaveSettings();
ProgramRequestedClose = true; ProgramRequestedClose = true;
RequestClose?.Invoke(null, null); RequestClose?.Invoke(null, null);
@@ -81,7 +81,7 @@ namespace DebtMgr.ViewModel.Dialogs
catch (Exception) catch (Exception)
{ {
MessageBox.Show( MessageBox.Show(
string.Format("File is not a Debt Manager database\n\n{0}", openFileDialog.FileName), string.Format("File is not an eJay database\n\n{0}", openFileDialog.FileName),
"File invalid", "File invalid",
MessageBoxButton.OK, MessageBoxButton.OK,
MessageBoxImage.Error); MessageBoxImage.Error);
@@ -95,6 +95,7 @@ namespace DebtMgr.ViewModel.Dialogs
} }
#endregion #endregion
#region CreateDatabaseButtonClick Command #region CreateDatabaseButtonClick Command
/// <summary> /// <summary>
@@ -111,14 +112,14 @@ namespace DebtMgr.ViewModel.Dialogs
{ {
var saveFileDialog = new SaveFileDialog var saveFileDialog = new SaveFileDialog
{ {
Filter = "Debt Manager Database|*.dmdb|Standard database|*.db", Filter = "eJay Database|*.dmdb|Standard database|*.db",
OverwritePrompt = true OverwritePrompt = true
}; };
if (saveFileDialog.ShowDialog() == true) if (saveFileDialog.ShowDialog() == true)
{ {
Properties.Settings.Default["Database"] = saveFileDialog.FileName; App.Settings.Database = saveFileDialog.FileName;
Properties.Settings.Default.Save(); App.SaveSettings();
ProgramRequestedClose = true; ProgramRequestedClose = true;
RequestClose?.Invoke(null, null); RequestClose?.Invoke(null, null);

View File

@@ -15,6 +15,9 @@ using DebtMgr.Helper;
using Microsoft.Win32; using Microsoft.Win32;
using System.Windows.Markup; using System.Windows.Markup;
using System.Xml; using System.Xml;
using Squirrel;
using NuGet;
using System.Threading.Tasks;
namespace DebtMgr.ViewModel namespace DebtMgr.ViewModel
{ {
@@ -143,6 +146,164 @@ namespace DebtMgr.ViewModel
#endregion #endregion
#region CurrentVersionLabelContent (string) Property
/// <summary>
/// Privater Teil von <see cref="CurrentVersionLabelContent" />
/// </summary>
private string _currentVersionLabelContent;
/// <summary>
/// Comment
///</summary>
public string CurrentVersionLabelContent
{
get { return _currentVersionLabelContent; }
set
{
_currentVersionLabelContent = value;
RaisePropertyChanged(() => CurrentVersionLabelContent);
}
}
#endregion
#region UpdateInfoLabelContent (string) Property
/// <summary>
/// Privater Teil von <see cref="UpdateInfoLabelContent" />
/// </summary>
private string _updateInfoLabelContent;
/// <summary>
/// Comment
///</summary>
public string UpdateInfoLabelContent
{
get { return _updateInfoLabelContent; }
set
{
_updateInfoLabelContent = value;
RaisePropertyChanged(() => UpdateInfoLabelContent);
}
}
#endregion
#region UpdateInfoLabelVisible (bool) Property
/// <summary>
/// Privater Teil von <see cref="UpdateInfoLabelVisible" />
/// </summary>
private bool _updateInfoLabelVisible;
/// <summary>
/// Comment
///</summary>
public bool UpdateInfoLabelVisible
{
get { return _updateInfoLabelVisible; }
set
{
_updateInfoLabelVisible = value;
RaisePropertyChanged(() => UpdateInfoLabelVisible);
}
}
#endregion
#region UpdateButtonEnabled (bool) Property
/// <summary>
/// Privater Teil von <see cref="UpdateButtonEnabled" />
/// </summary>
private bool _updateButtonEnabled;
/// <summary>
/// Comment
///</summary>
public bool UpdateButtonEnabled
{
get { return _updateButtonEnabled; }
set
{
_updateButtonEnabled = value;
RaisePropertyChanged(() => UpdateButtonEnabled);
}
}
#endregion
#region UpdateButtonVisible (bool) Property
/// <summary>
/// Privater Teil von <see cref="UpdateButtonVisible" />
/// </summary>
private bool _updateButtonVisible;
/// <summary>
/// Comment
///</summary>
public bool UpdateButtonVisible
{
get { return _updateButtonVisible; }
set
{
_updateButtonVisible = value;
RaisePropertyChanged(() => UpdateButtonVisible);
}
}
#endregion
#region UpdateButtonLabel (string) Property
/// <summary>
/// Privater Teil von <see cref="UpdateButtonLabel" />
/// </summary>
private string _updateButtonLabel;
/// <summary>
/// Comment
///</summary>
public string UpdateButtonLabel
{
get { return _updateButtonLabel; }
set
{
_updateButtonLabel = value;
RaisePropertyChanged(() => UpdateButtonLabel);
}
}
#endregion
#region UpdateButtonCommand Command
/// <summary>
/// Private member backing variable for <see cref="UpdateButtonCommand" />
/// </summary>
private RelayCommand _updateButtonCommand = null;
/// <summary>
/// Comment
/// </summary>
public RelayCommand UpdateButtonCommand => _updateButtonCommand ?? (_updateButtonCommand = new RelayCommand(UpdateButtonCommand_Execute));
private async void UpdateButtonCommand_Execute()
{
using (var updateManager = new UpdateManager("http://troogs.de/dev/update/ejay/"))
{
App.SaveSettings();
MessageBox.Show("The application will be updated and shut down. Please restart", "Update", MessageBoxButton.OK, MessageBoxImage.Exclamation);
await updateManager.UpdateApp();
App.Current.Shutdown();
}
}
#endregion
#region ScreenshotPossible (bool) Property #region ScreenshotPossible (bool) Property
/// <summary> /// <summary>
@@ -221,7 +382,7 @@ namespace DebtMgr.ViewModel
if (grid == null) return false; if (grid == null) return false;
if (PersonListViewSelectedItem == null) return false; if (PersonListViewSelectedItem == null) return false;
var telegramPath = Properties.Settings.Default.TelegramPath; var telegramPath = App.Settings.TelegramPath;
if (string.IsNullOrWhiteSpace(telegramPath)) return false; if (string.IsNullOrWhiteSpace(telegramPath)) return false;
if (!File.Exists(telegramPath)) return false; if (!File.Exists(telegramPath)) return false;
@@ -244,7 +405,7 @@ namespace DebtMgr.ViewModel
ProcessStartInfo startInfo = new ProcessStartInfo(); ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden; startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.FileName = Properties.Settings.Default.TelegramPath; startInfo.FileName = App.Settings.TelegramPath;
startInfo.Arguments = parameter; startInfo.Arguments = parameter;
@@ -582,8 +743,8 @@ namespace DebtMgr.ViewModel
private void SwitchDatabaseMenuCommand_Execute() private void SwitchDatabaseMenuCommand_Execute()
{ {
Properties.Settings.Default["Database"] = string.Empty; App.Settings.Database = string.Empty;
Properties.Settings.Default.Save(); App.SaveSettings();
Thread.Sleep(100); Thread.Sleep(100);
@@ -607,9 +768,9 @@ namespace DebtMgr.ViewModel
private void OpenDatabaseLocationMenuCommand_Execute() private void OpenDatabaseLocationMenuCommand_Execute()
{ {
if (File.Exists(Properties.Settings.Default.Database)) if (File.Exists(App.Settings.Database))
{ {
Process.Start("explorer.exe", "/select, " + Properties.Settings.Default.Database); Process.Start("explorer.exe", "/select, " + App.Settings.Database);
} }
} }
@@ -644,8 +805,8 @@ namespace DebtMgr.ViewModel
{ {
if (Path.GetExtension(openFileDialog.FileName) == "exe" || Path.GetExtension(openFileDialog.FileName) == ".exe") if (Path.GetExtension(openFileDialog.FileName) == "exe" || Path.GetExtension(openFileDialog.FileName) == ".exe")
{ {
Properties.Settings.Default.TelegramPath = openFileDialog.FileName; App.Settings.TelegramPath = openFileDialog.FileName;
Properties.Settings.Default.Save(); App.SaveSettings();
} }
} }
@@ -661,10 +822,49 @@ namespace DebtMgr.ViewModel
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
public MainViewModel() public MainViewModel()
{ {
CheckDatabase(); CheckDatabase();
UpdatePersonsList(); UpdatePersonsList();
UpdateDetailView(); UpdateDetailView();
new Task(PerformUpdaterInfo).Start();
}
public async void PerformUpdaterInfo()
{
using (var updateManager = new UpdateManager("http://troogs.de/dev/update/ejay/"))
{
try
{
// Get current Version
var executableDir = Path.GetDirectoryName(typeof(UpdateManager).Assembly.CodeBase)?
.Split(Path.DirectorySeparatorChar)
.LastOrDefault(d => d.StartsWith("app-", StringComparison.OrdinalIgnoreCase));
var stringVersion = executableDir?.Replace("app-", "");
var currentVersion = !string.IsNullOrWhiteSpace(stringVersion) ? new SemanticVersion(stringVersion) : null;
CurrentVersionLabelContent = string.Format("Version: {0}", currentVersion);
UpdateInfoLabelContent = "No updates found";
UpdateButtonEnabled = false;
UpdateButtonVisible = false;
UpdateInfoLabelVisible = true;
var updateInfo = await updateManager.CheckForUpdate();
if (updateInfo.FutureReleaseEntry != null && updateInfo.FutureReleaseEntry.Version > currentVersion)
{
UpdateButtonLabel = string.Format("Update to {0}", updateInfo.FutureReleaseEntry.Version);
UpdateInfoLabelVisible = false;
UpdateButtonVisible = true;
UpdateButtonEnabled = true;
UpdateInfoLabelContent = "Update available";
}
}
catch (Exception)
{
// ignore
}
}
} }
#region UpdatePersonsList() #region UpdatePersonsList()
@@ -731,7 +931,7 @@ namespace DebtMgr.ViewModel
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
private void CheckDatabase() private void CheckDatabase()
{ {
var databasePath = Properties.Settings.Default.Database; var databasePath = App.Settings.Database;
if (string.IsNullOrWhiteSpace(databasePath)) if (string.IsNullOrWhiteSpace(databasePath))
{ {
var window = new DatabaseSelectorDialogView(); var window = new DatabaseSelectorDialogView();
@@ -745,7 +945,7 @@ namespace DebtMgr.ViewModel
} }
catch (Exception) catch (Exception)
{ {
Properties.Settings.Default["Database"] = string.Empty; App.Settings.Database = string.Empty;
CheckDatabase(); CheckDatabase();
} }
} }

14
nuspec/ejay.nuspec Normal file
View File

@@ -0,0 +1,14 @@
<package >
<metadata>
<id>eJay</id>
<version>1.0.0</version>
<authors>TroogS</authors>
<owners>TroogS</owners>
<description>A tool to keep track of your private debts</description>
<releaseNotes>Initial release.</releaseNotes>
<copyright>Copyright © 2019</copyright>
</metadata>
<files>
<file src="..\bin\Release\*.exe" target="lib\net45\"/>
</files>
</package>

View File

@@ -2,10 +2,15 @@
<packages> <packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net452" /> <package id="CommonServiceLocator" version="1.3" targetFramework="net452" />
<package id="Costura.Fody" version="1.6.2" targetFramework="net46" developmentDependency="true" /> <package id="Costura.Fody" version="1.6.2" targetFramework="net46" developmentDependency="true" />
<package id="DeltaCompressionDotNet" version="1.1.0" targetFramework="net46" />
<package id="Fody" version="2.0.0" targetFramework="net46" developmentDependency="true" /> <package id="Fody" version="2.0.0" targetFramework="net46" developmentDependency="true" />
<package id="Mono.Cecil" version="0.9.6.1" targetFramework="net46" />
<package id="MvvmLight" version="5.3.0.0" targetFramework="net452" /> <package id="MvvmLight" version="5.3.0.0" targetFramework="net452" />
<package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net452" /> <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" /> <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net452" />
<package id="SharpCompress" version="0.17.1" targetFramework="net46" />
<package id="Splat" version="1.6.2" targetFramework="net46" />
<package id="SQLite.Net-PCL" version="3.0.5" targetFramework="net452" /> <package id="SQLite.Net-PCL" version="3.0.5" targetFramework="net452" />
<package id="SQLiteNetExtensions" version="1.3.0" targetFramework="net452" /> <package id="SQLiteNetExtensions" version="1.3.0" targetFramework="net452" />
<package id="squirrel.windows" version="1.9.0" targetFramework="net46" />
</packages> </packages>