From 322a8c3e2a829caa742f809187f22de5d247d829 Mon Sep 17 00:00:00 2001 From: Jannik Becker Date: Sun, 11 Sep 2022 21:15:34 +0200 Subject: [PATCH 1/4] Hide update link if app is not managed by squirrel --- Leibit.BLL/UpdateBLL.cs | 8 ++++++++ .../Windows/About/ViewModels/AboutViewModel.cs | 15 ++++++++++++++- .../Windows/About/Views/AboutView.xaml | 17 +++++++++++------ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/Leibit.BLL/UpdateBLL.cs b/Leibit.BLL/UpdateBLL.cs index ee1dc442..0ddf4b3c 100644 --- a/Leibit.BLL/UpdateBLL.cs +++ b/Leibit.BLL/UpdateBLL.cs @@ -38,6 +38,14 @@ public UpdateBLL(string updateUrl) public event EventHandler UpdateProgress; #endregion + #region - Properties - + + #region [IsManagedBySquirrel] + public bool IsManagedBySquirrel => m_UpdateExe != null; + #endregion + + #endregion + #region - Public methods - #region [CreateGitHub] diff --git a/Leibit.Client.WPF/Windows/About/ViewModels/AboutViewModel.cs b/Leibit.Client.WPF/Windows/About/ViewModels/AboutViewModel.cs index cb773e61..5cac68c9 100644 --- a/Leibit.Client.WPF/Windows/About/ViewModels/AboutViewModel.cs +++ b/Leibit.Client.WPF/Windows/About/ViewModels/AboutViewModel.cs @@ -31,6 +31,12 @@ public AboutViewModel() var decoder = BitmapDecoder.Create(new Uri("pack://application:,,,/Leibit;component/icon.ico"), BitmapCreateOptions.DelayCreation, BitmapCacheOption.OnDemand); var maxWidth = decoder.Frames.Max(f => f.Width); Icon = decoder.Frames.FirstOrDefault(f => f.Width == maxWidth); + + UpdateHelper.GetUpdateBLL().ContinueWith(t => + { + m_UpdateBll = t.Result; + CanInstallUpdates = m_UpdateBll.IsManagedBySquirrel; + }); } #endregion @@ -140,6 +146,14 @@ public string VersionStatusText } #endregion + #region [CanInstallUpdates] + public bool CanInstallUpdates + { + get => Get(); + private set => Set(value); + } + #endregion + #endregion #region - Private methods - @@ -164,7 +178,6 @@ private void __CheckForUpdates() Task.Run(async () => { - m_UpdateBll = await UpdateHelper.GetUpdateBLL(); var checkForUpdateResult = await m_UpdateBll.CheckForUpdates(); Application.Current?.Dispatcher?.Invoke(() => diff --git a/Leibit.Client.WPF/Windows/About/Views/AboutView.xaml b/Leibit.Client.WPF/Windows/About/Views/AboutView.xaml index 414f1ab3..32414bd9 100644 --- a/Leibit.Client.WPF/Windows/About/Views/AboutView.xaml +++ b/Leibit.Client.WPF/Windows/About/Views/AboutView.xaml @@ -31,16 +31,21 @@ - + https://github.com/jannikbecker/leibit - - - - Nach Updates suchen - + + + + + + + + Nach Updates suchen + + From 2f107881ca1b1b9db0777d9e482785a7097de574 Mon Sep 17 00:00:00 2001 From: Jannik Becker Date: Wed, 5 Oct 2022 18:09:41 +0200 Subject: [PATCH 2/4] Fix disappearing trains when ESTW times are not sync --- .../Display/ViewModels/DisplayViewModelBase.cs | 11 +++++++++-- .../TrainProgressInformationViewModel.cs | 14 +++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Leibit.Client.WPF/Windows/Display/ViewModels/DisplayViewModelBase.cs b/Leibit.Client.WPF/Windows/Display/ViewModels/DisplayViewModelBase.cs index da3f9b21..910d3355 100644 --- a/Leibit.Client.WPF/Windows/Display/ViewModels/DisplayViewModelBase.cs +++ b/Leibit.Client.WPF/Windows/Display/ViewModels/DisplayViewModelBase.cs @@ -90,10 +90,17 @@ protected List GetScheduleCandidates(Area area, int leadMinutes, b } else { + LeibitTime trainLiveTime; + + if (liveSchedule.Train.Block != null && liveSchedule.Train.Block.Track != null) + trainLiveTime = liveSchedule.Train.Block.Track.Station.ESTW.Time; + else + trainLiveTime = area.ESTWs.Where(e => e.IsLoaded).Min(e => e.Time); + if (liveSchedule.IsDeparted) continue; - if (schedule.Handling == eHandling.Destination && schedule.Station.ESTW.Time > liveSchedule.Train.LastModified) + if (schedule.Handling == eHandling.Destination && trainLiveTime > liveSchedule.Train.LastModified) continue; if (matchTrack && schedule.Track != SelectedTrack && schedule.Track != SelectedTrack.Parent && liveSchedule.LiveTrack != SelectedTrack && liveSchedule.LiveTrack != SelectedTrack.Parent) @@ -117,7 +124,7 @@ protected List GetScheduleCandidates(Area area, int leadMinutes, b if (referenceTime > currentTime.AddMinutes(leadMinutes)) continue; - if (referenceTime < currentTime && liveSchedule.Train.LastModified < currentTime) + if (referenceTime < currentTime && liveSchedule.Train.LastModified < trainLiveTime) continue; candidates.Add(new ScheduleItem(referenceTime, schedule, liveSchedule)); diff --git a/Leibit.Client.WPF/Windows/TrainProgressInformation/ViewModels/TrainProgressInformationViewModel.cs b/Leibit.Client.WPF/Windows/TrainProgressInformation/ViewModels/TrainProgressInformationViewModel.cs index b7b55ec7..6274213a 100644 --- a/Leibit.Client.WPF/Windows/TrainProgressInformation/ViewModels/TrainProgressInformationViewModel.cs +++ b/Leibit.Client.WPF/Windows/TrainProgressInformation/ViewModels/TrainProgressInformationViewModel.cs @@ -549,7 +549,19 @@ Scheduled time | Visible | Reason return false; } - if (liveSchedule.Train.Schedules.All(s => !s.IsArrived) && liveSchedule.Train.LastModified < schedule.Station.ESTW.Time && !liveSchedule.IsManuallyModified) + // Hide trains that are gone and did not arrive at one station. + // This is usually the case at the beginning of the simulation when a train already has left the last station and is about to disappear. + // To determine if a train is gone, the LastModified time is checked. + // As times between ESTWs can differ, we need to determine the correct time for comparison. + // This is the time of the last station the train has passed, or the smallest time by default. + LeibitTime trainLiveTime; + + if (liveSchedule.Train.Block != null && liveSchedule.Train.Block.Track != null) + trainLiveTime = liveSchedule.Train.Block.Track.Station.ESTW.Time; + else + trainLiveTime = m_Area.ESTWs.Where(e => e.IsLoaded).Min(e => e.Time); + + if (liveSchedule.Train.Schedules.All(s => !s.IsArrived) && liveSchedule.Train.LastModified < trainLiveTime && !liveSchedule.IsManuallyModified) return false; return true; From 5c6df98e8b9e0a2a7b89d7ea2338ce1c1908f56f Mon Sep 17 00:00:00 2001 From: Jannik Becker Date: Wed, 5 Oct 2022 18:13:04 +0200 Subject: [PATCH 3/4] Bump version to 1.0.0 --- Leibit.Client.WPF/Leibit.Client.WPF.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Leibit.Client.WPF/Leibit.Client.WPF.csproj b/Leibit.Client.WPF/Leibit.Client.WPF.csproj index 9a650302..f482c226 100644 --- a/Leibit.Client.WPF/Leibit.Client.WPF.csproj +++ b/Leibit.Client.WPF/Leibit.Client.WPF.csproj @@ -26,7 +26,7 @@ icon.ico - 0.6.2 + 1.0.0 https://github.com/jannikbecker/leibit https://github.com/jannikbecker/leibit app.manifest From bc1b914b4d8521c2f44b395774b9c586adfcc455 Mon Sep 17 00:00:00 2001 From: Jannik Becker Date: Wed, 5 Oct 2022 18:13:48 +0200 Subject: [PATCH 4/4] Release notes for version 1.0.0 --- assets/release_notes.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/assets/release_notes.md b/assets/release_notes.md index 24447f79..6b1fcf41 100644 --- a/assets/release_notes.md +++ b/assets/release_notes.md @@ -2,5 +2,4 @@ Die Datei *Setup.exe* herunterladen und ausführen. Nach wenigen Sekunden startet LeiBIT. # Neue Funktionen in dieser Version -- Fehlerkorrekturen -- Update ESTWonline auf Version 2.7 \ No newline at end of file +- Fehlerkorrekturen \ No newline at end of file