コード例 #1
0
        public void UpdateAllCars()
        {
            toolStripStatusLabel1.Text = string.Format(Loc.String(57), rbrcit.AllCars.Count);
            toolStripStatusLabel2.Text = string.Format(Loc.String(58), rbrcit.ModelsFound);
            toolStripStatusLabel3.Text = string.Format(Loc.String(59), rbrcit.PhysicsFound);
            toolStripStatusLabel4.Text = rbrcit.GetCarListVersion();

            //save collapsed state of groups to restore later
            List <string> groups = new List <string>();

            foreach (OLVGroup group in olvAllCars.CollapsedGroups)
            {
                groups.Add(group.Key.ToString());
            }

            //we only want to autoresize the columns on startup, not everytime we update
            if (olvAllCars.Objects == null)
            {
                olvAllCars.SetObjects(rbrcit.AllCars, true);
                HelperFunctions.AutoResizeByHeaderAndContent(olvAllCars);
            }
            else
            {
                olvAllCars.SetObjects(rbrcit.AllCars, true);
            }

            //restore collapsed state of groups
            foreach (OLVGroup group in olvAllCars.OLVGroups)
            {
                if (groups.Contains(group.Key.ToString()))
                {
                    group.Collapsed = true;
                }
            }
        }