Implemented update system
This commit is contained in:
31
Converters/BoolToVisibilityConverter.cs
Normal file
31
Converters/BoolToVisibilityConverter.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,15 @@
|
||||
<Reference Include="CurrencyTextBoxControl">
|
||||
<HintPath>.\CurrencyTextBoxControl.dll</HintPath>
|
||||
</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">
|
||||
<HintPath>packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -68,9 +77,30 @@
|
||||
<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>
|
||||
</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">
|
||||
<HintPath>packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</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">
|
||||
<HintPath>packages\SQLite.Net-PCL.3.0.5\lib\net40\SQLite.Net.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -83,6 +113,9 @@
|
||||
<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>
|
||||
</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.Data" />
|
||||
<Reference Include="System.Windows.Controls.Ribbon" />
|
||||
@@ -108,7 +141,9 @@
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Converters\AmountToColorConverter.cs" />
|
||||
<Compile Include="Converters\BoolToVisibilityConverter.cs" />
|
||||
<Compile Include="Data\Database.cs" />
|
||||
<Compile Include="Data\EJaySettings.cs" />
|
||||
<Compile Include="Extensions\ExtensionMethods.cs" />
|
||||
<Compile Include="Helper\PrintHelper.cs" />
|
||||
<Compile Include="Model\Enums.cs" />
|
||||
@@ -176,19 +211,12 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="sgKey.snk" />
|
||||
</ItemGroup>
|
||||
@@ -240,6 +268,14 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Content\db_plus.ico" />
|
||||
</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="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">
|
||||
@@ -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'))" />
|
||||
</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')" />
|
||||
<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>
|
||||
50
Properties/Settings.Designer.cs
generated
50
Properties/Settings.Designer.cs
generated
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -10,6 +10,7 @@
|
||||
Title="eJay" Height="600" MinHeight="600" Width="900" MinWidth="900"
|
||||
Background="White">
|
||||
<Window.Resources>
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
|
||||
<converters:AmountToColorConverter x:Key="AmountToColorConverter" />
|
||||
<Style TargetType="ListViewItem">
|
||||
<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="Select Telegram Path" SmallImageSource="../Content/telegram.png" Command="{Binding SetTelegramLocationCommand}"></RibbonButton>
|
||||
</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>
|
||||
</Ribbon>
|
||||
<!-- #endregion -->
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Windows;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Squirrel;
|
||||
|
||||
namespace DebtMgr.View
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace DebtMgr.ViewModel.Dialogs
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
CheckFileExists = true,
|
||||
Filter = "Debt Manager Database|*.dmdb|All files|*.*"
|
||||
Filter = "eJay Database|*.dmdb|All files|*.*"
|
||||
};
|
||||
|
||||
//Application.Current.Shutdown();
|
||||
@@ -72,8 +72,8 @@ namespace DebtMgr.ViewModel.Dialogs
|
||||
{
|
||||
x.Table<Person>().ToList();
|
||||
|
||||
Properties.Settings.Default["Database"] = openFileDialog.FileName;
|
||||
Properties.Settings.Default.Save();
|
||||
App.Settings.Database = openFileDialog.FileName;
|
||||
App.SaveSettings();
|
||||
|
||||
ProgramRequestedClose = true;
|
||||
RequestClose?.Invoke(null, null);
|
||||
@@ -81,7 +81,7 @@ namespace DebtMgr.ViewModel.Dialogs
|
||||
catch (Exception)
|
||||
{
|
||||
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",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
@@ -95,6 +95,7 @@ namespace DebtMgr.ViewModel.Dialogs
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateDatabaseButtonClick Command
|
||||
|
||||
/// <summary>
|
||||
@@ -111,14 +112,14 @@ namespace DebtMgr.ViewModel.Dialogs
|
||||
{
|
||||
var saveFileDialog = new SaveFileDialog
|
||||
{
|
||||
Filter = "Debt Manager Database|*.dmdb|Standard database|*.db",
|
||||
Filter = "eJay Database|*.dmdb|Standard database|*.db",
|
||||
OverwritePrompt = true
|
||||
};
|
||||
|
||||
if (saveFileDialog.ShowDialog() == true)
|
||||
{
|
||||
Properties.Settings.Default["Database"] = saveFileDialog.FileName;
|
||||
Properties.Settings.Default.Save();
|
||||
App.Settings.Database = saveFileDialog.FileName;
|
||||
App.SaveSettings();
|
||||
|
||||
ProgramRequestedClose = true;
|
||||
RequestClose?.Invoke(null, null);
|
||||
|
||||
@@ -15,6 +15,9 @@ using DebtMgr.Helper;
|
||||
using Microsoft.Win32;
|
||||
using System.Windows.Markup;
|
||||
using System.Xml;
|
||||
using Squirrel;
|
||||
using NuGet;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DebtMgr.ViewModel
|
||||
{
|
||||
@@ -143,6 +146,164 @@ namespace DebtMgr.ViewModel
|
||||
|
||||
#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
|
||||
|
||||
/// <summary>
|
||||
@@ -221,7 +382,7 @@ namespace DebtMgr.ViewModel
|
||||
if (grid == 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 (!File.Exists(telegramPath)) return false;
|
||||
|
||||
@@ -244,7 +405,7 @@ namespace DebtMgr.ViewModel
|
||||
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
startInfo.FileName = Properties.Settings.Default.TelegramPath;
|
||||
startInfo.FileName = App.Settings.TelegramPath;
|
||||
|
||||
startInfo.Arguments = parameter;
|
||||
|
||||
@@ -582,8 +743,8 @@ namespace DebtMgr.ViewModel
|
||||
|
||||
private void SwitchDatabaseMenuCommand_Execute()
|
||||
{
|
||||
Properties.Settings.Default["Database"] = string.Empty;
|
||||
Properties.Settings.Default.Save();
|
||||
App.Settings.Database = string.Empty;
|
||||
App.SaveSettings();
|
||||
|
||||
Thread.Sleep(100);
|
||||
|
||||
@@ -607,9 +768,9 @@ namespace DebtMgr.ViewModel
|
||||
|
||||
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")
|
||||
{
|
||||
Properties.Settings.Default.TelegramPath = openFileDialog.FileName;
|
||||
Properties.Settings.Default.Save();
|
||||
App.Settings.TelegramPath = openFileDialog.FileName;
|
||||
App.SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,10 +822,49 @@ namespace DebtMgr.ViewModel
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public MainViewModel()
|
||||
{
|
||||
CheckDatabase();
|
||||
CheckDatabase();
|
||||
|
||||
UpdatePersonsList();
|
||||
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()
|
||||
@@ -731,7 +931,7 @@ namespace DebtMgr.ViewModel
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private void CheckDatabase()
|
||||
{
|
||||
var databasePath = Properties.Settings.Default.Database;
|
||||
var databasePath = App.Settings.Database;
|
||||
if (string.IsNullOrWhiteSpace(databasePath))
|
||||
{
|
||||
var window = new DatabaseSelectorDialogView();
|
||||
@@ -745,7 +945,7 @@ namespace DebtMgr.ViewModel
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Properties.Settings.Default["Database"] = string.Empty;
|
||||
App.Settings.Database = string.Empty;
|
||||
CheckDatabase();
|
||||
}
|
||||
}
|
||||
|
||||
14
nuspec/ejay.nuspec
Normal file
14
nuspec/ejay.nuspec
Normal 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>
|
||||
@@ -2,10 +2,15 @@
|
||||
<packages>
|
||||
<package id="CommonServiceLocator" version="1.3" targetFramework="net452" />
|
||||
<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="Mono.Cecil" version="0.9.6.1" targetFramework="net46" />
|
||||
<package id="MvvmLight" 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="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="SQLiteNetExtensions" version="1.3.0" targetFramework="net452" />
|
||||
<package id="squirrel.windows" version="1.9.0" targetFramework="net46" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user