Skip to content

Commit

Permalink
1.4.1 (#17)
Browse files Browse the repository at this point in the history
* 1.4.1 version
* Improve setting saving logic to increate reliability
* Fix small window size issue after minimizing to tray
  • Loading branch information
o4oren authored Sep 11, 2023
1 parent c8a0ae7 commit fee3fe7
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 49 deletions.
50 changes: 24 additions & 26 deletions FSTRaK/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,41 +58,39 @@ void OnApplicationStart(object sender, StartupEventArgs args)

Task.Run(() =>
{
using (var logbookContext = new LogbookContext())
using var logbookContext = new LogbookContext();
try
{
try
{
logbookContext.Aircraft.Find(1);
}
catch (Exception ex)
{
Log.Error(ex, ex.Message);
}
logbookContext.Aircraft.Find(1);
}
});

Task.Run(() =>
{
if (FSTRaK.Properties.Settings.Default.IsStartAutomatically)
catch (Exception ex)
{
// Start up with windows login
RegistryKey rkStartUp = Registry.CurrentUser;
var applicationLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
var startupPathSubKey = rkStartUp.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
if (startupPathSubKey?.GetValue("FSTrAk") == null)
{
startupPathSubKey?.SetValue("FSTrAk", applicationLocation, RegistryValueKind.ExpandString);
}
Log.Error(ex, ex.Message);
}
});

// Task.Run(() =>
// {
// if (FSTRaK.Properties.Settings.Default.IsStartAutomatically)
// {
// // Start up with windows login
// RegistryKey rkStartUp = Registry.CurrentUser;
// var applicationLocation = System.Reflection.Assembly.GetExecutingAssembly().Location;
//
// var startupPathSubKey = rkStartUp.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
//
//
// if (startupPathSubKey?.GetValue("FSTrAk") == null)
// {
// startupPathSubKey?.SetValue("FSTrAk", applicationLocation, RegistryValueKind.ExpandString);
// }
// }
// });

// Set font according to settings
FontUtil.SetFont(FSTRaK.Properties.Settings.Default.FontName);

var airportResolver = AirportResolver.Instance;
var _ = AirportResolver.Instance;

}

Expand Down
4 changes: 2 additions & 2 deletions FSTRaK/Models/FlightManager/FlightManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public FlightParams CurrentFlightParams
}
}

