예제 #1
0
 private void ModpacksList_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if ((sender as ListView)?.SelectedItem is BoundModList selectedModpack)
     {
         LvActivatedMods.ItemsSource = _currentBoundModList = selectedModpack;
         LvActivatedMods.IsEnabled   = true;
     }
     else
     {
         LvActivatedMods.ItemsSource = null;
         LvActivatedMods.IsEnabled   = false;
     }
 }
예제 #2
0
        private void OpenMainWindow()
        {
            Mods     = new ModInstallationService();
            Modpacks = new ModpacksService();
            Modpacks.AddVanillaModpack();
            ActiveModsConfig = new ModActivationService();
            Profiles         = new ProfilesService();
            if (!ProfilesService.IsSavesFolderSymlinked())
            {
                if (
                    MessageBox.Show(
                        "In order for the launcher to work, saves must be moved to a new profile.\nWould you like your saves to be moved to a new profile?",
                        "Move saves to new profile?",
                        MessageBoxButton.YesNo,
                        MessageBoxImage.Question
                        ) == MessageBoxResult.Yes
                    )
                {
                    var oldModpack = new BoundModList("Old modpack", "old");
                    oldModpack.CopyTo(ActiveModsConfig.FetchActiveMods().ToArray(), 0);
                    Modpacks.LoadModpacks();
                    var profile = new BoundProfile("Old profile", oldModpack, "old");
                    profile.SavesFolder?.Delete(true);
                    Config.FetchDataFolder().GetDirectories().First(directory =>
                                                                    directory.Name == RimWorldLauncher.Properties.Resources.SavesFolderName)
                    .MoveTo(Path.Combine(profile.ProfileFolder.FullName,
                                         RimWorldLauncher.Properties.Resources.SavesFolderName));
                    Profiles.LoadProfiles();
                }
                else
                {
                    Current.Shutdown();
                    return;
                }
            }

            SwitchMainWindow(new WinMain());
        }
예제 #3
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TxtName.Text))
            {
                App.ShowError("\"Name\" cannot be empty.");
                return;
            }

            if (BoundModList == null)
            {
                BoundModList = new BoundModList(
                    TxtName.Text,
                    TxtName.Text
                    );
            }
            else
            {
                BoundModList.DisplayName = TxtName.Text;
                BoundModList.Save();
            }

            DialogResult = true;
        }