private void NextButton_Click(object sender, RoutedEventArgs e) { if (SetupTabControl.SelectedIndex == 0) { if (!Util.IsValidFfxivPath(GamePathEntry.Text)) { MessageBox.Show("The path you selected is not a valid FFXIV installation", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } } if (SetupTabControl.SelectedIndex == 1) { Result.GamePath = new DirectoryInfo(GamePathEntry.Text); Result.IsDx11 = Dx11RadioButton.IsChecked == true; Result.Language = (ClientLanguage)LanguageComboBox.SelectedIndex; Result.SteamIntegrationEnabled = SteamCheckBox.IsChecked == true; Result.Save(); Close(); } SetupTabControl.SelectedIndex++; }
private void FrameworkChanged(object sender, SelectionChangedEventArgs e) { var framework = (string)FrameworkSelector.SelectedItem; if (framework != null && LauncherSettings.PreferredFramework != framework) { LauncherSettings.PreferredFramework = framework; LauncherSettings.Save(); } }
public static void SaveLangauge(GameLanguage language) { if (language == null) { return; } LauncherSettings settings = LauncherSettings.Load(); settings.Language = language.Parameter; LauncherSettings.Save(settings); }
public async Task StartStudio(string argument) { if (argument == null) { throw new ArgumentNullException(nameof(argument)); } if (ActiveVersion == null) { return; } if (AutoCloseLauncher) { argument = $"/LauncherWindowHandle {WindowHandle} {argument}"; } MetricsClient metricsForEditorBefore120 = null; try { Dispatcher.Invoke(() => StartStudioCommand.IsEnabled = false); var packagePath = ActiveVersion.InstallPath; var mainExecutable = store.LocateMainExecutable(packagePath); // If version is older than 1.2.0, than we need to log the usage of older version var activeStoreVersion = ActiveVersion as XenkoStoreVersionViewModel; if (activeStoreVersion != null && activeStoreVersion.Version.Version < new Version(1, 2, 0, 0)) { metricsForEditorBefore120 = new MetricsClient(CommonApps.XenkoEditorAppId, versionOverride: activeStoreVersion.Version.ToString()); } Process.Start(mainExecutable, argument); } catch (Exception e) { var message = string.Format(Strings.ErrorStartingProcess, e.FormatSummary(true)); await ServiceProvider.Get <IDialogService>().MessageBox(message, MessageBoxButton.OK, MessageBoxImage.Error); } finally { metricsForEditorBefore120?.Dispose(); } await Task.Delay(5000); Dispatcher.Invoke(() => { StartStudioCommand.IsEnabled = ActiveVersion != null; //Save settings because launcher maybe have not been closed LauncherSettings.ActiveVersion = ActiveVersion != null ? ActiveVersion.Name : ""; LauncherSettings.Save(); }); }
public static GameLanguage LoadLanguage() { LauncherSettings settings = LauncherSettings.Load(); if (settings.Language == null) { LauncherSettings clean = new LauncherSettings(); LauncherSettings.Save(clean); settings = LauncherSettings.Load(); } GameLanguage loadedLanguage = Languages.Where(language => language.Parameter == settings.Language).FirstOrDefault(); if (loadedLanguage == null) { loadedLanguage = GetDefaultLanguage(); } return(loadedLanguage); }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); if (ViewModel.StrideVersions.Any(x => x.IsProcessing)) { var forceClose = Launcher.DisplayMessage("Some background operations are still in progress. Force close?"); if (!forceClose) { e.Cancel = true; return; } } var viewModel = (LauncherViewModel)DataContext; LauncherSettings.ActiveVersion = viewModel.ActiveVersion != null ? viewModel.ActiveVersion.Name : ""; LauncherSettings.Save(); if (ExitOnUserClose) { Environment.Exit(1); } }
private void InitializeWindow() { // Upgrade the stored settings if needed if (Properties.Settings.Default.UpgradeRequired) { Log.Information("Settings upgrade required..."); Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpgradeRequired = false; Properties.Settings.Default.Save(); } var gateStatus = false; try { gateStatus = _game.GetGateStatus(); } catch { // ignored } if (!gateStatus) { WorldStatusPackIcon.Foreground = new SolidColorBrush(Color.FromRgb(242, 24, 24)); } var version = Util.GetAssemblyVersion(); if (Properties.Settings.Default.LastVersion != version) { new ChangelogWindow().ShowDialog(); Properties.Settings.Default.LastVersion = version; Properties.Settings.Default.Save(); } _accountManager = new AccountManager(_setting); var savedAccount = _accountManager.CurrentAccount; if (savedAccount != null) { SwitchAccount(savedAccount, false); } AutoLoginCheckBox.IsChecked = _setting.AutologinEnabled; if (_setting.AutologinEnabled && savedAccount != null && !Keyboard.Modifiers.HasFlag(ModifierKeys.Shift)) { Log.Information("Engaging Autologin..."); try { #if DEBUG HandleLogin(true); _setting.Save(); return; #else if (!gateStatus) { var startLauncher = MessageBox.Show( "Square Enix seems to be running maintenance work right now. The game shouldn't be launched. Do you want to start the official launcher to check for patches?", "XIVLauncherLite", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes; if (startLauncher) { _setting.StartOfficialLauncher(SteamCheckBox.IsChecked == true); } _setting.AutologinEnabled = false; _isLoggingIn = false; } else { HandleLogin(true); _setting.Save(); return; } #endif } catch (Exception exc) { new ErrorWindow(exc, "Additionally, please check your login information or try again.", "AutoLogin") .ShowDialog(); _setting.AutologinEnabled = false; _isLoggingIn = false; } _setting.Save(); } else if (Keyboard.Modifiers.HasFlag(ModifierKeys.Shift)) { _setting.AutologinEnabled = false; AutoLoginCheckBox.IsChecked = false; } if (_setting.GamePath?.Exists != true) { var setup = new FirstTimeSetup(_setting); setup.ShowDialog(); _setting = setup.Result; } Task.Run(() => SetupHeadlines()); Show(); Activate(); Log.Information("MainWindow initialized."); }
private void NextButton_Click(object sender, RoutedEventArgs e) { if (SetupTabControl.SelectedIndex == 0) { if (!Util.IsValidFfxivPath(GamePathEntry.Text)) { MessageBox.Show("The path you selected is not a valid FFXIV installation", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } } if (SetupTabControl.SelectedIndex == 3) { // Check if ACT is installed, if it isn't, just skip this step var actPath = FindAct(); if (actPath == null) { SetupTabControl.SelectedIndex++; NextButton_Click(null, null); return; } } if (SetupTabControl.SelectedIndex == 5) { Result.GamePath = new DirectoryInfo(GamePathEntry.Text); Result.IsDx11 = Dx11RadioButton.IsChecked == true; Result.Language = (ClientLanguage)LanguageComboBox.SelectedIndex; Result.InGameAddonEnabled = HooksCheckBox.IsChecked == true; Result.SteamIntegrationEnabled = SteamCheckBox.IsChecked == true; Result.AddonList = new List <AddonEntry> { new AddonEntry { Addon = new RichPresenceAddon(), IsEnabled = RichPresenceCheckBox.IsChecked == true } }; if (ActCheckBox.IsChecked == true) { var actPath = FindAct(); Result.AddonList.Add(new AddonEntry { IsEnabled = true, Addon = new GenericAddon { Path = actPath } }); } Result.Save(); Close(); } SetupTabControl.SelectedIndex++; }