Example #1
0
        private void settingsButton_Click(object sender, EventArgs e)
        {
            SettingsDialog settingsDialog = new SettingsDialog(this);

            settingsDialog.Icon = Program.LoncherSettings.Icon;
            if (settingsDialog.ShowDialog(this) == DialogResult.OK)
            {
                LauncherConfig.StartPage        = settingsDialog.OpeningPanel;
                LauncherConfig.GameDir          = settingsDialog.GamePath;
                LauncherConfig.LaunchFromGalaxy = settingsDialog.LaunchViaGalaxy;
                bool prevOffline = LauncherConfig.StartOffline;
                LauncherConfig.StartOffline  = settingsDialog.OfflineMode;
                LauncherConfig.CloseOnLaunch = settingsDialog.CloseOnLaunch;
                LauncherConfig.Save();
                settingsDialog.Dispose();
                if (LauncherConfig.GameDir != Program.GamePath)
                {
                    Hide();
                    new PreloaderForm(this).Show();
                }
                else if (prevOffline != LauncherConfig.StartOffline)
                {
                    if (YobaDialog.ShowDialog(Locale.Get(LauncherConfig.StartOffline ? "OfflineModeSet" : "OnlineModeSet"), YobaDialog.YesNoBtns) == DialogResult.Yes)
                    {
                        Hide();
                        new PreloaderForm(this).Show();
                    }
                }
            }
            this.Focus();
        }
Example #2
0
 private void MainForm_Shown(object sender, EventArgs e)
 {
     if (!(Program.FirstRun || Program.OfflineMode) &&
         Program.LoncherSettings.Survey != null &&
         YU.stringHasText(Program.LoncherSettings.Survey.Text) &&
         YU.stringHasText(Program.LoncherSettings.Survey.Url) &&
         YU.stringHasText(Program.LoncherSettings.Survey.ID) &&
         (LauncherConfig.LastSurveyId is null || LauncherConfig.LastSurveyId != Program.LoncherSettings.Survey.ID))
     {
         int    showSurvey   = new Random().Next(0, 100);
         string discardId    = "-0" + Program.LoncherSettings.Survey.ID;
         bool   wasDiscarded = discardId.Equals(LauncherConfig.LastSurveyId);
         if ((!wasDiscarded && showSurvey > 70) || (showSurvey > 7 && showSurvey < 10))
         {
             DialogResult result = YobaDialog.ShowDialog(Program.LoncherSettings.Survey.Text, YobaDialog.YesNoBtns);
             if (result == DialogResult.Yes)
             {
                 Process.Start(Program.LoncherSettings.Survey.Url);
                 LauncherConfig.LastSurveyId = Program.LoncherSettings.Survey.ID;
                 LauncherConfig.Save();
             }
             else if (result == DialogResult.No)
             {
                 LauncherConfig.LastSurveyId = discardId;
                 LauncherConfig.Save();
             }
         }
     }
 }
Example #3
0
        private string showPathSelection(string path)
        {
            if (!YU.stringHasText(path))
            {
                path = Program.GamePath;
            }
            GamePathSelectForm gamePathSelectForm = new GamePathSelectForm();

            gamePathSelectForm.Icon    = Program.LoncherSettings.Icon;
            gamePathSelectForm.ThePath = path;
            if (gamePathSelectForm.ShowDialog(this) == DialogResult.Yes)
            {
                path = gamePathSelectForm.ThePath;
                gamePathSelectForm.Dispose();
                if (path != null && path.Equals(_GOGpath) && LauncherConfig.GalaxyDir != null)
                {
                    if (YobaDialog.ShowDialog(Locale.Get("GogGalaxyDetected"), YobaDialog.YesNoBtns) == DialogResult.Yes)
                    {
                        LauncherConfig.LaunchFromGalaxy = true;
                        LauncherConfig.Save();
                    }
                }
                if (path.Length == 0)
                {
                    path = Program.GamePath;
                }
                else
                {
                    if (path[path.Length - 1] != '\\')
                    {
                        path += "\\";
                    }
                    Program.GamePath = path;
                }
                LauncherConfig.GameDir = path;
                LauncherConfig.Save();
                return(path);
            }
            else
            {
                Application.Exit();
                return(null);
            }
        }