-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1st release - Essentually working codebase
- Loading branch information
John
authored and
John
committed
Aug 1, 2023
1 parent
43148d2
commit a89672c
Showing
44 changed files
with
2,965 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,43 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<configSections> | ||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > | ||
<section name="Lside_Mixture.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> | ||
</sectionGroup> | ||
</configSections> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
<userSettings> | ||
<Lside_Mixture.Properties.Settings> | ||
<setting name="RpmDropThreshold" serializeAs="String"> | ||
<value>200</value> | ||
</setting> | ||
<setting name="EgtDropThreshold" serializeAs="String"> | ||
<value>100</value> | ||
</setting> | ||
<setting name="TempStabilisedThreshold" serializeAs="String"> | ||
<value>2</value> | ||
</setting> | ||
<setting name="EgtChangeWaitDelayMSec" serializeAs="String"> | ||
<value>10000</value> | ||
</setting> | ||
</Lside_Mixture.Properties.Settings> | ||
</userSettings> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
<Application x:Class="Lside_Mixture.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:Lside_Mixture" | ||
StartupUri="MainWindow.xaml"> | ||
xmlns:local="clr-namespace:Lside_Mixture"> | ||
|
||
<Application.Resources> | ||
|
||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Styles/DataGrid.xaml"/> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
|
||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,79 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace Lside_Mixture | ||
namespace Lside_Mixture | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
using System; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using Lside_Mixture.Services; | ||
using Lside_Mixture.Views; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Serilog; | ||
|
||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
Log.Logger = new LoggerConfiguration() | ||
.MinimumLevel.Information() | ||
.WriteTo.Console() | ||
.CreateLogger(); | ||
|
||
this.Services = ConfigureServices(); | ||
this.ShutdownMode = ShutdownMode.OnMainWindowClose; | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Gets the current application | ||
/// note: Not a Lamdba, just a expression-bodied member 'syntax' defining a read-only Property. | ||
/// </summary> | ||
public static new App Current => (App)Application.Current; | ||
|
||
// IOC provider | ||
public IServiceProvider Services { get; } | ||
|
||
protected override void OnStartup(StartupEventArgs e) | ||
{ | ||
base.OnStartup(e); | ||
this.SetupExceptionHandling(); | ||
|
||
MainWindow window = new MainWindow(); | ||
window.Show(); | ||
} | ||
|
||
private static IServiceProvider ConfigureServices() | ||
{ | ||
var services = new ServiceCollection(); | ||
|
||
services.AddSingleton<ISimService, SimService>(); | ||
|
||
return services.BuildServiceProvider(); | ||
} | ||
|
||
private void SetupExceptionHandling() | ||
{ | ||
AppDomain.CurrentDomain.UnhandledException += (s, e) => | ||
this.LogUnhandledException((Exception)e.ExceptionObject, "AppDomain.CurrentDomain.UnhandledException"); | ||
|
||
this.DispatcherUnhandledException += (s, e) => | ||
{ | ||
this.LogUnhandledException(e.Exception, "Application.Current.DispatcherUnhandledException"); | ||
e.Handled = true; | ||
}; | ||
|
||
TaskScheduler.UnobservedTaskException += (s, e) => | ||
{ | ||
this.LogUnhandledException(e.Exception, "TaskScheduler.UnobservedTaskException"); | ||
e.SetObserved(); | ||
}; | ||
} | ||
|
||
private void LogUnhandledException(Exception e, string source) | ||
{ | ||
MessageBox.Show($"{source} - {e.Message}"); | ||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); | ||
string logout = "\n\n" + DateTime.Now.ToString() + "\n" + System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion + "\n" + | ||
e.Message + "\n" + e.Source + "\n" + e.StackTrace; | ||
System.IO.File.AppendAllText(@"./log.txt", logout); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Lside_Mixture.Common | ||
{ | ||
using CommunityToolkit.Mvvm.Messaging.Messages; | ||
|
||
public class CaptureAndGraphLeaningMessage : RequestMessage<string> | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
namespace Gauge | ||
{ | ||
using System; | ||
using System.ComponentModel; | ||
public class GaugeViewModel : INotifyPropertyChanged | ||
{ | ||
|
||
private double minValue; | ||
private double maxValue; | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
private void NotifyPropertyChanged(string info) | ||
{ | ||
if(PropertyChanged!= null) | ||
{ | ||
PropertyChanged(this, new PropertyChangedEventArgs(info)); | ||
} | ||
} | ||
|
||
public GaugeViewModel() | ||
{ | ||
Angle = -85; | ||
Value = 0; | ||
} | ||
|
||
public GaugeViewModel(double minValue, double maxValue) | ||
{ | ||
Angle = -85; | ||
Value = 0; | ||
this.minValue = minValue; | ||
this.maxValue = maxValue; | ||
} | ||
|
||
int _angle; | ||
|
||
// 0 to 170 usage | ||
public int Angle | ||
{ | ||
get | ||
{ | ||
return _angle; | ||
} | ||
|
||
private set | ||
{ | ||
_angle = value; | ||
NotifyPropertyChanged("Angle"); | ||
} | ||
} | ||
|
||
// minValue to maxValue usage | ||
public int ScaledValue | ||
{ | ||
get | ||
{ | ||
return _value; | ||
} | ||
|
||
set | ||
{ | ||
_value = value; | ||
Angle = Convert.ToInt32((170.0 / this.maxValue) * (value - this.minValue)); | ||
NotifyPropertyChanged("Value"); | ||
} | ||
} | ||
|
||
int _value; | ||
public int Value | ||
{ | ||
get | ||
{ | ||
return _value; | ||
} | ||
|
||
set | ||
{ | ||
if (value >= 0 && value <= 170) | ||
{ | ||
_value = value; | ||
Angle = value - 85; | ||
NotifyPropertyChanged("Value"); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" 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> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{59BA7115-277A-4CB0-A039-B216AC0D87E1}</ProjectGuid> | ||
<OutputType>library</OutputType> | ||
<RootNamespace>GuageUserControl</RootNamespace> | ||
<AssemblyName>GuageUserControl</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<WarningLevel>4</WarningLevel> | ||
<Deterministic>true</Deterministic> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<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' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xaml"> | ||
<RequiredTargetFramework>4.0</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="WindowsBase" /> | ||
<Reference Include="PresentationCore" /> | ||
<Reference Include="PresentationFramework" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="UserControlGauge.xaml.cs"> | ||
<DependentUpon>UserControlGauge.xaml</DependentUpon> | ||
</Compile> | ||
<Compile Include="GaugeViewModel.cs" /> | ||
<Page Include="UserControlGauge.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
<SubType>Designer</SubType> | ||
</Page> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\AssemblyInfo.cs"> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
<Compile Include="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<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="Properties\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||
</None> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Reflection; | ||
using System.Resources; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using System.Windows; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("GuageUserControl")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("GuageUserControl")] | ||
[assembly: AssemblyCopyright("Copyright © 2023")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
//In order to begin building localizable applications, set | ||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file | ||
//inside a <PropertyGroup>. For example, if you are using US english | ||
//in your source files, set the <UICulture> to en-US. Then uncomment | ||
//the NeutralResourceLanguage attribute below. Update the "en-US" in | ||
//the line below to match the UICulture setting in the project file. | ||
|
||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] | ||
|
||
|
||
[assembly:ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] | ||
|
||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// 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.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Oops, something went wrong.