Skip to content

Commit

Permalink
Logbook sidebar (#2)
Browse files Browse the repository at this point in the history
* Logbook pages
* Searchbox
* Allow 500 ms before querying bd for search strings
* Textbox
* Add icon to tray
* Minimize
* Error handling
* Prevent multiple instances of FSTrAk
* Added show path and flight details button to details view
* Charts
* Read aircraft params from files
* Scoreboard
* Pin colors
* Resolve airport names
* Remove landing bounces
* City names
* Manufacturer Capitalization
* Selection design
  • Loading branch information
o4oren authored Jun 5, 2023
1 parent b27ced6 commit 21b024e
Show file tree
Hide file tree
Showing 58 changed files with 348,195 additions and 507 deletions.
27 changes: 6 additions & 21 deletions FSTRaK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,23 @@ Global
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
x64|Any CPU = x64|Any CPU
x64|x64 = x64|x64
x64|x86 = x64|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Debug|Any CPU.ActiveCfg = Debug|x64
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Debug|x64.ActiveCfg = Debug|x64
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Debug|x64.Build.0 = Debug|x64
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Debug|x86.ActiveCfg = Debug|x86
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Debug|x86.Build.0 = Debug|x86
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Release|Any CPU.Build.0 = Release|Any CPU
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Debug|x86.ActiveCfg = Debug|x64
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Release|Any CPU.ActiveCfg = Release|x64
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Release|x64.ActiveCfg = Release|x64
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Release|x64.Build.0 = Release|x64
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Release|x86.ActiveCfg = Release|x86
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Release|x86.Build.0 = Release|x86
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.x64|Any CPU.ActiveCfg = Release|Any CPU
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.x64|Any CPU.Build.0 = Release|Any CPU
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.x64|x64.ActiveCfg = Release|x64
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.x64|x64.Build.0 = Release|x64
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.x64|x86.ActiveCfg = Release|x86
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.x64|x86.Build.0 = Release|x86
{B23FF8BA-B0CF-4388-9B13-5AB81059D6AB}.Release|x86.ActiveCfg = Release|x64
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.Debug|Any CPU.ActiveCfg = Debug
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.Debug|x64.ActiveCfg = Debug
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.Debug|x64.ActiveCfg = Release
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.Debug|x64.Build.0 = Release
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.Debug|x86.ActiveCfg = Debug
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.Release|Any CPU.ActiveCfg = Release
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.Release|x64.ActiveCfg = Release
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.Release|x86.ActiveCfg = Release
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.x64|Any CPU.ActiveCfg = Debug
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.x64|x64.ActiveCfg = Debug
{6040B889-5FA2-4BDC-B58F-8E84301C6D1B}.x64|x86.ActiveCfg = Debug
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions FSTRaK/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:local="clr-namespace:FSTRaK"
Startup="OnApplicationStart"
Exit="OnApplicationExit"
DispatcherUnhandledException="App_DispatcherUnhandledException"
StartupUri="Views/MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
Expand Down
48 changes: 45 additions & 3 deletions FSTRaK/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
using FSTRaK.Models.Entity;
using FSTRaK.Models;
using FSTRaK.Models.Entity;
using Serilog;
using Serilog.Exceptions;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;

namespace FSTRaK
{
Expand All @@ -10,9 +15,30 @@ namespace FSTRaK
/// </summary>
public partial class App : Application
{
void OnApplicationStart(object sender, StartupEventArgs args)
private static Mutex _mutex = null;



const string appName = "FSTrAk";

protected override void OnStartup(StartupEventArgs e)
{
_mutex = new Mutex(true, appName, out var createdNew);

if (!createdNew)
{
MessageBox.Show("An instance of FSTrAk is already running...", "FSTrAk");
Application.Current.Shutdown();
}

base.OnStartup(e);
}


void OnApplicationStart(object sender, StartupEventArgs args)
{
Log.Logger = new LoggerConfiguration()
.Enrich.WithExceptionDetails()
.MinimumLevel.Information()
#if DEBUG
.MinimumLevel.Debug()
Expand All @@ -25,9 +51,18 @@ void OnApplicationStart(object sender, StartupEventArgs args)
{
using (var logbookContext = new LogbookContext())
{
logbookContext.Aircraft.Find(1);
try
{
logbookContext.Aircraft.Find(1);
}
catch (Exception ex)
{
Log.Error(ex, ex.Message);
}
}
});

var airportResolder = AirportResolver.Instance;
}


Expand All @@ -40,5 +75,12 @@ void OnApplicationExit(object sender, ExitEventArgs e)
}
FSTRaK.Properties.Settings.Default.Save();
}

void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
Log.Error(e.Exception, "Unhandled error occured!");
// Prevent default unhandled exception processing
e.Handled = true;
}
}
}
25 changes: 22 additions & 3 deletions FSTRaK/DataTypes/SimConnectDataTypes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -71,9 +72,10 @@ public enum DataDefinitions

