Beispiel #1
0
        /// <summary>
        /// Load Informations about a specific Want
        /// </summary>
        /// <param name="guid">The GUID of the want</param>
        /// <returns>A Want Information Structure</returns>
        public static WantInformation LoadWant(uint guid)
        {
            LoadCache();
            if (wantcache == null)
            {
                wantcache = cachefile.Map;
            }

            if (wantcache.ContainsKey(guid))
            {
                object          o = wantcache[guid];
                WantInformation wf;
                if (o.GetType() == typeof(WantInformation))
                {
                    wf = (WantInformation)o;
                }
                else
                {
                    wf = WantCacheInformation.LoadWant((WantCacheItem)o);
                }

                return(wf);
            }
            else
            {
                WantInformation wf = new WantInformation(guid);
                wantcache[guid] = wf;
                cachefile.AddItem(wf);
                return(wf);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Is called by SimPe (through the Wrapper) when the Panel is going to be displayed, so
        /// you should updatet the Data displayed by the Panel with the Attributes stored in the
        /// passed Wrapper.
        /// </summary>
        /// <param name="wrapper">The Attributes of this Wrapper have to be displayed</param>
        public void UpdateGUI(IFileWrapper wrapper)
        {
            Want wrp = (Want)wrapper;

            form.wrapper = wrp;
            form.Tag     = true;

            try
            {
                if (ChangedNeighborhood(wrp))
                {
                    WantLoader.WantNameLoader.AddSimNames();
                }

                SimPe.Interfaces.Wrapper.ISDesc sdsc = wrp.SimDescription;
                if (sdsc != null)
                {
                    form.lbsimname.Text = sdsc.SimName + " " + sdsc.SimFamilyName;
                }
                else
                {
                    form.lbsimname.Text = Localization.Manager.GetString("Unknown");
                }


                form.lastwi  = null;
                form.lastlvi = null;

                Wait.SubStart();
                form.lvwant.Items.Clear();
                form.iwant.Images.Clear();
                foreach (WantItem wi in wrp.Wants)
                {
                    form.AddWantToList(form.lvwant, form.iwant, wi);
                }

                form.lvfear.Items.Clear();
                form.ifear.Images.Clear();
                foreach (WantItem wi in wrp.Fears)
                {
                    form.AddWantToList(form.lvfear, form.ifear, wi);
                }

                form.lvlife.Items.Clear();
                form.ilife.Images.Clear();
                foreach (WantItem wi in wrp.LifetimeWants)
                {
                    form.AddWantToList(form.lvlife, form.ilife, wi);
                }

                form.tvhist.Nodes.Clear();
                form.ihist.Images.Clear();
                form.ihist.Images.Add(new System.Drawing.Bitmap(this.GetType().Assembly.GetManifestResourceStream("SimPe.Plugin.nothumb.png")));


                if (wrp.Version >= 0x06)
                {
                    if (!form.tabControl1.TabPages.Contains(form.tblife))
                    {
                        form.tabControl1.TabPages.Add(form.tblife);
                        form.tabControl1.SelectedIndex = 3;
                    }
                }
                else
                {
                    if (form.tabControl1.TabPages.Contains(form.tblife))
                    {
                        form.tabControl1.TabPages.Remove(form.tblife);
                        form.tabControl1.SelectedIndex = 0;
                    }
                }


                WantInformation.SaveCache();
            }
            catch (Exception ex)
            {
                Helper.ExceptionMessage("", ex);
            }
            finally
            {
                form.Tag = null;
                Wait.SubStop();
            }
        }