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 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..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; @@ -39,6 +40,7 @@ private DynamicInputPackViewModel InputPack private string _saved_document = null; 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; @@ -48,13 +50,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,6 +66,29 @@ private void EditHostDevices_Click(object sender, RoutedEventArgs e) }; UpdateEditWindows(); + _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(); } @@ -237,10 +262,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)