Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Now highlighting differences between two selected aircraft types #86

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ insert_final_newline = false

# Organize usings
dotnet_separate_import_directive_groups = true
file_header_template = --------------------------------------------------------------------------------------------------------------------\n<copyright file="{fileName}" company="OpenSky">\nOpenSky project 2021-2023\n</copyright>\n--------------------------------------------------------------------------------------------------------------------
file_header_template = --------------------------------------------------------------------------------------------------------------------\n<copyright file="${File.FileName}" company="OpenSky">\nOpenSky project 2021-${CurrentDate.Year}\n</copyright>\n--------------------------------------------------------------------------------------------------------------------

# this. and Me. preferences
dotnet_style_qualification_for_event = true:suggestion
Expand Down
4 changes: 2 additions & 2 deletions OpenSky.Agent.SimConnectMSFS/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("1f9cbede-669d-4510-bca2-e6ad29d6a498")]
[assembly: AssemblyVersion("0.5.7")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: AssemblyVersion("0.5.8")]
[assembly: AssemblyFileVersion("0.5.8")]
4 changes: 2 additions & 2 deletions OpenSky.Agent.Simulator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("30c467e8-2eee-41e5-be01-0142a61ba171")]
[assembly: AssemblyVersion("0.5.7")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: AssemblyVersion("0.5.8")]
[assembly: AssemblyFileVersion("0.5.8")]
4 changes: 2 additions & 2 deletions OpenSky.Agent.UdpXPlane11/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("dfbda2b8-5775-4766-be86-d729fcf20de1")]
[assembly: AssemblyVersion("0.5.7")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: AssemblyVersion("0.5.8")]
[assembly: AssemblyFileVersion("0.5.8")]
4 changes: 2 additions & 2 deletions OpenSky.Agent/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("0.5.7")]
[assembly: AssemblyFileVersion("0.5.7")]
[assembly: AssemblyVersion("0.5.8")]
[assembly: AssemblyFileVersion("0.5.8")]

// This allows us to detect debug mode in XAML
#if DEBUG
Expand Down
32 changes: 32 additions & 0 deletions OpenSky.Agent/Views/AircraftTypes.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,38 @@
<Border Grid.Row="34" Grid.Column="0" Grid.ColumnSpan="3" BorderThickness="0,0,0,1" Background="Transparent" BorderBrush="{StaticResource GreyDottedBrush}" />
<Border Grid.Row="35" Grid.Column="0" Grid.ColumnSpan="3" BorderThickness="0,0,0,1" Background="Transparent" BorderBrush="{StaticResource GreyDottedBrush}" />

<Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[1]}" />
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[2]}" />
<Border Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[3]}" />
<Border Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[4]}" />
<Border Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[5]}" />
<Border Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[6]}" />
<Border Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[7]}" />
<Border Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[8]}" />
<Border Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[9]}" />
<Border Grid.Row="12" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[12]}" />
<Border Grid.Row="13" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[13]}" />
<Border Grid.Row="14" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[14]}" />
<Border Grid.Row="15" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[15]}" />
<Border Grid.Row="16" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[16]}" />
<Border Grid.Row="17" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[17]}" />
<Border Grid.Row="18" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[18]}" />
<Border Grid.Row="19" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[19]}" />
<Border Grid.Row="20" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[20]}" />
<Border Grid.Row="21" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[21]}" />
<Border Grid.Row="22" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[22]}" />
<Border Grid.Row="23" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[23]}" />
<Border Grid.Row="24" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[24]}" />
<Border Grid.Row="25" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[25]}" />
<Border Grid.Row="26" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[26]}" />
<Border Grid.Row="27" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[27]}" />
<Border Grid.Row="28" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[28]}" />
<Border Grid.Row="29" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[29]}" />
<Border Grid.Row="30" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[30]}" />
<Border Grid.Row="31" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[31]}" />
<Border Grid.Row="32" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[32]}" />
<Border Grid.Row="33" Grid.Column="0" Grid.ColumnSpan="3" Background="{StaticResource OpenSkyTealBrush}" Margin="0,6,0,1" Visibility="{Binding MatchingVisibilities[33]}" />

