Esempio n. 1
0
        private void gp_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            SteepValley.Windows.Forms.XPListViewItem item = (SteepValley.Windows.Forms.XPListViewItem)gp.GetItemAt(e.X, e.Y);
            if (ClickOverSim != null && item != null)
            {
                ClickOverSim(this, ((SimPe.PackedFiles.Wrapper.ExtSDesc)item.Tag).Image, (Wrapper.SDesc)((SimPe.PackedFiles.Wrapper.ExtSDesc)item.Tag));
            }

            if (SelectedSimChanged != null && item != null && (e.Button == System.Windows.Forms.MouseButtons.Left || (e.Button == System.Windows.Forms.MouseButtons.Right && rightclicksel)))
            {
                gp.SelectedItems.Clear();
                item.Selected = true;
                lastsel       = item;
                SelectedSimChanged(this, ((SimPe.PackedFiles.Wrapper.ExtSDesc)item.Tag).Image, (Wrapper.SDesc)((SimPe.PackedFiles.Wrapper.ExtSDesc)item.Tag));
            }
            //if (lastsel!=null && e.Button!=System.Windows.Forms.MouseButtons.Left) lastsel.Selected = true;
        }
Esempio n. 2
0
        public SteepValley.Windows.Forms.XPListViewItem Add(SimPe.PackedFiles.Wrapper.ExtSDesc sdesc, Image imgbig)
        {
            SteepValley.Windows.Forms.XPListViewItem lvi = new SteepValley.Windows.Forms.XPListViewItem();
            try
            {
                this.LargeImageList.Images.Add(imgbig);
                lvi.ImageIndex = LargeImageList.Images.Count - 1;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }


            lvi.Text = " " + sdesc.SimName + " " + sdesc.SimFamilyName;
            if (this.Columns.Count > 1)
            {
                lvi.SubItems.Add("    " + Columns[1].Text + ": " + sdesc.HouseholdName);
            }
            if (this.Columns.Count > 2)
            {
                lvi.SubItems.Add("    " + Columns[2].Text + ": 0x" + Helper.HexString(sdesc.SimId));
            }
            if (this.Columns.Count > 3)
            {
                lvi.SubItems.Add("    " + Columns[3].Text + ": 0x" + Helper.HexString((ushort)sdesc.FileDescriptor.Instance));
            }
            if (this.Columns.Count > 4)
            {
                if (sdesc.University.OnCampus == 0x1)
                {
                    lvi.SubItems.Add("    " + Columns[4].Text + ": " + Localization.Manager.GetString("YoungAdult"));
                }
                else
                {
                    lvi.SubItems.Add("    " + Columns[4].Text + ": " + new Data.LocalizedLifeSections(sdesc.CharacterDescription.LifeSection).ToString());
                }
            }


            this.Items.Add(lvi);
            return(lvi);
        }
Esempio n. 3
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();
        }