Created temporary window to test API calls.
This commit is contained in:
26
osrs-toolbox/Models/APITestModel.cs
Normal file
26
osrs-toolbox/Models/APITestModel.cs
Normal file
@@ -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)); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -15,6 +15,7 @@ namespace osrs_toolbox
|
|||||||
private ICommand _openDropChanceCalculator;
|
private ICommand _openDropChanceCalculator;
|
||||||
private ICommand _openCombatLevelCalculator;
|
private ICommand _openCombatLevelCalculator;
|
||||||
private ICommand _openShopBuyoutCalculator;
|
private ICommand _openShopBuyoutCalculator;
|
||||||
|
private ICommand _openAPITest;
|
||||||
|
|
||||||
public ICommand OpenCompetitionOverlaySettings
|
public ICommand OpenCompetitionOverlaySettings
|
||||||
{
|
{
|
||||||
@@ -38,5 +39,10 @@ namespace osrs_toolbox
|
|||||||
get { return _openShopBuyoutCalculator; }
|
get { return _openShopBuyoutCalculator; }
|
||||||
set { SetProperty(ref _openShopBuyoutCalculator, value, nameof(OpenShopBuyoutCalculator)); }
|
set { SetProperty(ref _openShopBuyoutCalculator, value, nameof(OpenShopBuyoutCalculator)); }
|
||||||
}
|
}
|
||||||
|
public ICommand OpenAPITest
|
||||||
|
{
|
||||||
|
get { return _openAPITest; }
|
||||||
|
set { SetProperty(ref _openAPITest, value, nameof(OpenAPITest)); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
osrs-toolbox/ViewModels/APITestViewModel.cs
Normal file
22
osrs-toolbox/ViewModels/APITestViewModel.cs
Normal file
@@ -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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -26,6 +26,7 @@ namespace osrs_toolbox
|
|||||||
OpenDropChanceCalculator = new RelayCommand(DoOpenDropChanceCalculator);
|
OpenDropChanceCalculator = new RelayCommand(DoOpenDropChanceCalculator);
|
||||||
OpenCombatLevelCalculator = new RelayCommand(DoOpenCombatLevelCalculator);
|
OpenCombatLevelCalculator = new RelayCommand(DoOpenCombatLevelCalculator);
|
||||||
OpenShopBuyoutCalculator = new RelayCommand(DoOpenShopBuyoutCalculator);
|
OpenShopBuyoutCalculator = new RelayCommand(DoOpenShopBuyoutCalculator);
|
||||||
|
OpenAPITest = new RelayCommand(DoOpenAPITest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoOpenCompetitionOverlaySettings(object obj)
|
private void DoOpenCompetitionOverlaySettings(object obj)
|
||||||
@@ -83,5 +84,19 @@ namespace osrs_toolbox
|
|||||||
sbv.Show();
|
sbv.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DoOpenAPITest(object obj)
|
||||||
|
{
|
||||||
|
if (APITestView.Current != null)
|
||||||
|
{
|
||||||
|
APITestView.Current.Close();
|
||||||
|
APITestView.Current = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
APITestView atv = new APITestView();
|
||||||
|
atv.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
osrs-toolbox/Views/APITestView.xaml
Normal file
22
osrs-toolbox/Views/APITestView.xaml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<Window x:Class="osrs_toolbox.APITestView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:osrs_toolbox"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="API Testing" Height="450" Width="800" Closed="Window_Closed">
|
||||||
|
<Window.DataContext>
|
||||||
|
<local:APITestViewModel/>
|
||||||
|
</Window.DataContext>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="1*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Button Command="{Binding TestCall, UpdateSourceTrigger=PropertyChanged}" Content="Run API Test" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="3" Padding="3"/>
|
||||||
|
<Border Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" BorderBrush="Black" BorderThickness="2" CornerRadius="4" Margin="3" Padding="3">
|
||||||
|
<TextBlock Text="{Binding TestOutput, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="3"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
34
osrs-toolbox/Views/APITestView.xaml.cs
Normal file
34
osrs-toolbox/Views/APITestView.xaml.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace osrs_toolbox
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for APITestView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class APITestView : Window
|
||||||
|
{
|
||||||
|
public static APITestView Current;
|
||||||
|
public APITestView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Current = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Closed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Current = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -18,5 +18,6 @@
|
|||||||
<Button Command="{Binding OpenCombatLevelCalculator, UpdateSourceTrigger=PropertyChanged}" Content="Open Combat Level Calculator" Margin="3" Padding="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
<Button Command="{Binding OpenCombatLevelCalculator, UpdateSourceTrigger=PropertyChanged}" Content="Open Combat Level Calculator" Margin="3" Padding="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
<Button Command="{Binding OpenShopBuyoutCalculator, UpdateSourceTrigger=PropertyChanged}" Content="Open Shop Buyout Calculator" Margin="3" Padding="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
<Button Command="{Binding OpenShopBuyoutCalculator, UpdateSourceTrigger=PropertyChanged}" Content="Open Shop Buyout Calculator" Margin="3" Padding="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<Button Command="{Binding OpenAPITest, UpdateSourceTrigger=PropertyChanged}" Content="Open API Test" Margin="3" Padding="3" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
Reference in New Issue
Block a user