From cf3c9b2240ad68d56afc58e3f7496271ec1566c0 Mon Sep 17 00:00:00 2001 From: Kalakoi Date: Tue, 27 May 2025 11:45:56 -0400 Subject: [PATCH] Created temporary window to test API calls. --- osrs-toolbox/Models/APITestModel.cs | 26 +++++++++++++++ osrs-toolbox/Models/HomePageModel.cs | 6 ++++ osrs-toolbox/ViewModels/APITestViewModel.cs | 22 +++++++++++++ osrs-toolbox/ViewModels/HomePageViewModel.cs | 15 +++++++++ osrs-toolbox/Views/APITestView.xaml | 22 +++++++++++++ osrs-toolbox/Views/APITestView.xaml.cs | 34 ++++++++++++++++++++ osrs-toolbox/Views/HomePageView.xaml | 1 + 7 files changed, 126 insertions(+) create mode 100644 osrs-toolbox/Models/APITestModel.cs create mode 100644 osrs-toolbox/ViewModels/APITestViewModel.cs create mode 100644 osrs-toolbox/Views/APITestView.xaml create mode 100644 osrs-toolbox/Views/APITestView.xaml.cs diff --git a/osrs-toolbox/Models/APITestModel.cs b/osrs-toolbox/Models/APITestModel.cs new file mode 100644 index 0000000..4e70b0c --- /dev/null +++ b/osrs-toolbox/Models/APITestModel.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace osrs_toolbox +{ + public abstract class APITestModel : ModelBase + { + private string _testOutput; + private ICommand _testCall; + + public string TestOutput + { + get { return _testOutput; } + set { SetProperty(ref _testOutput, value, nameof(TestOutput)); } + } + public ICommand TestCall + { + get { return _testCall; } + set { SetProperty(ref _testCall, value, nameof(TestCall)); } + } + } +} diff --git a/osrs-toolbox/Models/HomePageModel.cs b/osrs-toolbox/Models/HomePageModel.cs index d10170e..4262926 100644 --- a/osrs-toolbox/Models/HomePageModel.cs +++ b/osrs-toolbox/Models/HomePageModel.cs @@ -15,6 +15,7 @@ namespace osrs_toolbox private ICommand _openDropChanceCalculator; private ICommand _openCombatLevelCalculator; private ICommand _openShopBuyoutCalculator; + private ICommand _openAPITest; public ICommand OpenCompetitionOverlaySettings { @@ -38,5 +39,10 @@ namespace osrs_toolbox get { return _openShopBuyoutCalculator; } set { SetProperty(ref _openShopBuyoutCalculator, value, nameof(OpenShopBuyoutCalculator)); } } + public ICommand OpenAPITest + { + get { return _openAPITest; } + set { SetProperty(ref _openAPITest, value, nameof(OpenAPITest)); } + } } } diff --git a/osrs-toolbox/ViewModels/APITestViewModel.cs b/osrs-toolbox/ViewModels/APITestViewModel.cs new file mode 100644 index 0000000..d2adbb5 --- /dev/null +++ b/osrs-toolbox/ViewModels/APITestViewModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace osrs_toolbox +{ + public class APITestViewModel : APITestModel + { + public APITestViewModel() + { + TestOutput = string.Empty; + TestCall = new RelayCommand(DoTest); + } + + private void DoTest(object obj) + { + + } + } +} diff --git a/osrs-toolbox/ViewModels/HomePageViewModel.cs b/osrs-toolbox/ViewModels/HomePageViewModel.cs index bacebc9..6cb544c 100644 --- a/osrs-toolbox/ViewModels/HomePageViewModel.cs +++ b/osrs-toolbox/ViewModels/HomePageViewModel.cs @@ -26,6 +26,7 @@ namespace osrs_toolbox OpenDropChanceCalculator = new RelayCommand(DoOpenDropChanceCalculator); OpenCombatLevelCalculator = new RelayCommand(DoOpenCombatLevelCalculator); OpenShopBuyoutCalculator = new RelayCommand(DoOpenShopBuyoutCalculator); + OpenAPITest = new RelayCommand(DoOpenAPITest); } private void DoOpenCompetitionOverlaySettings(object obj) @@ -83,5 +84,19 @@ namespace osrs_toolbox sbv.Show(); } } + + private void DoOpenAPITest(object obj) + { + if (APITestView.Current != null) + { + APITestView.Current.Close(); + APITestView.Current = null; + } + else + { + APITestView atv = new APITestView(); + atv.Show(); + } + } } } diff --git a/osrs-toolbox/Views/APITestView.xaml b/osrs-toolbox/Views/APITestView.xaml new file mode 100644 index 0000000..369dc15 --- /dev/null +++ b/osrs-toolbox/Views/APITestView.xaml @@ -0,0 +1,22 @@ + + + + + + + + + +