private static void AssertSnappingToolsProjectStuff(SnappingToolsProject expected, SnappingToolsProject actual) { Assert.AreEqual(expected.CurrentPreferences.AcceptableDifference, actual.CurrentPreferences.AcceptableDifference); Assert.AreEqual(expected.CurrentPreferences.DebugEnabled, actual.CurrentPreferences.DebugEnabled); Assert.AreEqual(expected.CurrentPreferences.UpdateMode, actual.CurrentPreferences.UpdateMode); Assert.AreEqual(expected.CurrentPreferences.LockHotkey.Key, actual.CurrentPreferences.LockHotkey.Key); Assert.AreEqual(expected.CurrentPreferences.LockHotkey.Modifiers, actual.CurrentPreferences.LockHotkey.Modifiers); Assert.AreEqual(expected.CurrentPreferences.GeneratorSettings.Values.First().IsDeep, actual.CurrentPreferences.GeneratorSettings.Values.First().IsDeep); Assert.AreEqual(expected.CurrentPreferences.GeneratorSettings.Values.First().InputPredicate, actual.CurrentPreferences.GeneratorSettings.Values.First().InputPredicate); }
public SnappingToolsProjectWindow(SnappingToolsProject project) { InitializeComponent(); Project = project; DataContext = this; AddCommand = new CommandImplementation(_ => { var newSave = new SnappingToolsSaveSlot { Name = $"Save {Project.SaveSlots.Count + 1}" }; Project.SaveToSlot(newSave, false); newSave.Activate(); Project.SaveSlots.Add(newSave); }); RemoveCommand = new CommandImplementation(_ => { if (SaveSlotsGrid.SelectedItems.Count == 0 && Project.SaveSlots.Count > 0) { Project.SaveSlots.RemoveAt(Project.SaveSlots.Count - 1); return; } Project.SaveSlots.RemoveAll(o => SaveSlotsGrid.SelectedItems.Contains(o)); }); DuplicateCommand = new CommandImplementation(_ => { var itemsToDupe = new SnappingToolsSaveSlot[SaveSlotsGrid.SelectedItems.Count]; var i = 0; foreach (var listSelectedItem in SaveSlotsGrid.SelectedItems) { itemsToDupe[i++] = (SnappingToolsSaveSlot)listSelectedItem; } foreach (var listSelectedItem in itemsToDupe) { var clone = (SnappingToolsSaveSlot)listSelectedItem.Clone(); clone.Name += " - Copy"; Project.SaveSlots.Insert(SaveSlotsGrid.Items.IndexOf(listSelectedItem) + 1, clone); } }); }