public async void OnDrop(ListBox listBox, DragEventArgs e) { string[] paths = e.Data.GetData(DataFormats.FileDrop) as string[]; if (listBox.Name.StartsWith("Enabled")) { EnabledPacks.AddRange(await _resourcePackService.MoveLoadAllAsync(paths, true, IsCopy)); } else { DisabledPacks.AddRange(await _resourcePackService.MoveLoadAllAsync(paths, false, IsCopy)); } }
public async void AddNew() { var dialog = new Microsoft.Win32.OpenFileDialog() { Multiselect = true, Title = _languageService.GetEntry("SelectResourcePacks"), Filter = "Minecraft resourcepack | *.zip", }; if (dialog.ShowDialog() ?? false) { DisabledPacks.AddRange(await _resourcePackService.MoveLoadAllAsync(dialog.FileNames, false, IsCopy)); } }
public async void Reload() { EnabledPacks.Clear(); DisabledPacks.Clear(); foreach (var pack in await _resourcePackService.LoadAllAsync()) { if (pack.IsEnabled) { EnabledPacks.Add(pack); } else { DisabledPacks.Add(pack); } } }
public void Disable(ResourcePack pack) { EnabledPacks.Remove(pack); pack.IsEnabled = false; DisabledPacks.Insert(0, pack); }
public void Enable(ResourcePack pack) { DisabledPacks.Remove(pack); pack.IsEnabled = true; EnabledPacks.Insert(0, pack); }
public void Delete(ResourcePack pack) { bool _ = (pack.IsEnabled) ? EnabledPacks.Remove(pack) : DisabledPacks.Remove(pack); _resourcePackService.DeleteFromDisk(pack); }