private void OnFinishedLoading()
        {
            SetVersionTextBlock();

            Logger.Log("Program initializing...");
            Logger.Log("Welcome to BTD6 Mod Manager!");

            string tdloaderDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\TD Loader";

            UserData.MainProgramExePath = Environment.CurrentDirectory + "\\BTD6 Mod Manager.exe";
            UserData.MainProgramName    = "BTD6 Mod Manager";
            UserData.MainSettingsDir    = tdloaderDir;
            UserData.UserDataFilePath   = tdloaderDir + "\\userdata.json";

            SessionData.loadedMods = Settings.LoadedSettings.LastUsedMods;

            if (Settings.LoadedSettings.IsNewUser)
            {
                var diag = MessageBox.Show("Would you like to see a tutorial on how to use this mod manager?", "Open tutorial?", MessageBoxButton.YesNo);
                if (diag == MessageBoxResult.Yes)
                {
                    Windows.WebBrowser browser = new Windows.WebBrowser("How to use this Mod Manager");
                    browser.Show();
                    browser.GoToURL("https://youtu.be/RyB5MyMpOlE?t=613");
                }
                else
                {
                    MessageBox.Show("Okay. If you want to see it later, just click on the \"Help\" at the top of the mod manager," +
                                    " then click \"How to use Mod Manager\"");
                }

                Settings.LoadedSettings.IsNewUser = false;
                Settings.LoadedSettings.Save();
            }
        }
 private void HowGetMods_Button_Click(object sender, RoutedEventArgs e)
 {
     Windows.WebBrowser browser = new Windows.WebBrowser("How to get mods");
     browser.Show();
     browser.GoToURL("https://youtu.be/RyB5MyMpOlE?t=1077");
 }
 private void HowToUse_Button_Click(object sender, RoutedEventArgs e)
 {
     Windows.WebBrowser browser = new Windows.WebBrowser("How to use this Mod Manager");
     browser.Show();
     browser.GoToURL("https://youtu.be/RyB5MyMpOlE?t=613");
 }
예제 #4
0
        private void OnFinishedLoading()
        {
            Log.Output("Welcome to BTD6 Mod Manager!");

            string tdloaderDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\TD Loader";

            UserData.MainProgramExePath = Environment.CurrentDirectory + "\\BTD6 Mod Manager.exe";
            UserData.MainProgramName    = "BTD6 Mod Manager";
            UserData.MainSettingsDir    = tdloaderDir;
            UserData.UserDataFilePath   = tdloaderDir + "\\userdata.json";

            /*BgThread.AddToQueue(() =>
             * {
             *  UserData.LoadUserData();
             *  UserData.SaveUserData();
             * });*/

            if (TempSettings.Instance.IsNewUser)
            {
                var diag = MessageBox.Show("Would you like to see a tutorial on how to use this mod manager?", "Open tutorial?", MessageBoxButton.YesNo);
                if (diag == MessageBoxResult.Yes)
                {
                    Windows.WebBrowser browser = new Windows.WebBrowser("How to use this Mod Manager");
                    browser.Show();
                    browser.GoToURL("https://youtu.be/RyB5MyMpOlE?t=613");
                }
                else
                {
                    MessageBox.Show("Okay. If you want to see it later, just click on the \"Help\" at the top of the mod manager," +
                                    " then click \"How to use Mod Manager\"");
                }
                TempSettings.Instance.IsNewUser = false;
                TempSettings.Instance.SaveSettings();
            }

            BgThread.AddToQueue(() =>
            {
                string btd6ExePath = SteamUtils.GetGameDir(GameType.BTD6) + "\\" + GameInfo.GetGame(GameType.BTD6).EXEName;
                FileInfo btd6File  = new FileInfo(btd6ExePath);

                while (true)
                {
                    if (BTD_Backend.Natives.Windows.IsProgramRunning(btd6File, out Process proc))
                    {
                        Launch_Button.Dispatcher.BeginInvoke((Action)(() =>
                        {
                            if (Launch_Button.Content != "Inject")
                            {
                                Launch_Button.Content = "Inject";
                            }
                        }));
                    }
                    else
                    {
                        Launch_Button.Dispatcher.BeginInvoke((Action)(() =>
                        {
                            if (Launch_Button.Content != "Launch")
                            {
                                Launch_Button.Content = "Launch";
                            }
                        }));
                    }
                    Thread.Sleep(500);
                }
            });
        }