From ca865fa6fd6417258b99785d4633356f95cc24ff Mon Sep 17 00:00:00 2001 From: Venomalia Date: Mon, 11 Oct 2021 23:38:50 +0200 Subject: [PATCH 1/2] Default host devices are now named correctly. --- MainWindow.xaml | 2 +- MainWindow.xaml.cs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MainWindow.xaml b/MainWindow.xaml index cf05570..813cec1 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -38,7 +38,7 @@ - + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index e47fafe..bf0dd75 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -39,7 +39,7 @@ private DynamicInputPackViewModel InputPack private string _saved_document = null; private Window _edit_emulated_devices_window; - private Window _edit_host_devices_window; + private Window _edit_default_host_devices_window; private Window _edit_metadata_window; private Window _edit_tags_window; @@ -48,13 +48,13 @@ private void QuitProgram_Click(object sender, RoutedEventArgs e) this.Close(); } - private void EditHostDevices_Click(object sender, RoutedEventArgs e) + private void EditDefaultHostDevices_Click(object sender, RoutedEventArgs e) { - _edit_host_devices_window?.Close(); + _edit_default_host_devices_window?.Close(); - _edit_host_devices_window = new Window + _edit_default_host_devices_window = new Window { - Title = "Editing Host Devices", + Title = "Editing Default Host Devices", Icon = ResourceShapePathToImage("Icon.HostDevices"), ResizeMode = ResizeMode.CanResize, SizeToContent = SizeToContent.Manual, @@ -64,7 +64,7 @@ private void EditHostDevices_Click(object sender, RoutedEventArgs e) }; UpdateEditWindows(); - _edit_host_devices_window.Show(); + _edit_default_host_devices_window.Show(); } private void EditEmulatedDevices_Click(object sender, RoutedEventArgs e) @@ -237,10 +237,10 @@ private void UpdateEditWindows() _edit_emulated_devices_window.Content = user_control; } - if (_edit_host_devices_window != null) + if (_edit_default_host_devices_window != null) { var user_control = new Controls.EditHostDevices { DataContext = new HostDeviceKeyViewModel { HostDevices = InputPack.HostDevices, Tags = InputPack.Tags } }; - _edit_host_devices_window.Content = user_control; + _edit_default_host_devices_window.Content = user_control; } if (_edit_metadata_window != null) From 8328968432c51bb717fa1da5e34bdbba3d7dc8f0 Mon Sep 17 00:00:00 2001 From: Venomalia Date: Mon, 11 Oct 2021 23:43:59 +0200 Subject: [PATCH 2/2] host devices can now be edited --- Controls/TexturePicker.xaml | 22 ++++++++++++++++++++++ MainWindow.xaml.cs | 25 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/Controls/TexturePicker.xaml b/Controls/TexturePicker.xaml index 78f2db5..8c30ca4 100644 --- a/Controls/TexturePicker.xaml +++ b/Controls/TexturePicker.xaml @@ -64,7 +64,29 @@ + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index bf0dd75..86c50cc 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -30,6 +30,7 @@ private DynamicInputPackViewModel InputPack return; value.CheckImagePaths(); + _edit_host_devices_window?.Close(); DataContext = value; ((PanZoomViewModel)PanZoom.DataContext).InputPack = value; UnsavedChanges = false; @@ -40,6 +41,7 @@ private DynamicInputPackViewModel InputPack private Window _edit_emulated_devices_window; private Window _edit_default_host_devices_window; + private Window _edit_host_devices_window; private Window _edit_metadata_window; private Window _edit_tags_window; @@ -67,6 +69,29 @@ private void EditDefaultHostDevices_Click(object sender, RoutedEventArgs e) _edit_default_host_devices_window.Show(); } + public ICommand EditHostDevicesCommand => new ViewModels.Commands.RelayCommand(EditHostDevicesS); + + private void EditHostDevicesS(DynamicInputTexture texture) + { + _edit_host_devices_window?.Close(); + + var user_control = new HostDeviceKeyViewModel { HostDevices = new ViewModels.Commands.UICollection(texture.HostDevices) }; + texture.HostDevices = user_control.HostDevices; + + _edit_host_devices_window = new Window + { + Title = "Editing Host Devices of " + texture.TextureHash, + ResizeMode = ResizeMode.CanResize, + SizeToContent = SizeToContent.Manual, + Owner = Application.Current.MainWindow, + Top = this.Top + 50, Left = this.Left + 70, + Width = 620, Height = 550, MinWidth = 500, MinHeight = 400, + Content = new Controls.EditHostDevices { DataContext = user_control } + }; + + _edit_host_devices_window.Show(); + } + private void EditEmulatedDevices_Click(object sender, RoutedEventArgs e) { _edit_emulated_devices_window?.Close();