<TextBlock Grid.Column="0" Grid.Row="1" Margin="0,5,10,0">Manufacturer</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="2" Margin="0,5,10,0">Manufacturer airports</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="3" Margin="0,5,10,0">Category</TextBlock>
Expand Down
84 changes: 84 additions & 0 deletions OpenSky.Agent/Views/Models/AircraftTypesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ public AircraftTypesViewModel()
this.SelectedAircraftTypes = new ObservableCollection<AircraftType>();
this.Manufacturers = new ObservableCollection<AircraftManufacturer>();
this.AircraftUpgrades = new ObservableCollection<AircraftTypeUpgrade>();
this.MatchingVisibilities = new ObservableCollection<Visibility>();
for (var i = 0; i < 34; i++)
{
this.MatchingVisibilities.Add(Visibility.Collapsed);
}

this.GetUserRolesCommand = new AsynchronousCommand(this.GetUserRoles);
this.RefreshAircraftTypesCommand = new AsynchronousCommand(this.RefreshAircraftTypes);
Expand Down Expand Up @@ -305,6 +310,9 @@ public AircraftTypesViewModel()

this.GetUserRolesCommand.DoExecute(null);
this.GetAircraftManufacturersCommand.DoExecute(null);

// Make sure we can update the matches visibilities
this.SelectedAircraftTypes.CollectionChanged += this.SelectedAircraftTypesCollectionChanged;
}

/// -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -789,6 +797,13 @@ public string ManufacturerDeliveryAirportICAOs
/// -------------------------------------------------------------------------------------------------
public ObservableCollection<AircraftManufacturer> Manufacturers { get; }

/// -------------------------------------------------------------------------------------------------
/// <summary>
/// Gets the matching visibilities (when comparing two aircraft types).
/// </summary>
/// -------------------------------------------------------------------------------------------------
public ObservableCollection<Visibility> MatchingVisibilities { get; }

/// -------------------------------------------------------------------------------------------------
/// <summary>
/// Gets or sets the maximum price.
Expand Down Expand Up @@ -2140,6 +2155,75 @@ private void SaveEditedAircraftType()
}
}

