Exemplo n.º 1
0
        public frmUserSettings()
        {
            InitializeComponent();

            Task.Run(SetUserInfoAsync).Wait();

            this.bsUserSettings.DataSource = Program.UserSettings;

            string registryPath = this.ReadNR2003PathFromRegistry();

            if (registryPath != null && this.CheckNR2003PathIsConfigured(registryPath) == false && this.CheckNR2003PathValidity(registryPath) == true)
            {
                MessageBox.Show("NRatings has detected that NR2003 is installed in " + registryPath + ".\n\rThis path will automatically be added. You can still change its name.", "NR2003 detected", MessageBoxButtons.OK, MessageBoxIcon.Information);

                NR2003Instance instance = new NR2003Instance();
                instance.Name = registryPath;
                instance.Path = registryPath;

                if (Program.UserSettings.NR2003Instances.Count == 0)
                {
                    instance.IsDefault = true;
                }
                else
                {
                    instance.IsDefault = false;
                }

                this.bsNR2003Instances.Add(instance);
            }
        }
Exemplo n.º 2
0
        private void LoadNR2003Instances()
        {
            if (this.ConfirmCarLoading())
            {
                this.selectedNR2003Instance = null;
                this.selectedMod            = null;
                this.selectedRoster         = null;

                this.bsNR2003Instances.DataSource = new List <NR2003Instance>(); //needed to reinitialize the list for the dropdowns to rebind correctly
                this.bsNR2003Instances.DataSource = Program.UserSettings.NR2003Instances;

                if (Program.UserSettings.NR2003Instances != null && Program.UserSettings.NR2003Instances.Count > 0)
                {
                    NR2003Instance defaultInstance;

                    var q = (from i in Program.UserSettings.NR2003Instances
                             where i.IsDefault == true
                             select i).First();


                    if (q != null)
                    {
                        defaultInstance = q;
                    }
                    else
                    {
                        defaultInstance = Program.UserSettings.NR2003Instances.First();
                    }

                    this.cmbNR2003Instance.SelectedItem = defaultInstance;
                }

                this.LoadCarList();
            }
        }
Exemplo n.º 3
0
        private void bsNR2003Instances_CurrentChanged(object sender, EventArgs e)
        {
            NR2003Instance instance = this.cmbNR2003Instance.SelectedItem as NR2003Instance;

            if (instance != this.selectedNR2003Instance)
            {
                this.selectedNR2003Instance = instance;

                if (this.cmbMod.Items.Count > 0)
                {
                    this.cmbMod.SelectedIndex = 0;
                }

                this.LoadMods();
            }
        }