diff --git a/Patcher/_port/Patcher/PatchClient/Assets/Styles.axaml b/Patcher/_port/Patcher/PatchClient/Assets/Styles.axaml index 63e2d9a..7a7c3d2 100644 --- a/Patcher/_port/Patcher/PatchClient/Assets/Styles.axaml +++ b/Patcher/_port/Patcher/PatchClient/Assets/Styles.axaml @@ -10,4 +10,29 @@ + + + + diff --git a/Patcher/_port/Patcher/PatchClient/Models/LineItemProgress.cs b/Patcher/_port/Patcher/PatchClient/Models/LineItemProgress.cs index 4fcf225..36264b9 100644 --- a/Patcher/_port/Patcher/PatchClient/Models/LineItemProgress.cs +++ b/Patcher/_port/Patcher/PatchClient/Models/LineItemProgress.cs @@ -6,6 +6,13 @@ namespace PatchClient.Models { public class LineItemProgress : ReactiveObject { + private bool _Completed = false; + public bool Completed + { + get => _Completed; + set => this.RaiseAndSetIfChanged(ref _Completed, value); + } + private int total = 0; private string _Info = ""; @@ -22,9 +29,13 @@ namespace PatchClient.Models set => this.RaiseAndSetIfChanged(ref _Progress, value); } - public void UpdateProgress(int Count) + public void UpdateProgress(int RemainingCount) { - Progress = (int)Math.Floor((double)Count / total * 100); + if (Completed) return; //this doesn't work right ... need to look at it. + + Progress = (int)Math.Floor((double)RemainingCount / total * 100); + + if (Progress == 100) Completed = true; } public LineItemProgress(LineItem Item) diff --git a/Patcher/_port/Patcher/PatchClient/ViewModels/PatcherViewModel.cs b/Patcher/_port/Patcher/PatchClient/ViewModels/PatcherViewModel.cs index d12b0fd..75a910a 100644 --- a/Patcher/_port/Patcher/PatchClient/ViewModels/PatcherViewModel.cs +++ b/Patcher/_port/Patcher/PatchClient/ViewModels/PatcherViewModel.cs @@ -4,11 +4,8 @@ using PatcherUtils; using Splat; using System; using ReactiveUI; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Avalonia.Controls.ApplicationLifetimes; using System.Collections.ObjectModel; namespace PatchClient.ViewModels @@ -26,11 +23,11 @@ namespace PatchClient.ViewModels set => this.RaiseAndSetIfChanged(ref _ProgressMessage, value); } - private int _PatchProgress; - public int PatchProgress + private int _PatchPercent; + public int PatchPercent { - get => _PatchProgress; - set => this.RaiseAndSetIfChanged(ref _PatchProgress, value); + get => _PatchPercent; + set => this.RaiseAndSetIfChanged(ref _PatchPercent, value); } private string _PatchMessage; @@ -44,7 +41,7 @@ namespace PatchClient.ViewModels public PatcherViewModel() { - Test(); + RunPatcher(); } [Obsolete] @@ -63,7 +60,7 @@ namespace PatchClient.ViewModels for (int i = 0; i <= 100; i++) { System.Threading.Thread.Sleep(20); - PatchProgress = i; + PatchPercent = i; ProgressMessage = $"Patching @ {i}%"; foreach(var item in LineItems) @@ -72,7 +69,7 @@ namespace PatchClient.ViewModels } } - navigator.SelectedViewModel = new MessageViewModel("Patch completed without issues"); + //navigator.SelectedViewModel = new MessageViewModel("Patch completed without issues"); }); } @@ -92,7 +89,7 @@ namespace PatchClient.ViewModels { if (bp.Run()) { - navigator.SelectedViewModel = new MessageViewModel("Patch completed without issues"); + //navigator.SelectedViewModel = new MessageViewModel("Patch completed without issues"); } else { @@ -110,8 +107,11 @@ namespace PatchClient.ViewModels { foreach (LineItem item in AdditionalLineItems) { + if (item.ItemValue <= 0) continue; + if(initLineItemProgress) { + LineItems.Add(new LineItemProgress(item)); } @@ -120,14 +120,14 @@ namespace PatchClient.ViewModels initLineItemProgress = false; - PatchProgress = Progress; + PatchPercent = Percent; if (!string.IsNullOrWhiteSpace(Message)) { PatchMessage = Message; } - ProgressMessage = $"Patching @ {Percent}%"; + ProgressMessage = $"Patching: {Progress} / {Total} - {Percent}%"; } } } diff --git a/Patcher/_port/Patcher/PatchClient/Views/PatcherView.axaml b/Patcher/_port/Patcher/PatchClient/Views/PatcherView.axaml index 438b89c..128539f 100644 --- a/Patcher/_port/Patcher/PatchClient/Views/PatcherView.axaml +++ b/Patcher/_port/Patcher/PatchClient/Views/PatcherView.axaml @@ -7,10 +7,13 @@ x:Class="PatchClient.Views.PatcherView"> + + + @@ -19,7 +22,7 @@