public enum EVENTS
{
FLIGHT_LOADED,
PAUSE,
CRASHED
FlightLoaded,
AircraftLoaded,
Pause,
Crashed
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
Expand Down Expand Up @@ -124,6 +126,10 @@ public struct AircraftFlightData
public double Engine3MaxRpmPct;
public double Engine4MaxRpmPct;

public double Throttle1Position;
public double Throttle2Position;
public double Throttle3Position;
public double Throttle4Position;

/// <summary>
/// Used to determine negine start up
Expand All @@ -134,6 +140,19 @@ public double MaxEngineRpmPct()
return new double[] { Engine1MaxRpmPct, Engine2MaxRpmPct, Engine3MaxRpmPct, Engine4MaxRpmPct}.Max();
}

public double MaxThorttlePosition()
{
return new double[] { Throttle1Position, Throttle2Position, Throttle3Position, Throttle3Position }.Max();
}

public double MinThrottlePosition()
{
var thorttlePositionArray = new List<double>( new double[] { Throttle1Position, Throttle1Position, Throttle2Position, Throttle3Position });
if (NumberOfEngines == 0)
return 0;
return thorttlePositionArray.GetRange(0,NumberOfEngines).Min();
}

}
internal class SimConnectDataTypes
{
Expand Down
67 changes: 25 additions & 42 deletions FSTRaK/FSTRaK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,12 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>3</ApplicationRevision>
<ApplicationRevision>4</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
Expand All @@ -62,6 +43,9 @@
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<Optimize>false</Optimize>
<CodeAnalysisRuleSet>
</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
Expand All @@ -77,37 +61,21 @@
<ManifestCertificateThumbprint>53F640C03978D30A7C6C1530038EC1B18B8D605E</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>FSTrAk_TemporaryKey.pfx</ManifestKeyFile>
<ManifestKeyFile>
</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>FSTrAk.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<StartupObject>FSTRaK.App</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.FlightSimulator.SimConnect, Version=11.0.62651.3, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -151,6 +119,8 @@
<Compile Include="DataTypes\NearestAirportRequestType.cs" />
<Compile Include="DataTypes\Settings.cs" />
<Compile Include="DataTypes\SimConnectDataTypes.cs" />
<Compile Include="Models\AirportResolver.cs" />
<Compile Include="Models\Entity\Airport.cs" />
<Compile Include="Models\Entity\FlightEvent\StallWarningEvent.cs" />
<Compile Include="Models\Entity\FlightEvent\OverspeedEvent.cs" />
<Compile Include="Models\Entity\FlightEvent\GearspeedExceededEvent.cs" />
Expand Down Expand Up @@ -183,7 +153,9 @@
<Compile Include="Models\FlightManager\State\TaxiInState.cs" />
<Compile Include="Models\FlightManager\State\TaxiOutState.cs" />
<Compile Include="RelayCommand.cs" />
<Compile Include="Utils\FlightExtentionMethods.cs" />
<Compile Include="Utils\MathUtils.cs" />
<Compile Include="Utils\ResourceUtils.cs" />
<Compile Include="ViewModels\FlightDetailsViewModel.cs" />
<Compile Include="ViewModels\LogbookViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModel.cs" />
Expand Down Expand Up @@ -282,7 +254,6 @@
<None Include="Properties\DataSources\FSTRaK.Models.CrashEvent.datasource" />
<None Include="Properties\DataSources\FSTRaK.Models.Flight.datasource" />
<None Include="Properties\DataSources\FSTRaK.Models.FlightEndedEvent.datasource" />
<None Include="Properties\DataSources\FSTRaK.Models.FlightEvent.datasource" />
<None Include="Properties\DataSources\FSTRaK.Models.FlightStartedEvent.datasource" />
<None Include="Properties\DataSources\FSTRaK.Models.LandingEvent.datasource" />
<None Include="Properties\DataSources\FSTRaK.Models.ParkingEvent.datasource" />
Expand Down Expand Up @@ -320,6 +291,9 @@
<Content Include="sqlcese40.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Resources\Data\airports.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\Images\FSTrAk-Icon.xcf" />
<None Include="System.Data.SqlServerCe.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down Expand Up @@ -347,15 +321,24 @@
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf">
<Version>1.1.39</Version>
</PackageReference>
<PackageReference Include="ScottPlot.WPF">
<Version>4.1.64</Version>
</PackageReference>
<PackageReference Include="Serilog">
<Version>2.12.0</Version>
</PackageReference>
<PackageReference Include="Serilog.Exceptions">
<Version>8.4.0</Version>
</PackageReference>
<PackageReference Include="Serilog.Sinks.File">
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="Serilog.Sinks.Trace">
<Version>3.0.0</Version>
</PackageReference>
<PackageReference Include="System.Text.Json">
<Version>7.0.2</Version>
</PackageReference>
<PackageReference Include="XAML.MapControl">
<Version>8.1.0</Version>
</PackageReference>
Expand Down
Loading

0 comments on commit 21b024e

Please sign in to comment.