private AbstractState _state;
public AbstractState State {
private IFlightManagerState _state;
public IFlightManagerState State {
get => _state;
set
{
Expand Down
4 changes: 2 additions & 2 deletions FSTRaK/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyVersion("1.4.1.0")]
[assembly: AssemblyFileVersion("1.4.1.0")]
[assembly: NeutralResourcesLanguage("en")]
38 changes: 38 additions & 0 deletions FSTRaK/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using FSTRaK.Views;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Serilog;

namespace FSTRaK.ViewModels
{
Expand All @@ -22,11 +25,46 @@ public object ActiveView
get => _activeView;
set
{
if (_settingsViewModel != null && _activeView == _settingsViewModel && value != _settingsViewModel)
{
_settingsViewModel.SaveSettings(); // Save settings when navigating away from the settings page
}
_activeView = value;
OnPropertyChanged();
}
}

public double Height {
get => Properties.Settings.Default.Height;
set
{
if(value > 449)
Properties.Settings.Default.Height = value;
}
}


public double Width
{
get => Properties.Settings.Default.Width;
set
{
if(value > 599)
Properties.Settings.Default.Width = value;
}
}

public double Left
{
get => Properties.Settings.Default.Left;
set => Properties.Settings.Default.Left = value;
}
public double Top
{
get => Properties.Settings.Default.Top;
set => Properties.Settings.Default.Top = value;
}

public MainWindowViewModel()
{
_liveViewViewModel = new LiveViewViewModel();
Expand Down
9 changes: 5 additions & 4 deletions FSTRaK/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ public string FontName

public SettingsViewModel() : base()
{
var mapProviders = new ResourceDictionary();
mapProviders.Source = new System.Uri("pack://application:,,,/Resources/MapProvidersDictionary.xaml", uriKind: System.UriKind.Absolute);
var mapProviders = new ResourceDictionary
{
Source = new System.Uri("pack://application:,,,/Resources/MapProvidersDictionary.xaml", uriKind: System.UriKind.Absolute)
};
var layers = new ObservableCollection<string>();

foreach (DictionaryEntry provider in mapProviders)
Expand All @@ -212,9 +214,8 @@ public void SettingsView_OnLoaded()
FontName = Properties.Settings.Default.FontName;
}

~SettingsViewModel()
public void SaveSettings()
{
Log.Debug("haha!");
Properties.Settings.Default.Save();
}
}
Expand Down
8 changes: 4 additions & 4 deletions FSTRaK/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
AllowsTransparency="true"
ResizeMode="CanResizeWithGrip"
Deactivated="Window_Deactivated"
Height="{Binding Source={x:Static p:Settings.Default}, Path=Height, Mode=TwoWay}"
Width="{Binding Source={x:Static p:Settings.Default}, Path=Width, Mode=TwoWay}"
Left="{Binding Source={x:Static p:Settings.Default}, Path=Left, Mode=TwoWay}"
Top="{Binding Source={x:Static p:Settings.Default}, Path=Top, Mode=TwoWay}"
Height="{Binding Height, Mode=TwoWay}"
Width="{Binding Width, Mode=TwoWay}"
Left="{Binding Left, Mode=TwoWay}"
Top="{Binding Top, Mode=TwoWay}"
Title="FSTRaK"
>
<Window.DataContext>
Expand Down
7 changes: 0 additions & 7 deletions FSTRaK/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ private void DragWindow(object sender, MouseButtonEventArgs e)
DragMove();
}

protected override void OnStateChanged(EventArgs e)
{
// consider minimize to tray
base.OnStateChanged(e);
}


private void Window_Deactivated(object sender, EventArgs e)
{
var window = (Window)sender;
Expand Down
38 changes: 34 additions & 4 deletions Setup/Setup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@
}
"Entry"
{
"MsmKey" = "8:_683594FCD2A35F24A45A1BE544611AEB"
"OwnerKey" = "8:_A4D70056C78A158E7D851A2AC02B3CBB"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_7C9B6DCC0FD39A25A15C4834E931EF0C"
"OwnerKey" = "8:_1D7CA2210B6C44B08C0DE9A32527DC09"
"MsmSig" = "8:_UNDEFINED"
Expand Down Expand Up @@ -316,6 +322,18 @@
"Entry"
{
"MsmKey" = "8:_CA7940E10ECA91AF9FE58021F29CE6BF"
"OwnerKey" = "8:_A4D70056C78A158E7D851A2AC02B3CBB"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_CA7940E10ECA91AF9FE58021F29CE6BF"
"OwnerKey" = "8:_318822C294B84FE5A29EBD7EBDAA1CF3"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_CA7940E10ECA91AF9FE58021F29CE6BF"
"OwnerKey" = "8:_F38511C177B3374C46C8DB2547447A6F"
"MsmSig" = "8:_UNDEFINED"
}
Expand Down Expand Up @@ -370,6 +388,18 @@
"Entry"
{
"MsmKey" = "8:_FAAC18DC887E2F600C7770F8E850D028"
"OwnerKey" = "8:_8FB48EC106A444373D9BAFE704BB9A44"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_FAAC18DC887E2F600C7770F8E850D028"
"OwnerKey" = "8:_7C9B6DCC0FD39A25A15C4834E931EF0C"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_FAAC18DC887E2F600C7770F8E850D028"
"OwnerKey" = "8:_D162607AEF92525549C031BBFE3D09FC"
"MsmSig" = "8:_UNDEFINED"
}
Expand Down Expand Up @@ -1771,15 +1801,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:FSTrAk"
"ProductCode" = "8:{54C7DF02-EEFF-4060-949E-1D1B67296E89}"
"PackageCode" = "8:{161D09B7-6318-418C-9BAE-56405114C76F}"
"ProductCode" = "8:{1D3FE010-EAD2-4457-B66F-8C06389CC781}"
"PackageCode" = "8:{EC6FD121-07ED-4E1C-80D9-BA7DE0F999CA}"
"UpgradeCode" = "8:{DFB8349E-B81D-4481-9F4C-14C136E2FBD4}"
"AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:1.4.0"
"ProductVersion" = "8:1.4.1"
"Manufacturer" = "8:FSTrAk"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down Expand Up @@ -2349,7 +2379,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_8581586A4FC4400494EBCD574550E0A0"
{
"SourcePath" = "8:..\\FSTRaK\\obj\\x64\\Release\\FSTRaK.exe"
"SourcePath" = "8:"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_26CFFA3E4E6A4BE18B31D33970E8B9B7"
Expand Down

0 comments on commit fee3fe7

Please sign in to comment.