Target Selection dialog
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
#define ORBISLIB_MAJOR 3
|
||||
#define ORBISLIB_MINOR 0
|
||||
#define ORBISLIB_BUILDVERSION 871
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
#if defined(_DEBUG)
|
||||
#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Dev Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__)
|
||||
#else
|
||||
#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__)
|
||||
#endif
|
||||
#pragma once
|
||||
#define ORBISLIB_MAJOR 3
|
||||
#define ORBISLIB_MINOR 0
|
||||
#define ORBISLIB_BUILDVERSION 874
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
#if defined(_DEBUG)
|
||||
#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Dev Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__)
|
||||
#else
|
||||
#define ORBISLIB_BUILDSTRING ("[OrbisLib Daemon " stringify(ORBISLIB_MAJOR) "." stringify(ORBISLIB_MINOR) "] Build " stringify(ORBISLIB_BUILDVERSION) " " __DATE__ " " __TIME__)
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,7 @@ copy "eboot.bin" %outputPath%\Playstation\Build\pkg\Daemons\ORBS30000\eboot.bin
|
||||
del "eboot.bin"
|
||||
|
||||
REM Generate the script. Will overwrite any existing temp.txt
|
||||
echo open 1.1.0.79 2121> temp.txt
|
||||
echo open 1.1.0.14 2121> temp.txt
|
||||
echo anonymous>> temp.txt
|
||||
echo anonymous>> temp.txt
|
||||
echo cd "/system/vsh/app/ORBS30000/">> temp.txt
|
||||
|
||||
@@ -49,10 +49,28 @@ int main()
|
||||
klog("\n%s\n\n", ORBISLIB_BUILDSTRING);
|
||||
|
||||
// Init a thread to monitor the system usage stats.
|
||||
//SystemMonitor::Init();
|
||||
// SystemMonitor::Init();
|
||||
|
||||
// start up the API. NOTE: this is blocking.
|
||||
//API::Init();
|
||||
API::Init();
|
||||
|
||||
//#define LOADTOOLBOX
|
||||
#ifdef LOADTOOLBOX
|
||||
auto handle = sys_sdk_proc_prx_load("SceShellUI", "/user/data/Orbis Toolbox/OrbisToolbox-2.0.sprx");
|
||||
if (handle > 0) {
|
||||
klog("Orbis Toolbox loaded! %d\n", handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
klog("error: %d\n", handle);
|
||||
Notify("Failed to load Orbis Toolbox!");
|
||||
}
|
||||
#endif
|
||||
|
||||
//#define KILLSHELLUI
|
||||
#ifdef KILLSHELLUI
|
||||
sceSystemServiceKillApp(LncUtil::sceLncUtilGetAppId("NPXS20001"), -1, 0, 0);
|
||||
#endif
|
||||
|
||||
sceSystemServiceLoadExec("exit", 0);
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 185 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
@@ -0,0 +1,119 @@
|
||||
<UserControl x:Class="OrbisLib2.Dialog.Controls.MiniTargetPanel"
|
||||
x:Name="MiniTargetPanelElement"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:OrbisLib2.Dialog.Controls"
|
||||
xmlns:simpleControls="clr-namespace:SimpleUI.Controls;assembly=SimpleUI"
|
||||
mc:Ignorable="d"
|
||||
Width="255" Height="115"
|
||||
d:DesignWidth="255" d:DesignHeight="115"
|
||||
Cursor="Hand" MouseDown="MiniTargetPanelElement_MouseDown">
|
||||
|
||||
<Border VerticalAlignment="Stretch"
|
||||
CornerRadius="10"
|
||||
Background="{DynamicResource WindowBar}">
|
||||
|
||||
<!-- Main View -->
|
||||
<StackPanel Margin="5">
|
||||
|
||||
<!-- Target Name & State -->
|
||||
<Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<!-- Target State -->
|
||||
<Ellipse Grid.ColumnSpan="2" Grid.Row="0"
|
||||
Name="TargetStatusElement"
|
||||
Fill="red"
|
||||
Width="14"
|
||||
Height="14"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5 0 0 0"
|
||||
ToolTip="Online & API Available"/>
|
||||
|
||||
<!-- Target Name -->
|
||||
<TextBlock Text="{Binding ElementName=MiniTargetPanelElement, Path=TargetName}"
|
||||
Name="TargetNameElement"
|
||||
Foreground="{DynamicResource Text}"
|
||||
FontSize="18"
|
||||
VerticalAlignment="Center"
|
||||
Margin="5 0 0 0"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Default Selection -->
|
||||
<TextBlock Name="DefaultTargetElement"
|
||||
Text="★"
|
||||
Foreground="#45494A"
|
||||
FontSize="25"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Margin="3 -8"
|
||||
Cursor="Hand"
|
||||
ForceCursor="True"
|
||||
MouseDown="DefaultTargetElement_MouseDown"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Target Image / Details -->
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
||||
<!-- Target Image -->
|
||||
<Grid Margin="0 5 5 5"
|
||||
Width="75"
|
||||
Height="75">
|
||||
<Rectangle Fill="#45494A"/>
|
||||
|
||||
<Image Name="ConsoleImageElement"
|
||||
Source="/OrbisLib2;component/Common/Images/Consoles/Fat.png"
|
||||
RenderOptions.BitmapScalingMode="Fant"
|
||||
RenderOptions.EdgeMode="Aliased"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Target Details -->
|
||||
<Grid VerticalAlignment="Center"
|
||||
Height="75">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Grid.Row="0">
|
||||
<!-- Firmware Version -->
|
||||
<simpleControls:SimpleTextField FieldName="Firmware Version"
|
||||
FieldText="{Binding ElementName=MiniTargetPanelElement, Path=FirmwareVersion}"
|
||||
Width="80"
|
||||
Height="35"
|
||||
Margin="0 0 5 0"/>
|
||||
|
||||
<!-- SDK Version -->
|
||||
<simpleControls:SimpleTextField FieldName="SDK Version"
|
||||
FieldText="{Binding ElementName=MiniTargetPanelElement, Path=SDKVersion}"
|
||||
Width="80"
|
||||
Height="35"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Grid.Row="2">
|
||||
<!-- IP Address -->
|
||||
<simpleControls:SimpleTextField FieldName="IP Address"
|
||||
FieldText="{Binding ElementName=MiniTargetPanelElement, Path=IPAddress}"
|
||||
Width="100"
|
||||
Height="35"
|
||||
Margin="0 0 5 0"/>
|
||||
|
||||
<!-- Payload Port -->
|
||||
<simpleControls:SimpleTextField FieldName="Payload Port"
|
||||
FieldText="{Binding ElementName=MiniTargetPanelElement, Path=PayloadPort}"
|
||||
Width="60"
|
||||
Height="35"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,210 @@
|
||||
using OrbisLib2.Common.Database.Types;
|
||||
using OrbisLib2.Targets;
|
||||
using SimpleUI.Dialogs;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using static SQLite.SQLite3;
|
||||
|
||||
namespace OrbisLib2.Dialog.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MiniTargetPanel.xaml
|
||||
/// </summary>
|
||||
public partial class MiniTargetPanel : UserControl
|
||||
{
|
||||
private readonly Target _thisTarget;
|
||||
|
||||
public event EventHandler<RoutedEventArgs>? TargetChanged;
|
||||
|
||||
public MiniTargetPanel(string TargetName)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_thisTarget = TargetManager.GetTarget(TargetName);
|
||||
if (_thisTarget != null)
|
||||
{
|
||||
this.TargetName = _thisTarget.Name;
|
||||
TargetStatus = _thisTarget.Info.Status;
|
||||
ConsoleModel = _thisTarget.Info.ModelType;
|
||||
IsDefault = _thisTarget.IsDefault;
|
||||
FirmwareVersion = _thisTarget.Info.SoftwareVersion;
|
||||
SDKVersion = _thisTarget.Info.SDKVersion;
|
||||
IPAddress = _thisTarget.IPAddress;
|
||||
PayloadPort = _thisTarget.PayloadPort.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("TargetPanel(): Target not found when it should have been!");
|
||||
}
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
private string TargetName
|
||||
{
|
||||
get { return (string)GetValue(TargetNameProperty); }
|
||||
set { SetValue(TargetNameProperty, value); }
|
||||
}
|
||||
|
||||
private static readonly DependencyProperty TargetNameProperty =
|
||||
DependencyProperty.Register("TargetName", typeof(string), typeof(MiniTargetPanel), new PropertyMetadata(string.Empty));
|
||||
|
||||
private TargetStatusType TargetStatus
|
||||
{
|
||||
get { return (TargetStatusType)GetValue(TargetStatusProperty); }
|
||||
set { SetValue(TargetStatusProperty, value); }
|
||||
}
|
||||
|
||||
private static readonly DependencyProperty TargetStatusProperty =
|
||||
DependencyProperty.Register("TargetStatus", typeof(TargetStatusType), typeof(MiniTargetPanel), new PropertyMetadata(TargetStatusType.None, TargetStatusProperty_Changed));
|
||||
|
||||
private static void TargetStatusProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
switch ((TargetStatusType)e.NewValue)
|
||||
{
|
||||
case TargetStatusType.Offline:
|
||||
((MiniTargetPanel)d).TargetStatusElement.Fill = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
||||
((MiniTargetPanel)d).TargetStatusElement.ToolTip = "Offline";
|
||||
break;
|
||||
|
||||
case TargetStatusType.Online:
|
||||
((MiniTargetPanel)d).TargetStatusElement.Fill = new SolidColorBrush(Color.FromRgb(255, 140, 0));
|
||||
((MiniTargetPanel)d).TargetStatusElement.ToolTip = "Online";
|
||||
break;
|
||||
|
||||
case TargetStatusType.APIAvailable:
|
||||
((MiniTargetPanel)d).TargetStatusElement.Fill = new SolidColorBrush(Color.FromRgb(0, 128, 0));
|
||||
((MiniTargetPanel)d).TargetStatusElement.ToolTip = "Online & API Available";
|
||||
break;
|
||||
|
||||
default:
|
||||
((MiniTargetPanel)d).TargetStatusElement.Fill = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
||||
((MiniTargetPanel)d).TargetStatusElement.ToolTip = "Unknown";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsDefault
|
||||
{
|
||||
get { return (bool)GetValue(IsDefaultProperty); }
|
||||
set { SetValue(IsDefaultProperty, value); }
|
||||
}
|
||||
|
||||
private static readonly DependencyProperty IsDefaultProperty =
|
||||
DependencyProperty.Register("IsDefault", typeof(bool), typeof(MiniTargetPanel), new PropertyMetadata(false, IsDefaultProperty_Changed));
|
||||
|
||||
private static void IsDefaultProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if ((bool)e.NewValue)
|
||||
{
|
||||
((MiniTargetPanel)d).DefaultTargetElement.Foreground = new SolidColorBrush(Color.FromRgb(220, 220, 220));
|
||||
((MiniTargetPanel)d).DefaultTargetElement.Cursor = Cursors.Arrow;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
((MiniTargetPanel)d).DefaultTargetElement.Foreground = new SolidColorBrush(Color.FromRgb(69, 73, 74));
|
||||
((MiniTargetPanel)d).DefaultTargetElement.Cursor = Cursors.Hand;
|
||||
}
|
||||
}
|
||||
|
||||
private ConsoleModelType ConsoleModel
|
||||
{
|
||||
get { return (ConsoleModelType)GetValue(ConsoleModelProperty); }
|
||||
set { SetValue(ConsoleModelProperty, value); }
|
||||
}
|
||||
|
||||
private static readonly DependencyProperty ConsoleModelProperty =
|
||||
DependencyProperty.Register("ConsoleModel", typeof(ConsoleModelType), typeof(MiniTargetPanel), new PropertyMetadata(ConsoleModelType.Unknown, ConsoleModelProperty_Changed));
|
||||
|
||||
private static void ConsoleModelProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
switch ((ConsoleModelType)e.NewValue)
|
||||
{
|
||||
case ConsoleModelType.Fat:
|
||||
((MiniTargetPanel)d).ConsoleImageElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisLib2;component/Common/Images/Consoles/Fat.png"));
|
||||
break;
|
||||
|
||||
case ConsoleModelType.Slim:
|
||||
((MiniTargetPanel)d).ConsoleImageElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisLib2;component/Common/Images/Consoles/Slim.png"));
|
||||
break;
|
||||
|
||||
case ConsoleModelType.Pro:
|
||||
((MiniTargetPanel)d).ConsoleImageElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisLib2;component/Common/Images/Consoles/Pro.png"));
|
||||
break;
|
||||
|
||||
default:
|
||||
((MiniTargetPanel)d).ConsoleImageElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisLib2;component/Common/Images/Consoles/Fat.png"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private string FirmwareVersion
|
||||
{
|
||||
get { return (string)GetValue(FirmwareVersionProperty); }
|
||||
set { SetValue(FirmwareVersionProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty FirmwareVersionProperty =
|
||||
DependencyProperty.Register("FirmwareVersion", typeof(string), typeof(MiniTargetPanel), new PropertyMetadata(string.Empty));
|
||||
|
||||
private string SDKVersion
|
||||
{
|
||||
get { return (string)GetValue(SDKVersionProperty); }
|
||||
set { SetValue(SDKVersionProperty, value); }
|
||||
}
|
||||
|
||||
private static readonly DependencyProperty SDKVersionProperty =
|
||||
DependencyProperty.Register("SDKVersion", typeof(string), typeof(MiniTargetPanel), new PropertyMetadata(string.Empty));
|
||||
|
||||
private string IPAddress
|
||||
{
|
||||
get { return (string)GetValue(IPAddressProperty); }
|
||||
set { SetValue(IPAddressProperty, value); }
|
||||
}
|
||||
|
||||
private static readonly DependencyProperty IPAddressProperty =
|
||||
DependencyProperty.Register("IPAddress", typeof(string), typeof(MiniTargetPanel), new PropertyMetadata(string.Empty));
|
||||
|
||||
public string PayloadPort
|
||||
{
|
||||
get { return (string)GetValue(PayloadPortProperty); }
|
||||
set { SetValue(PayloadPortProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PayloadPortProperty =
|
||||
DependencyProperty.Register("PayloadPort", typeof(string), typeof(MiniTargetPanel), new PropertyMetadata(string.Empty));
|
||||
|
||||
#endregion
|
||||
|
||||
#region Buttons
|
||||
|
||||
private void DefaultTargetElement_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var savedTarget = _thisTarget.SavedTarget;
|
||||
if (!savedTarget.IsDefault)
|
||||
{
|
||||
savedTarget.IsDefault = true;
|
||||
savedTarget.Save();
|
||||
TargetChanged?.Invoke(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void MiniTargetPanelElement_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TargetManager.SelectedTarget = _thisTarget;
|
||||
|
||||
var parentWindow = (SelectTarget)Window.GetWindow(this);
|
||||
if(parentWindow != null)
|
||||
{
|
||||
parentWindow.Result = SimpleDialogResult.None;
|
||||
parentWindow.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<simpleDialogs:SimpleDialog x:Class="OrbisLib2.Dialog.SelectTarget"
|
||||
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:OrbisLib2.Dialog"
|
||||
xmlns:simpleDialogs="clr-namespace:SimpleUI.Dialogs;assembly=SimpleUI"
|
||||
xmlns:controls="clr-namespace:OrbisLib2.Dialog.Controls"
|
||||
mc:Ignorable="d"
|
||||
Height="350" Width="560"
|
||||
ResizeMode="NoResize">
|
||||
|
||||
<Grid>
|
||||
<ListBox Width="540" Height="250"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
x:Name="TargetList">
|
||||
|
||||
<!-- Sets the List view to be a uniform grid starting top left with 2 columns. -->
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid VerticalAlignment="Top" Columns="2"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<!-- Remove Selection & Add Margin to all Items -->
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Margin" Value="0 0 0 10" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||
<ContentPresenter />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
</simpleDialogs:SimpleDialog>
|
||||
@@ -0,0 +1,66 @@
|
||||
using OrbisLib2.Dialog.Controls;
|
||||
using OrbisLib2.General;
|
||||
using OrbisLib2.Targets;
|
||||
using SimpleUI.Dialogs;
|
||||
using System.Windows;
|
||||
|
||||
namespace OrbisLib2.Dialog
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SelectTarget.xaml
|
||||
/// </summary>
|
||||
public partial class SelectTarget : SimpleDialog
|
||||
{
|
||||
public SelectTarget(Window Owner)
|
||||
: base(Owner, "Cancel", "Select Target")
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Events.DBTouched += Events_DBTouched;
|
||||
Events.TargetStateChanged += Events_TargetStateChanged;
|
||||
|
||||
RefreshTargets();
|
||||
}
|
||||
|
||||
public static SimpleDialogResult ShowDialog(Window Owner)
|
||||
{
|
||||
var dlg = new SelectTarget(Owner);
|
||||
dlg.ShowDialog();
|
||||
return dlg.Result;
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
private void Events_TargetStateChanged(object? sender, TargetStateChangedEvent e)
|
||||
{
|
||||
Dispatcher.Invoke(() => { RefreshTargets(); });
|
||||
}
|
||||
|
||||
private void Events_DBTouched(object? sender, DBTouchedEvent e)
|
||||
{
|
||||
Dispatcher.Invoke(() => { RefreshTargets(); });
|
||||
}
|
||||
|
||||
private void Target_TargetChanged(object? sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() => { RefreshTargets(); });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void RefreshTargets()
|
||||
{
|
||||
TargetList.Items.Clear();
|
||||
|
||||
if (TargetManager.Targets.Count > 0)
|
||||
{
|
||||
foreach (var Target in TargetManager.Targets)
|
||||
{
|
||||
var targetView = new MiniTargetPanel(Target.Name);
|
||||
targetView.TargetChanged += Target_TargetChanged;
|
||||
TargetList.Items.Add(targetView);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrbisLib2.General
|
||||
namespace OrbisLib2.General
|
||||
{
|
||||
public class DBTouchedEvent : EventArgs
|
||||
{
|
||||
@@ -33,6 +27,16 @@ namespace OrbisLib2.General
|
||||
}
|
||||
}
|
||||
|
||||
public class SelectedTargetChangedEvent : EventArgs
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
|
||||
public SelectedTargetChangedEvent(string Name)
|
||||
{
|
||||
this.Name = Name;
|
||||
}
|
||||
}
|
||||
|
||||
public class Events
|
||||
{
|
||||
/// <summary>
|
||||
@@ -45,6 +49,11 @@ namespace OrbisLib2.General
|
||||
/// </summary>
|
||||
public static event EventHandler<TargetStateChangedEvent>? TargetStateChanged;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static event EventHandler<SelectedTargetChangedEvent>? SelectedTargetChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Will Fire the event for when the Database has been updated.
|
||||
/// </summary>
|
||||
@@ -78,5 +87,14 @@ namespace OrbisLib2.General
|
||||
else
|
||||
TargetStateChanged?.Invoke(null, new TargetStateChangedEvent(TargetName, TargetStateChangedEvent.TargetState.APIUnAvailable));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will fire the event whent the selected target changes.
|
||||
/// </summary>
|
||||
/// <param name="Name">The name of the target.</param>
|
||||
internal static void FireSelectedTargetChanged(string Name)
|
||||
{
|
||||
SelectedTargetChanged?.Invoke(null, new SelectedTargetChangedEvent(Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,24 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Common\Images\Consoles\Fat.png" />
|
||||
<None Remove="Common\Images\Consoles\Pro.png" />
|
||||
<None Remove="Common\Images\Consoles\Slim.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Common\Images\Consoles\Fat.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Common\Images\Consoles\Pro.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Common\Images\Consoles\Slim.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Ftp.dll" Version="2.0.22269.922" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OrbisLib2.Common.API;
|
||||
using OrbisLib2.Common.API;
|
||||
using OrbisLib2.Common.Database;
|
||||
using OrbisLib2.Common.Database.Types;
|
||||
using OrbisLib2.Common.Helpers;
|
||||
using System.Net.Sockets;
|
||||
using OrbisLib2.General;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OrbisLib2.Targets
|
||||
@@ -55,7 +54,11 @@ namespace OrbisLib2.Targets
|
||||
|
||||
return _SelectedTarget;
|
||||
}
|
||||
set { _SelectedTarget = value; }
|
||||
set
|
||||
{
|
||||
_SelectedTarget = value;
|
||||
Events.FireSelectedTargetChanged(_SelectedTarget.Name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -57,7 +57,9 @@
|
||||
Margin="0 0 0 0"
|
||||
Text="-"
|
||||
FontSize="13"
|
||||
Foreground="{DynamicResource Text}"/>
|
||||
Foreground="{DynamicResource Text}"
|
||||
Cursor="Hand"
|
||||
MouseDown="CurrentTargetName_MouseDown"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
@@ -23,9 +24,16 @@ namespace OrbisLibraryManager.Controls
|
||||
|
||||
Events.DBTouched += Events_DBTouched;
|
||||
Events.TargetStateChanged += Events_TargetStateChanged;
|
||||
Events.SelectedTargetChanged += Events_SelectedTargetChanged;
|
||||
|
||||
RefreshTarget();
|
||||
}
|
||||
|
||||
private void Events_SelectedTargetChanged(object? sender, SelectedTargetChangedEvent e)
|
||||
{
|
||||
Dispatcher.Invoke(() => { RefreshTarget(); });
|
||||
}
|
||||
|
||||
private void Events_TargetStateChanged(object? sender, TargetStateChangedEvent e)
|
||||
{
|
||||
Dispatcher.Invoke(() => { RefreshTarget(); });
|
||||
@@ -101,5 +109,10 @@ namespace OrbisLibraryManager.Controls
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void CurrentTargetName_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
OrbisLib2.Dialog.SelectTarget.ShowDialog(Window.GetWindow(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@
|
||||
Margin="0 0 0 0"
|
||||
Text="-"
|
||||
FontSize="13"
|
||||
Foreground="{DynamicResource Text}"/>
|
||||
Foreground="{DynamicResource Text}"
|
||||
Cursor="Hand"
|
||||
MouseDown="CurrentTargetName_MouseDown"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
@@ -23,9 +24,16 @@ namespace OrbisNeighborHood.Controls
|
||||
|
||||
Events.DBTouched += Events_DBTouched;
|
||||
Events.TargetStateChanged += Events_TargetStateChanged;
|
||||
Events.SelectedTargetChanged += Events_SelectedTargetChanged;
|
||||
|
||||
RefreshTarget();
|
||||
}
|
||||
|
||||
private void Events_SelectedTargetChanged(object? sender, SelectedTargetChangedEvent e)
|
||||
{
|
||||
Dispatcher.Invoke(() => { RefreshTarget(); });
|
||||
}
|
||||
|
||||
private void Events_TargetStateChanged(object? sender, TargetStateChangedEvent e)
|
||||
{
|
||||
Dispatcher.Invoke(() => { RefreshTarget(); });
|
||||
@@ -101,5 +109,10 @@ namespace OrbisNeighborHood.Controls
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void CurrentTargetName_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
OrbisLib2.Dialog.SelectTarget.ShowDialog(Window.GetWindow(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace OrbisNeighborHood.Controls
|
||||
/// </summary>
|
||||
public partial class TargetPanel : UserControl
|
||||
{
|
||||
private TargetInfo _thisTargetInfo;
|
||||
private readonly Target _thisTarget;
|
||||
|
||||
public event EventHandler<RoutedEventArgs>? TargetChanged;
|
||||
@@ -33,8 +32,6 @@ namespace OrbisNeighborHood.Controls
|
||||
_thisTarget = TargetManager.GetTarget(TargetName);
|
||||
if(_thisTarget != null )
|
||||
{
|
||||
_thisTargetInfo = _thisTarget.Info;
|
||||
|
||||
this.TargetName = _thisTarget.Name;
|
||||
TargetStatus = _thisTarget.Info.Status;
|
||||
ConsoleModel = _thisTarget.Info.ModelType;
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace OrbisNeighborHood.MVVM.View
|
||||
|
||||
Events.DBTouched += Events_DBTouched;
|
||||
Events.TargetStateChanged += Events_TargetStateChanged;
|
||||
Events.SelectedTargetChanged += Events_SelectedTargetChanged;
|
||||
|
||||
RefreshTargetInfo();
|
||||
}
|
||||
@@ -175,6 +176,11 @@ namespace OrbisNeighborHood.MVVM.View
|
||||
|
||||
#region Events / Refresh Target
|
||||
|
||||
private void Events_SelectedTargetChanged(object? sender, SelectedTargetChangedEvent e)
|
||||
{
|
||||
Dispatcher.Invoke(() => { RefreshTargetInfo(); });
|
||||
}
|
||||
|
||||
private void Events_TargetStateChanged(object? sender, TargetStateChangedEvent e)
|
||||
{
|
||||
Dispatcher.Invoke(() => { RefreshTargetInfo(); });
|
||||
|
||||
@@ -1 +1 @@
|
||||
2199
|
||||
2227
|
||||
|
||||
@@ -1 +1 @@
|
||||
Version 3.0.2199 Debug Build Friday December 30 2022 11:55 PM
|
||||
Version 3.0.2227 Debug Build Sunday January 01 2023 9:57 PM
|
||||
|
||||
Reference in New Issue
Block a user