From 3db582a1ea0509d65338740659e51d33acca6a9d Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Sun, 12 Dec 2021 21:04:36 -0500 Subject: [PATCH] trying to figure out transitions. They seems to be kinda fucked, so idk --- .../Patcher/PatchClient/Assets/Styles.axaml | 25 + .../PatchClient/Models/LineItemProgress.cs | 15 +- .../ViewModels/PatcherViewModel.cs | 26 +- .../PatchClient/Views/PatcherView.axaml | 14 +- Patcher/_port/Patcher/Patcher/.gitignore | 454 ------------------ Patcher/_port/Patcher/Patcher/App.axaml | 12 - Patcher/_port/Patcher/Patcher/App.axaml.cs | 29 -- .../Patcher/Patcher/Assets/avalonia-logo.ico | Bin 176111 -> 0 bytes Patcher/_port/Patcher/Patcher/Patcher.csproj | 19 - Patcher/_port/Patcher/Patcher/Program.cs | 24 - Patcher/_port/Patcher/Patcher/ViewLocator.cs | 30 -- .../Patcher/ViewModels/MainWindowViewModel.cs | 11 - .../Patcher/ViewModels/ViewModelBase.cs | 11 - .../Patcher/Patcher/Views/MainWindow.axaml | 17 - .../Patcher/Patcher/Views/MainWindow.axaml.cs | 22 - 15 files changed, 62 insertions(+), 647 deletions(-) delete mode 100644 Patcher/_port/Patcher/Patcher/.gitignore delete mode 100644 Patcher/_port/Patcher/Patcher/App.axaml delete mode 100644 Patcher/_port/Patcher/Patcher/App.axaml.cs delete mode 100644 Patcher/_port/Patcher/Patcher/Assets/avalonia-logo.ico delete mode 100644 Patcher/_port/Patcher/Patcher/Patcher.csproj delete mode 100644 Patcher/_port/Patcher/Patcher/Program.cs delete mode 100644 Patcher/_port/Patcher/Patcher/ViewLocator.cs delete mode 100644 Patcher/_port/Patcher/Patcher/ViewModels/MainWindowViewModel.cs delete mode 100644 Patcher/_port/Patcher/Patcher/ViewModels/ViewModelBase.cs delete mode 100644 Patcher/_port/Patcher/Patcher/Views/MainWindow.axaml delete mode 100644 Patcher/_port/Patcher/Patcher/Views/MainWindow.axaml.cs 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 @@