// Adds files to the Selected Files listbox and removes from all files. private void lstAllFiles_DoubleClick(object sender, RoutedEventArgs e) { List <string> tempFileList = new List <string>(); foreach (var file in mod.Groups[lstGroup.SelectedIndex].Modules[lstModule.SelectedIndex].Files) { tempFileList.Add(file.FileName); } if (lstAllFiles.SelectedIndex != -1 && lstModule.SelectedIndex != -1 && lstGroup.SelectedIndex != -1) { if (ModuleConfigWindowChecker.FileCheck(lstAllFiles.SelectedItem.ToString(), tempFileList)) { mod.Groups[lstGroup.SelectedIndex].Modules[lstModule.SelectedIndex].Files.Add(new Mod.Group.Module.mFile(lstAllFiles.SelectedItem.ToString())); lstSelectedFiles.SelectedIndex = 0; lstAllFiles.Items.Remove(lstAllFiles.SelectedItem); if (btnCreate.Opacity == 0) { DoFadeInAnimation(btnCreate); } } else { DoConfirmationAnimation(lblFileExists); } } }
// ---------------------------------- G R O U P S T U F F ---------------------------------- // // Adds a group to the lstGroup listbox. public void txtAddGroup_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (txtAddGroup.Text != "") { if (ModuleConfigWindowChecker.GroupCheck(txtAddGroup.Text)) { e.Handled = true; lstGroup.ItemsSource = mod.Groups; mod.Groups.Add(new Mod.Group(txtAddGroup.Text, cboGroupType.SelectedItem.ToString(), new ObservableCollection <Mod.Group.Module>())); lstGroup.SelectedIndex = 0; if (mod.Groups[lstGroup.SelectedIndex].Modules == null) { lstModule.ItemsSource = null; lstSelectedFiles.ItemsSource = null; } txtAddGroup.Clear(); // Unhides module controls. if (txtAddModule.Opacity == 0) { DoFadeInAnimation(txtAddModule, lstModule); } } else { txtAddGroup.Clear(); DoConfirmationAnimation(lblGroupExists); } } } }
// ---------------------------------- M O D U L E S T U F F ---------------------------------- // // Adds a module to the lstModule listbox. private void txtAddModule_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (txtAddModule.Text != "" && lstGroup.SelectedIndex != -1) { if (mod.Groups[lstGroup.SelectedIndex].Modules == null) { lstSelectedFiles.ItemsSource = null; } if (ModuleConfigWindowChecker.ModuleCheck(txtAddModule.Text)) { e.Handled = true; mod.Groups[lstGroup.SelectedIndex].Modules.Add(new Mod.Group.Module(txtAddModule.Text, new ObservableCollection <Mod.Group.Module.mFile>())); lstModule.SelectedIndex = 0; txtAddModule.Clear(); // Unhides file controls. if (lstAllFiles.Opacity == 0) { DoFadeInAnimation(lstAllFiles, lstSelectedFiles, txtDestination, lblDestinationHelp, lblImageBrowse, btnCreate, txtDescription); } } else { txtAddModule.Clear(); DoConfirmationAnimation(lblModuleExists); } } } }