Implemented TargetView and its children controls.

This commit is contained in:
Greg
2022-02-21 21:55:17 -07:00
parent 6cf0fcf447
commit c354651629
24 changed files with 560 additions and 8 deletions
Binary file not shown.
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,30 @@
<UserControl x:Class="OrbisNeighborHood.Controls.NewTargetView"
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:OrbisNeighborHood.Controls"
mc:Ignorable="d"
Width="305" Height="210"
d:DesignHeight="210" d:DesignWidth="315">
<Border VerticalAlignment="Stretch"
CornerRadius="10"
Background="{DynamicResource ControlDarkBackground}">
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center">
<Image
Width="70"
Height="70"
Source="/OrbisNeighborHood;component/Images/Plus.png"/>
<TextBlock Text="Add Target"
Foreground="{DynamicResource Text}"
FontWeight="SemiBold"
FontSize="16"
HorizontalAlignment="Center"/>
</StackPanel>
</Border>
</UserControl>
@@ -0,0 +1,28 @@
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.Navigation;
using System.Windows.Shapes;
namespace OrbisNeighborHood.Controls
{
/// <summary>
/// Interaction logic for NewTargetView.xaml
/// </summary>
public partial class NewTargetView : UserControl
{
public NewTargetView()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,182 @@
<UserControl x:Class="OrbisNeighborHood.Controls.TargetView"
x:Name="TargetViewElement"
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:OrbisNeighborHood.Controls"
xmlns:simpleControls="clr-namespace:SimpleUI.Controls;assembly=SimpleUI"
mc:Ignorable="d"
Width="305" Height="210"
d:DesignHeight="210" d:DesignWidth="305">
<Border VerticalAlignment="Stretch"
CornerRadius="10"
Background="{DynamicResource ControlDarkBackground}">
<!-- 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 &amp; API Available"/>
<!-- Target Name -->
<TextBlock Text="{Binding ElementName=TargetViewElement, Path=TargetName}"
Name="TargetNameElement"
Foreground="{DynamicResource Text}"
FontSize="18"
VerticalAlignment="Center"
Margin="5 0 0 0"/>
</StackPanel>
<!-- Default Selection -->
<Image Name="DefaultTargetElement"
Source="/OrbisNeighborHood;component/Images/NotDefault.ico"
Height="20"
HorizontalAlignment="Right"/>
</Grid>
<!-- Target Image / Details -->
<StackPanel Orientation="Horizontal">
<!-- Target Image -->
<Grid Margin="0 5 5 5"
Width="125"
Height="125">
<Rectangle Fill="#45494A"/>
<Image Name="ConsoleImageElement"
Source="/OrbisNeighborHood;component/Images/Consoles/Fat.png"/>
</Grid>
<!-- Target Details -->
<StackPanel VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<!-- Firmware Version -->
<simpleControls:SimpleTextField FieldName="Firmware Version"
FieldText="{Binding ElementName=TargetViewElement, Path=FirmwareVersion}"
Width="80"
Height="35"
Margin="0 0 5 0"/>
<!-- SDK Version -->
<simpleControls:SimpleTextField FieldName="SDK Version"
FieldText="{Binding ElementName=TargetViewElement, Path=SDKVersion}"
Width="80"
Height="35"/>
</StackPanel>
<!-- IP Address -->
<simpleControls:SimpleTextField FieldName="IP Address"
FieldText="{Binding ElementName=TargetViewElement, Path=IPAddress}"
Width="165"
Height="35"
Margin="0 5 0 0"/>
<StackPanel Orientation="Horizontal">
<!-- Console Name -->
<simpleControls:SimpleTextField FieldName="Console Name"
FieldText="{Binding ElementName=TargetViewElement, Path=ConsoleName}"
Width="80"
Height="35"
Margin="0 5 5 0"/>
<!-- Console Type -->
<simpleControls:SimpleTextField FieldName="Console Type"
FieldText="{Binding ElementName=TargetViewElement, Path=ConsoleType}"
Width="80"
Height="35"
Margin="0 5 0 0"/>
</StackPanel>
</StackPanel>
</StackPanel>
<!-- Buttons -->
<StackPanel Orientation="Horizontal"
Margin="0 3 0 0">
<!-- Locate -->
<simpleControls:SimpleButton
Width="35"
Height="35"
ToolTip="Locate Target"
Margin="0 0 5 0">
<Image Source="/OrbisNeighborHood;component/Images/Locate.png"
Margin="4"/>
</simpleControls:SimpleButton>
<!-- Send Payload -->
<simpleControls:SimpleButton
Width="35"
Height="35"
ToolTip="Send Payload"
Margin="0 0 5 0">
<Image Source="/OrbisNeighborHood;component/Images/Send.png"
Margin="4"/>
</simpleControls:SimpleButton>
<!-- Reboot -->
<simpleControls:SimpleButton
Width="35"
Height="35"
ToolTip="Restart the Target"
Margin="0 0 5 0">
<Image Source="/OrbisNeighborHood;component/Images/Restart.png"
Margin="0"/>
</simpleControls:SimpleButton>
<!-- Shutdown -->
<simpleControls:SimpleButton
Width="35"
Height="35"
ToolTip="Shutdown the Target"
Margin="0 0 5 0">
<Image Source="/OrbisNeighborHood;component/Images/Shutdown.png"
Margin="0"/>
</simpleControls:SimpleButton>
<!-- Restmode -->
<simpleControls:SimpleButton
Width="35"
Height="35"
ToolTip="Set the Target into Restmode"
Margin="0 0 5 0">
<Image Source="/OrbisNeighborHood;component/Images/Restmode.png"
Margin="0"/>
</simpleControls:SimpleButton>
<!-- Edit -->
<simpleControls:SimpleButton
Content="Edit"
Width="40"
Height="35"
ToolTip="Edit the Target"
Margin="0 0 5 0"/>
<!-- Delete -->
<simpleControls:SimpleButton
Content="Delete"
Width="50"
Height="35"
ToolTip="Delete the Target"
Margin="0 0 5 0"/>
</StackPanel>
</StackPanel>
</Border>
</UserControl>
@@ -0,0 +1,182 @@
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.Navigation;
using System.Windows.Shapes;
namespace OrbisNeighborHood.Controls
{
/// <summary>
/// Interaction logic for TargetView.xaml
/// </summary>
public partial class TargetView : UserControl
{
public TargetView()
{
InitializeComponent();
}
private enum TargetStatusType
{
Offline,
Online,
APIAvailable
};
// Target Info
public int TargetStatus
{
get { return (int)GetValue(TargetStatusProperty); }
set
{
SetValue(TargetStatusProperty, value);
switch (value)
{
case (int)TargetStatusType.Offline:
TargetStatusElement.Fill = new SolidColorBrush(Color.FromRgb(255, 0, 0));
TargetStatusElement.ToolTip = "Offline";
break;
case (int)TargetStatusType.Online:
TargetStatusElement.Fill = new SolidColorBrush(Color.FromRgb(255, 140, 0));
TargetStatusElement.ToolTip = "Online";
break;
case (int)TargetStatusType.APIAvailable:
TargetStatusElement.Fill = new SolidColorBrush(Color.FromRgb(0, 128, 0));
TargetStatusElement.ToolTip = "Online &amp; API Available";
break;
default:
TargetStatusElement.Fill = new SolidColorBrush(Color.FromRgb(255, 0, 0));
TargetStatusElement.ToolTip = "Unknown";
break;
}
}
}
public static readonly DependencyProperty TargetStatusProperty =
DependencyProperty.Register("TargetStatus", typeof(int), typeof(TargetView), new PropertyMetadata(0));
public string TargetName
{
get { return (string)GetValue(TargetNameProperty); }
set { SetValue(TargetNameProperty, value); }
}
public static readonly DependencyProperty TargetNameProperty =
DependencyProperty.Register("TargetName", typeof(string), typeof(TargetView), new PropertyMetadata(string.Empty));
public bool IsDefault
{
get { return (bool)GetValue(IsDefaultProperty); }
set
{
SetValue(IsDefaultProperty, value);
if (value)
DefaultTargetElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisNeighborHood;component/Images/Default.ico"));
else
DefaultTargetElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisNeighborHood;component/Images/NotDefault.ico"));
}
}
public static readonly DependencyProperty IsDefaultProperty =
DependencyProperty.Register("IsDefault", typeof(bool), typeof(TargetView), new PropertyMetadata(false));
// Info Field
private enum ConsoleModelType
{
Fat,
Slim,
Pro
};
public int ConsoleModel
{
get { return (int)GetValue(ConsoleModelProperty); }
set
{
SetValue(ConsoleModelProperty, value);
switch (value)
{
case (int)ConsoleModelType.Fat:
ConsoleImageElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisNeighborHood;component/Images/Consoles/Fat.png"));
break;
case (int)ConsoleModelType.Slim:
ConsoleImageElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisNeighborHood;component/Images/Consoles/Slim.png"));
break;
case (int)ConsoleModelType.Pro:
ConsoleImageElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisNeighborHood;component/Images/Consoles/Pro.png"));
break;
default:
ConsoleImageElement.Source = new BitmapImage(new Uri("pack://application:,,,/OrbisNeighborHood;component/Images/Consoles/Fat.png"));
break;
}
}
}
public static readonly DependencyProperty ConsoleModelProperty =
DependencyProperty.Register("ConsoleModel", typeof(int), typeof(TargetView), new PropertyMetadata(0));
public string FirmwareVersion
{
get { return (string)GetValue(FirmwareVersionProperty); }
set
{
SetValue(FirmwareVersionProperty, value);
}
}
public static readonly DependencyProperty FirmwareVersionProperty =
DependencyProperty.Register("FirmwareVersion", typeof(string), typeof(TargetView), new PropertyMetadata(string.Empty));
public string SDKVersion
{
get { return (string)GetValue(SDKVersionProperty); }
set { SetValue(SDKVersionProperty, value); }
}
public static readonly DependencyProperty SDKVersionProperty =
DependencyProperty.Register("SDKVersion", typeof(string), typeof(TargetView), new PropertyMetadata(string.Empty));
public string IPAddress
{
get { return (string)GetValue(IPAddressProperty); }
set { SetValue(IPAddressProperty, value); }
}
public static readonly DependencyProperty IPAddressProperty =
DependencyProperty.Register("IPAddress", typeof(string), typeof(TargetView), new PropertyMetadata(string.Empty));
public string ConsoleName
{
get { return (string)GetValue(ConsoleNameProperty); }
set { SetValue(ConsoleNameProperty, value); }
}
public static readonly DependencyProperty ConsoleNameProperty =
DependencyProperty.Register("ConsoleName", typeof(string), typeof(TargetView), new PropertyMetadata(string.Empty));
public string ConsoleType
{
get { return (string)GetValue(ConsoleTypeProperty); }
set { SetValue(ConsoleTypeProperty, value); }
}
public static readonly DependencyProperty ConsoleTypeProperty =
DependencyProperty.Register("ConsoleType", typeof(string), typeof(TargetView), new PropertyMetadata(string.Empty));
}
}
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -4,9 +4,77 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:OrbisNeighborHood.MVVM.View"
xmlns:controls="clr-namespace:OrbisNeighborHood.Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
d:DesignHeight="585" d:DesignWidth="700">
<StackPanel>
<TextBlock Text="Targets"
Foreground="{DynamicResource Text}"
FontSize="28"
HorizontalAlignment="Left"
Margin="30,10,0,10"/>
<Grid Margin="20 0 20 30">
<ListBox Width="660" Height="500"
Background="Transparent"
BorderBrush="Transparent">
<!-- 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 25" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<ContentPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<!-- Can be done programatically later -->
<controls:TargetView x:Name="Target1"
TargetName="OSM's Console"
IsDefault="True"
FirmwareVersion="5.05"
SDKVersion="5.050.031"
IPAddress="192.168.0.55"
ConsoleName="PS4-839"
ConsoleType="Retail"/>
<controls:TargetView x:Name="Target2"
TargetName="OSM's Pro Console"
IsDefault="False"
FirmwareVersion="9.00"
SDKVersion="9.008.031"
IPAddress="192.168.0.10"
ConsoleName="PS4-047"
ConsoleType="Retail"/>
<controls:TargetView x:Name="Target3"
TargetName="OSM's 6.72 Console"
IsDefault="False"
FirmwareVersion="6.72"
SDKVersion="6.720.001"
IPAddress="192.168.0.56"
ConsoleName="PS4-085"
ConsoleType="Retail"/>
<controls:NewTargetView/>
</ListBox>
</Grid>
</StackPanel>
</UserControl>
@@ -23,6 +23,19 @@ namespace OrbisNeighborHood.MVVM.View
public TargetView()
{
InitializeComponent();
Target1.TargetStatus = 2;
Target1.IsDefault = true;
Target1.ConsoleModel = 0;
Target2.TargetStatus = 0;
Target2.IsDefault = false;
Target2.ConsoleModel = 2;
Target3.TargetStatus = 1;
Target3.IsDefault = false;
Target3.ConsoleModel = 1;
}
}
}
+4 -4
View File
@@ -124,7 +124,7 @@
</StackPanel>
<!-- Seperation Bar -->
<StackPanel Grid.Column="0" Grid.Row="2"
<!-- <StackPanel Grid.Column="0" Grid.Row="2"
Orientation="Vertical"
VerticalAlignment="Bottom"
Height="40">
@@ -139,10 +139,10 @@
Height="1"
Fill="#515151"/>
</StackPanel>
</StackPanel> -->
<!-- Target Buttons -->
<Grid Grid.Row="2" Grid.Column="0"
<!-- <Grid Grid.Row="2" Grid.Column="0"
VerticalAlignment="Bottom"
Margin="0 0 0 5">
<Grid.ColumnDefinitions>
@@ -162,7 +162,7 @@
Height="26"
Width="110"
Content="Set Default Target"/>
</Grid>
</Grid> -->
<ContentControl Grid.RowSpan="2"
Grid.Column="2"
@@ -5,9 +5,14 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>OrbisNeighborhood.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<None Remove="Images\Consoles\Fat.png" />
<None Remove="Images\Consoles\Pro.png" />
<None Remove="Images\Consoles\Slim.png" />
<None Remove="Images\Default.ico" />
<None Remove="Images\Icons\OrbisConsoleOutput.ico" />
<None Remove="Images\Icons\OrbisDebugger.ico" />
<None Remove="Images\Icons\OrbisModuleManager.ico" />
@@ -15,6 +20,17 @@
<None Remove="Images\Icons\OrbisPeeknPoke.ico" />
<None Remove="Images\Icons\OrbisTargetSettings.ico" />
<None Remove="Images\Icons\OrbisTaskbarApp.ico" />
<None Remove="Images\Locate.png" />
<None Remove="Images\NotDefault.ico" />
<None Remove="Images\Plus.png" />
<None Remove="Images\Restart.png" />
<None Remove="Images\RestMode.png" />
<None Remove="Images\Send.png" />
<None Remove="Images\Shutdown.png" />
</ItemGroup>
<ItemGroup>
<Content Include="OrbisNeighborhood.ico" />
</ItemGroup>
<ItemGroup>
@@ -27,6 +43,18 @@
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Consoles\Fat.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Consoles\Pro.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Consoles\Slim.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Default.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Icons\OrbisConsoleOutput.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
@@ -48,6 +76,27 @@
<Resource Include="Images\Icons\OrbisTaskbarApp.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Locate.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\NotDefault.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Plus.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Restart.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\RestMode.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Send.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Shutdown.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
</Project>
Binary file not shown.

After

Width:  |  Height:  |  Size: 534 KiB