/// <summary> /// true if the package was changed since the last run /// </summary> /// <param name="wrp">The File that will be loaded (contains a valid Package witha FileName)</param> /// <returns>true, if the package Name changed</returns> public static bool ChangedNeighborhood(Want wrp) { string newpkg = wrp.Package.FileName.Trim().ToString(); if (newpkg != oldpkg) { oldpkg = newpkg; return(true); } return(false); }
/// <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(); } }