/// -------------------------------------------------------------------------------------------------
/// <summary>
/// Selected aircraft types collection changed - let's compare what is equal and what isn't.
/// </summary>
/// <remarks>
/// sushi.at, 09/12/2023.
/// </remarks>
/// <param name="sender">
/// Source of the event.
/// </param>
/// <param name="e">
/// Notify collection changed event information.
/// </param>
/// -------------------------------------------------------------------------------------------------
private void SelectedAircraftTypesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (this.SelectedAircraftTypes.Count != 2)
{
for (var i = 0; i < 34; i++)
{
this.MatchingVisibilities[i] = Visibility.Collapsed;
}
}
else
{
// 0 ... name, version, etc., doesn't make sense to compare
this.MatchingVisibilities[1] = !string.Equals(this.SelectedAircraftTypes[0].ManufacturerID, this.SelectedAircraftTypes[1].ManufacturerID, StringComparison.InvariantCultureIgnoreCase) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[2] = !string.Equals(this.SelectedAircraftTypes[0].ManufacturerDeliveryLocationICAOs, this.SelectedAircraftTypes[1].ManufacturerDeliveryLocationICAOs, StringComparison.InvariantCultureIgnoreCase)
? Visibility.Visible
: Visibility.Collapsed;
this.MatchingVisibilities[3] = !Equals(this.SelectedAircraftTypes[0].Category, this.SelectedAircraftTypes[1].Category) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[4] = !Equals(this.SelectedAircraftTypes[0].Simulator, this.SelectedAircraftTypes[1].Simulator) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[5] = !Equals(this.SelectedAircraftTypes[0].Enabled, this.SelectedAircraftTypes[1].Enabled) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[6] = !Equals(this.SelectedAircraftTypes[0].DetailedChecksDisabled, this.SelectedAircraftTypes[1].DetailedChecksDisabled) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[7] = !Equals(this.SelectedAircraftTypes[0].IsVanilla, this.SelectedAircraftTypes[1].IsVanilla) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[8] = !Equals(this.SelectedAircraftTypes[0].IncludeInWorldPopulation, this.SelectedAircraftTypes[1].IncludeInWorldPopulation) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[9] = !Equals(this.SelectedAircraftTypes[0].IsHistoric, this.SelectedAircraftTypes[1].IsHistoric) ? Visibility.Visible : Visibility.Collapsed;

// 10 ... next version, doesn't make sense to compare
// 11 ... variant of, doesn't make sensor to compare
this.MatchingVisibilities[12] = !Equals(this.SelectedAircraftTypes[0].AtcType, this.SelectedAircraftTypes[1].AtcType) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[13] = !Equals(this.SelectedAircraftTypes[0].AtcModel, this.SelectedAircraftTypes[1].AtcModel) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[14] = !Equals(this.SelectedAircraftTypes[0].EmptyWeight, this.SelectedAircraftTypes[1].EmptyWeight) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[15] = !Equals(this.SelectedAircraftTypes[0].OverrideFuelType, this.SelectedAircraftTypes[1].OverrideFuelType) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[16] = !Equals(this.SelectedAircraftTypes[0].FuelTotalCapacity, this.SelectedAircraftTypes[1].FuelTotalCapacity) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[17] = !Equals(this.SelectedAircraftTypes[0].FuelWeightPerGallon, this.SelectedAircraftTypes[1].FuelWeightPerGallon) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[18] = !Equals(this.SelectedAircraftTypes[0].MaxGrossWeight, this.SelectedAircraftTypes[1].MaxGrossWeight) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[19] = !Equals(this.SelectedAircraftTypes[0].EngineType, this.SelectedAircraftTypes[1].EngineType) || !Equals(this.SelectedAircraftTypes[0].EngineCount, this.SelectedAircraftTypes[1].EngineCount)
? Visibility.Visible
: Visibility.Collapsed;
this.MatchingVisibilities[20] = !string.Equals(this.SelectedAircraftTypes[0].EngineModel, this.SelectedAircraftTypes[1].EngineModel, StringComparison.InvariantCultureIgnoreCase) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[21] = !Equals(this.SelectedAircraftTypes[0].FlapsAvailable, this.SelectedAircraftTypes[1].FlapsAvailable) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[22] = !Equals(this.SelectedAircraftTypes[0].IsGearRetractable, this.SelectedAircraftTypes[1].IsGearRetractable) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[23] = !Equals(this.SelectedAircraftTypes[0].MinimumRunwayLength, this.SelectedAircraftTypes[1].MinimumRunwayLength) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[24] = !Equals(this.SelectedAircraftTypes[0].MinPrice, this.SelectedAircraftTypes[1].MinPrice) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[25] = !Equals(this.SelectedAircraftTypes[0].MaxPrice, this.SelectedAircraftTypes[1].MaxPrice) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[26] = !Equals(this.SelectedAircraftTypes[0].NeedsCoPilot, this.SelectedAircraftTypes[1].NeedsCoPilot) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[27] = !Equals(this.SelectedAircraftTypes[0].NeedsFlightEngineer, this.SelectedAircraftTypes[1].NeedsFlightEngineer) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[28] = !Equals(this.SelectedAircraftTypes[0].RequiresManualFuelling, this.SelectedAircraftTypes[1].RequiresManualFuelling) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[29] = !Equals(this.SelectedAircraftTypes[0].RequiresManualLoading, this.SelectedAircraftTypes[1].RequiresManualLoading) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[30] = !Equals(this.SelectedAircraftTypes[0].MaxPayloadDeltaAllowed, this.SelectedAircraftTypes[1].MaxPayloadDeltaAllowed) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[31] = !Equals(this.SelectedAircraftTypes[0].UsesStrobeForBeacon, this.SelectedAircraftTypes[1].UsesStrobeForBeacon) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[32] = !Equals(this.SelectedAircraftTypes[0].IcaoTypeDesignator, this.SelectedAircraftTypes[1].IcaoTypeDesignator) ? Visibility.Visible : Visibility.Collapsed;
this.MatchingVisibilities[33] = !Equals(this.SelectedAircraftTypes[0].HasAircraftImage, this.SelectedAircraftTypes[1].HasAircraftImage) ? Visibility.Visible : Visibility.Collapsed;
}

this.NotifyPropertyChanged(nameof(this.MatchingVisibilities));
}

/// -------------------------------------------------------------------------------------------------
/// <summary>
/// Starts add aircraft.
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
OpenSky Flight Tracking Agent Changelog
======================================================================================

--------------------------------------------------------------------------------------
Version 0.5.8 (ALPHA5)
--------------------------------------------------------------------------------------
- Now highlighting differences between two selected aircraft types

--------------------------------------------------------------------------------------
Version 0.5.7 (ALPHA5)
--------------------------------------------------------------------------------------
Expand Down