Example #1
0
        AddSimToPoolEventArgs DoAddSimToPool(SimPe.PackedFiles.Wrapper.ExtSDesc sdsc, string name, string household, System.Drawing.Image img)
        {
            AddSimToPoolEventArgs e = new AddSimToPoolEventArgs(sdsc, name, household, img, 0);

            OnAddSimToPool(e);
            if (AddSimToPool != null)
            {
                AddSimToPool(this, e);
            }
            return(e);
        }
Example #2
0
        void UpdateSimList(string household)
        {
            SimPe.PackedFiles.Wrapper.ExtSDesc selectedSim = this.SelectedSim;
            if (household != null && selectedSim != null && selectedSim.HouseholdName != household)
            {
                selectedSim = null;
            }

            gp.BeginUpdate();
            gp.Clear();
            lastsel = null;

            Hashtable ht = FileTable.ProviderRegistry.SimDescriptionProvider.SimInstance;

            Wait.SubStart(ht.Count);
            int ct = 0;

            System.Collections.SortedList map = new System.Collections.SortedList();

            foreach (SimPe.PackedFiles.Wrapper.ExtSDesc sdsc in ht.Values)
            {
                if (household != null)
                {
                    if (household != sdsc.HouseholdName)
                    {
                        continue;
                    }
                }

                string name = sdsc.SimName + " " + sdsc.SimFamilyName;
                System.Drawing.Image  simimg = gp.GetSimIcon(sdsc, GetBackgroundColor(sdsc));
                AddSimToPoolEventArgs ret    = DoAddSimToPool(sdsc, name, household, simimg);

                if (!ret.Cancel)
                {
                    SteepValley.Windows.Forms.XPListViewItem eip = gp.Add(sdsc, simimg);
                    eip.Tag        = sdsc;
                    eip.GroupIndex = ret.GroupIndex;


                    if (map.ContainsKey(name))
                    {
                        name += " (" + sdsc.FileDescriptor.Instance.ToString() + ")";
                    }
                    map[name]    = eip;
                    Wait.Message = eip.Text;
                }

                Wait.Progress = ct++;
            }

            SetViewMode();


            if (gp.Items.Count > 0)
            {
                if (selectedSim != null)
                {
                    SelectedSim = selectedSim;
                }
                else
                {
                    gp.Items[0].Selected = true;
                }
                try
                {
                    if (SelectedSimChanged != null)
                    {
                        SelectedSimChanged(this, ((SimPe.PackedFiles.Wrapper.ExtSDesc)gp.Items[0].Tag).Image, (Wrapper.SDesc)((SimPe.PackedFiles.Wrapper.ExtSDesc)gp.Items[0].Tag));
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }

            gp.EndUpdate();
            Wait.SubStop();
        }
Example #3
0
 protected virtual void OnAddSimToPool(AddSimToPoolEventArgs e)
 {
 }