/// <summary>
        /// Called by the game when the mod is enabled.
        /// </summary>
        public void OnEnabled()
        {
            // Apply Harmony patches via Cities Harmony.
            // Called here instead of OnCreated to allow the auto-downloader to do its work prior to launch.
            HarmonyHelper.DoOnHarmonyReady(() => Patcher.PatchAll());

            // Load settings file.
            SettingsUtils.LoadSettings();

            // Populate (legacy) Datastore from configuration file.
            // Make sure this happens before loading the new configuration file, which will overwrite any settings here.
            // This establishes the correct priority (new over legacy).
            XMLUtilsWG.ReadFromXML();

            // Attaching options panel event hook - check to see if UIView is ready.
            if (UIView.GetAView() != null)
            {
                // It's ready - attach the hook now.
                OptionsPanel.OptionsEventHook();
            }
            else
            {
                // Otherwise, queue the hook for when the intro's finished loading.
                LoadingManager.instance.m_introLoaded += OptionsPanel.OptionsEventHook;
            }
        }
        /// <summary>
        /// Adds the options panel event handler for the start screen (to enable/disable options panel based on visibility).
        /// </summary>
        public void OnEnabled()
        {
            // Load settings file.
            SettingsUtils.LoadSettings();

            // Populate Datastore from configuration file.
            XMLUtilsWG.ReadFromXML();

            // Check to see if UIView is ready.
            if (UIView.GetAView() != null)
            {
                // It's ready - attach the hook now.
                OptionsPanel.OptionsEventHook();
            }
            else
            {
                // Otherwise, queue the hook for when the intro's finished loading.
                LoadingManager.instance.m_introLoaded += OptionsPanel.OptionsEventHook;
            }
        }
Example #3
0
        public Form1()
        {
            InitializeComponent();

            //set form title
            Text += " " + Application.ProductVersion;

            //set worker thread properties
            backgroundWorkerGetLineData.WorkerSupportsCancellation = true;
            backgroundWorkerGetLineData.WorkerReportsProgress      = true;

            //load embedded xml profiles
            _profiles = ProfileUtils.LoadEmbeddedProfiles();

            //do live update, update profiles
            backgroundWorkerLiveUpdate.RunWorkerAsync();

            //load settings if saved
            ToolSettings settings = SettingsUtils.LoadSettings();

            if (settings != null)
            {
                _selectedModem        = settings.Device;
                textBoxIpAddress.Text = settings.Host;
                textBoxUsername.Text  = settings.Username;
                textBoxPassword.Text  = settings.Password;
                checkBoxSave.Checked  = true;
                SetSelectedDevice();
            }
            else
            {
                //detect device
                backgroundWorkerDetectDevice.RunWorkerAsync();
                checkBoxSave.Checked = false;
            }
        }