Skip to content

Commit 8328968

Browse files
committed
host devices can now be edited
1 parent ca865fa commit 8328968

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

Controls/TexturePicker.xaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,29 @@
6464
<ColumnDefinition Width="9*" />
6565
<ColumnDefinition Width="Auto" />
6666
</Grid.ColumnDefinitions>
67+
6768
<Button Grid.Column="1" Style="{StaticResource delete}" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:TexturePicker}}, Path=DataContext.Textures.RemoveCommand}" CommandParameter="{Binding}"/>
69+
70+
<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}">
71+
<Button.Style>
72+
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource blank}">
73+
<Setter Property="Content" >
74+
<Setter.Value>
75+
<Path Fill="Sienna" Data="{DynamicResource Geometry.HostDevices}" Style="{StaticResource DropShadow}"/>
76+
</Setter.Value>
77+
</Setter>
78+
<Style.Triggers>
79+
<Trigger Property="IsMouseOver" Value="True">
80+
<Setter Property="Content">
81+
<Setter.Value>
82+
<Path Fill="LightGray" Data="{DynamicResource Geometry.HostDevices}" Style="{StaticResource DropShadow}"/>
83+
</Setter.Value>
84+
</Setter>
85+
</Trigger>
86+
</Style.Triggers>
87+
</Style>
88+
</Button.Style>
89+
</Button>
6890
</Grid>
6991
<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}}"/>
7092
</Grid>

MainWindow.xaml.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ private DynamicInputPackViewModel InputPack
3030
return;
3131

3232
value.CheckImagePaths();
33+
_edit_host_devices_window?.Close();
3334
DataContext = value;
3435
((PanZoomViewModel)PanZoom.DataContext).InputPack = value;
3536
UnsavedChanges = false;
@@ -40,6 +41,7 @@ private DynamicInputPackViewModel InputPack
4041

4142
private Window _edit_emulated_devices_window;
4243
private Window _edit_default_host_devices_window;
44+
private Window _edit_host_devices_window;
4345
private Window _edit_metadata_window;
4446
private Window _edit_tags_window;
4547

@@ -67,6 +69,29 @@ private void EditDefaultHostDevices_Click(object sender, RoutedEventArgs e)
6769
_edit_default_host_devices_window.Show();
6870
}
6971

72+
public ICommand EditHostDevicesCommand => new ViewModels.Commands.RelayCommand<DynamicInputTexture>(EditHostDevicesS);
73+
74+
private void EditHostDevicesS(DynamicInputTexture texture)
75+
{
76+
_edit_host_devices_window?.Close();
77+
78+
var user_control = new HostDeviceKeyViewModel { HostDevices = new ViewModels.Commands.UICollection<HostDevice>(texture.HostDevices) };
79+
texture.HostDevices = user_control.HostDevices;
80+
81+
_edit_host_devices_window = new Window
82+
{
83+
Title = "Editing Host Devices of " + texture.TextureHash,
84+
ResizeMode = ResizeMode.CanResize,
85+
SizeToContent = SizeToContent.Manual,
86+
Owner = Application.Current.MainWindow,
87+
Top = this.Top + 50, Left = this.Left + 70,
88+
Width = 620, Height = 550, MinWidth = 500, MinHeight = 400,
89+
Content = new Controls.EditHostDevices { DataContext = user_control }
90+
};
91+
92+
_edit_host_devices_window.Show();
93+
}
94+
7095
private void EditEmulatedDevices_Click(object sender, RoutedEventArgs e)
7196
{
7297
_edit_emulated_devices_window?.Close();

0 commit comments

Comments
 (0)