Skip to content

Commit aa8e280

Browse files
committed
host devices can now be edited
1 parent ffce81f commit aa8e280

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

Controls/TexturePicker.xaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,26 @@
8484
</Style>
8585
</Button.Style>
8686
</Button>
87+
<Button HorizontalAlignment="Left" Width="20" Grid.Column="0" Margin="0,0,2,0" Command="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType=Window},Path=EditHostDevicesCommand}" CommandParameter="{Binding}">
88+
<Button.Style>
89+
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource blank}">
90+
<Setter Property="Content" >
91+
<Setter.Value>
92+
<Path Fill="Sienna" Data="{DynamicResource Geometry.HostDevices}" Style="{StaticResource DropShadow}"/>
93+
</Setter.Value>
94+
</Setter>
95+
<Style.Triggers>
96+
<Trigger Property="IsMouseOver" Value="True">
97+
<Setter Property="Content">
98+
<Setter.Value>
99+
<Path Fill="LightGray" Data="{DynamicResource Geometry.HostDevices}" Style="{StaticResource DropShadow}"/>
100+
</Setter.Value>
101+
</Setter>
102+
</Trigger>
103+
</Style.Triggers>
104+
</Style>
105+
</Button.Style>
106+
</Button>
87107
</Grid>
88108
<TextBox Grid.Row="1" Padding="2" Margin="1" HorizontalAlignment="Center" MinWidth="50" Text="{Binding TextureHash, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BorderBrush="{Binding HashProperties.IsValid, Converter={StaticResource BoolToBrushConverter}}"/>
89109
</Grid>

MainWindow.xaml.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ private DynamicInputPackViewModel InputPack
3838
set
3939
{
4040
value.CheckImagePaths();
41+
_edit_host_devices_window?.Close();
4142
DataContext = value;
4243
((PanZoomViewModel)PanZoom.DataContext).InputPack = value;
4344
UnsavedChanges = false;
@@ -48,6 +49,7 @@ private DynamicInputPackViewModel InputPack
4849

4950
private Window _edit_emulated_devices_window;
5051
private Window _edit_default_host_devices_window;
52+
private Window _edit_host_devices_window;
5153
private Window _edit_metadata_window;
5254

5355
private void ExportToLocation_Click(object sender, RoutedEventArgs e)
@@ -84,6 +86,29 @@ private void EditDefaultHostDevices_Click(object sender, RoutedEventArgs e)
8486
_edit_default_host_devices_window.Show();
8587
}
8688

89+
public ICommand EditHostDevicesCommand => new ViewModels.Commands.RelayCommand<Data.DynamicInputTexture>(EditHostDevicesS);
90+
91+
private void EditHostDevicesS(Data.DynamicInputTexture texture)
92+
{
93+
_edit_host_devices_window?.Close();
94+
95+
var user_control = new HostDeviceKeyViewModel { HostDevices = new ViewModels.Commands.UICollection<Data.HostDevice>(texture.HostDevices) };
96+
texture.HostDevices = user_control.HostDevices;
97+
98+
_edit_host_devices_window = new Window
99+
{
100+
Title = "Editing Host Devices of " + texture.TextureHash,
101+
ResizeMode = ResizeMode.CanResize,
102+
SizeToContent = SizeToContent.Manual,
103+
Owner = Application.Current.MainWindow,
104+
Top = this.Top + 50, Left = this.Left + 70,
105+
Width = 620, Height = 550, MinWidth = 500, MinHeight = 400,
106+
Content = new Controls.EditHostDevices { DataContext = user_control }
107+
};
108+
109+
_edit_host_devices_window.Show();
110+
}
111+
87112
private void EditEmulatedDevices_Click(object sender, RoutedEventArgs e)
88113
{
89114
_edit_emulated_devices_window?.Close();

0 commit comments

Comments
 (0)