private void lstTechniques_SelectedIndexChanged(object sender, EventArgs e) { string strSelectedId = lstTechniques.SelectedValue?.ToString(); if (!string.IsNullOrEmpty(strSelectedId)) { XPathNavigator xmlTechnique = _xmlBaseChummerNode.SelectSingleNode("/chummer/techniques/technique[id = \"" + strSelectedId + "\"]"); if (xmlTechnique != null) { string strSource = xmlTechnique.SelectSingleNode("source")?.Value ?? LanguageManager.GetString("String_Unknown", GlobalOptions.Language); string strPage = xmlTechnique.SelectSingleNode("altpage")?.Value ?? xmlTechnique.SelectSingleNode("page")?.Value ?? LanguageManager.GetString("String_Unknown", GlobalOptions.Language); string strSpaceCharacter = LanguageManager.GetString("String_Space", GlobalOptions.Language); lblSource.Text = CommonFunctions.LanguageBookShort(strSource, GlobalOptions.Language) + strSpaceCharacter + strPage; lblSource.SetToolTip(CommonFunctions.LanguageBookLong(strSource, GlobalOptions.Language) + strSpaceCharacter + LanguageManager.GetString("String_Page", GlobalOptions.Language) + strSpaceCharacter + strPage); } else { lblSource.Text = string.Empty; lblSource.SetToolTip(string.Empty); } } else { lblSource.Text = string.Empty; lblSource.SetToolTip(string.Empty); } }
private void UpdateArmorInfo() { chkBlackMarketDiscount.Checked = _setBlackMarketMaps.Contains(_objSelectedArmor.Category); _objSelectedArmor.DiscountCost = chkBlackMarketDiscount.Checked; _objSelectedArmor.Rating = decimal.ToInt32(nudRating.Value); lblArmor.Text = _objSelectedArmor.DisplayName(GlobalOptions.Language); string strBook = CommonFunctions.LanguageBookShort(_objSelectedArmor.Source, GlobalOptions.Language); string strPage = _objSelectedArmor.Page(GlobalOptions.Language); tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(_objSelectedArmor.Source, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); lblArmorValue.Text = _objSelectedArmor.DisplayArmorValue; lblCapacity.Text = _objSelectedArmor.CalculatedCapacity; decimal decItemCost = 0; if (chkFreeItem.Checked) { lblCost.Text = 0.ToString(_objCharacter.Options.NuyenFormat, GlobalOptions.CultureInfo) + '¥'; } else { lblCost.Text = _objSelectedArmor.DisplayCost(out decItemCost, true, nudMarkup.Value / 100.0m); } string strTotalAvail = _objSelectedArmor.TotalAvail(GlobalOptions.Language); lblAvail.Text = strTotalAvail; lblTest.Text = _objCharacter.AvailTest(decItemCost, strTotalAvail); }
private void treLifestyleQualities_AfterSelect(object sender, TreeViewEventArgs e) { if (treLifestyleQualities.SelectedNode?.Tag is LifestyleQuality objQuality) { lblQualityLPLabel.Visible = true; lblQualityCostLabel.Visible = true; lblQualitySourceLabel.Visible = true; chkQualityContributesLP.Visible = true; chkQualityContributesLP.Enabled = !(objQuality.Free || objQuality.OriginSource == QualitySource.BuiltIn); _blnSkipRefresh = true; chkQualityContributesLP.Checked = objQuality.ContributesLP; _blnSkipRefresh = false; lblQualityLp.Text = objQuality.LP.ToString(GlobalOptions.CultureInfo); lblQualityCost.Text = objQuality.Cost.ToString(_objCharacter.Options.NuyenFormat, GlobalOptions.CultureInfo) + '¥'; string strPage = objQuality.Page(GlobalOptions.Language); string strSpaceCharacter = LanguageManager.GetString("String_Space", GlobalOptions.Language); lblQualitySource.Text = CommonFunctions.LanguageBookShort(objQuality.Source, GlobalOptions.Language) + strSpaceCharacter + strPage; GlobalOptions.ToolTipProcessor.SetToolTip(lblQualitySource, CommonFunctions.LanguageBookLong(objQuality.Source, GlobalOptions.Language) + strSpaceCharacter + LanguageManager.GetString("String_Page", GlobalOptions.Language) + strSpaceCharacter + strPage); cmdDeleteQuality.Enabled = !(objQuality.Free || objQuality.OriginSource == QualitySource.BuiltIn); } else { lblQualityLPLabel.Visible = false; lblQualityCostLabel.Visible = false; lblQualitySourceLabel.Visible = false; chkQualityContributesLP.Visible = false; lblQualityLp.Text = string.Empty; lblQualityCost.Text = string.Empty; lblQualitySource.Text = string.Empty; GlobalOptions.ToolTipProcessor.SetToolTip(lblQualitySource, null); cmdDeleteQuality.Enabled = false; } }
private void lstMartialArts_SelectedIndexChanged(object sender, EventArgs e) { string strSelectedId = lstMartialArts.SelectedValue?.ToString(); if (!string.IsNullOrEmpty(strSelectedId)) { // Populate the Martial Arts list. XPathNavigator objXmlArt = _xmlBaseMartialArtsNode.SelectSingleNode("martialart[id = \"" + strSelectedId + "\"]"); if (objXmlArt != null) { string strSource = objXmlArt.SelectSingleNode("source")?.Value ?? LanguageManager.GetString("String_Unknown", GlobalOptions.Language); string strPage = objXmlArt.SelectSingleNode("altpage")?.Value ?? objXmlArt.SelectSingleNode("page")?.Value ?? LanguageManager.GetString("String_Unknown", GlobalOptions.Language); string strSpaceCharacter = LanguageManager.GetString("String_Space", GlobalOptions.Language); lblSource.Text = CommonFunctions.LanguageBookShort(strSource, GlobalOptions.Language) + strSpaceCharacter + strPage; GlobalOptions.ToolTipProcessor.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(strSource, GlobalOptions.Language) + strSpaceCharacter + LanguageManager.GetString("String_Page", GlobalOptions.Language) + strSpaceCharacter + strPage); } else { lblSource.Text = string.Empty; GlobalOptions.ToolTipProcessor.SetToolTip(lblSource, string.Empty); } } else { lblSource.Text = string.Empty; GlobalOptions.ToolTipProcessor.SetToolTip(lblSource, string.Empty); } }
private void lstPrograms_SelectedIndexChanged(object sender, EventArgs e) { string strSelectedComplexFormId = lstPrograms.SelectedValue?.ToString(); if (string.IsNullOrEmpty(strSelectedComplexFormId)) { lblDuration.Text = string.Empty; lblSource.Text = string.Empty; lblFV.Text = string.Empty; tipTooltip.SetToolTip(lblSource, string.Empty); return; } // Display the Program information. XmlNode objXmlProgram = _objXmlDocument.SelectSingleNode("/chummer/complexforms/complexform[id = \"" + strSelectedComplexFormId + "\"]"); if (objXmlProgram != null) { string strDuration = objXmlProgram["duration"].InnerText; string strTarget = objXmlProgram["target"].InnerText; string strFV = objXmlProgram["fv"].InnerText; lblDuration.Text = strDuration; lblTarget.Text = strTarget; lblFV.Text = strFV; string strBook = CommonFunctions.LanguageBookShort(objXmlProgram["source"].InnerText, GlobalOptions.Language); string strPage = objXmlProgram["altpage"]?.InnerText ?? objXmlProgram["page"].InnerText; lblSource.Text = strBook + ' ' + strPage; tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(objXmlProgram["source"].InnerText, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); } }
private void lstArt_SelectedIndexChanged(object sender, EventArgs e) { if (_blnLoading) { return; } string strSelected = lstArt.SelectedValue?.ToString(); if (string.IsNullOrEmpty(strSelected)) { lblSource.Text = string.Empty; tipTooltip.SetToolTip(lblSource, string.Empty); return; } // Retireve the information for the selected piece of Cyberware. XmlNode objXmlMetamagic = _objXmlDocument.SelectSingleNode(_strBaseXPath + "[id = \"" + strSelected + "\"]"); if (objXmlMetamagic == null) { lblSource.Text = string.Empty; tipTooltip.SetToolTip(lblSource, string.Empty); return; } string strSource = objXmlMetamagic["source"].InnerText; string strPage = objXmlMetamagic["altpage"]?.InnerText ?? objXmlMetamagic["page"]?.InnerText; lblSource.Text = CommonFunctions.LanguageBookShort(strSource, GlobalOptions.Language) + ' ' + strPage; tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(strSource, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); }
public SourceString(string strSourceString, string strLanguage = "", CultureInfo objCultureInfo = null, Character objCharacter = null) { Language = !string.IsNullOrEmpty(strLanguage) ? strLanguage : GlobalSettings.Language; CultureInfo = objCultureInfo ?? GlobalSettings.CultureInfo; string strCode = strSourceString ?? string.Empty; Page = 0; int intWhitespaceIndex = strCode.IndexOf(' '); if (intWhitespaceIndex != -1) { strCode = strCode.Substring(0, intWhitespaceIndex); if (intWhitespaceIndex + 1 < strCode.Length) { int.TryParse(strCode.Substring(intWhitespaceIndex + 1), NumberStyles.Integer, GlobalSettings.InvariantCultureInfo, out int intPage); Page = intPage; } } Code = CommonFunctions.LanguageBookShort(strCode, Language, objCharacter); _intHashCode = (Language, CultureInfo, Code, Page).GetHashCode(); if (!s_DicCachedStrings.ContainsKey(Language)) { s_DicCachedStrings.TryAdd(Language, new Tuple <string, string>( LanguageManager.GetString("String_Space", Language), LanguageManager.GetString("String_Page", Language))); } string strSpace = s_DicCachedStrings[Language].Item1; LanguageBookTooltip = CommonFunctions.LanguageBookLong(strCode, Language, objCharacter) + strSpace + s_DicCachedStrings[Language].Item2 + strSpace + Page.ToString(CultureInfo); }
private void treQualities_AfterSelect(object sender, TreeViewEventArgs e) { string strSource = string.Empty; string strPage = string.Empty; string strSourceIDString = treQualities.SelectedNode?.Tag.ToString(); if (!string.IsNullOrEmpty(strSourceIDString)) { XmlNode objXmlQuality = _objXmlDocument.SelectSingleNode("/chummer/qualities/quality[id = \"" + strSourceIDString + "\"]"); if (objXmlQuality != null) { strSource = objXmlQuality["source"]?.InnerText ?? string.Empty; strPage = objXmlQuality["altpage"]?.InnerText ?? objXmlQuality["page"]?.InnerText ?? string.Empty; } } if (!string.IsNullOrEmpty(strSource) && !string.IsNullOrEmpty(strPage)) { string strSpaceCharacter = LanguageManager.GetString("String_Space", GlobalOptions.Language); lblSource.Text = CommonFunctions.LanguageBookShort(strSource, GlobalOptions.Language) + strSpaceCharacter + strPage; lblSource.SetToolTip(CommonFunctions.LanguageBookLong(strSource, GlobalOptions.Language) + strSpaceCharacter + LanguageManager.GetString("String_Page", GlobalOptions.Language) + strSpaceCharacter + strPage); } else { lblSource.Text = string.Empty; lblSource.SetToolTip(string.Empty); } lblSourceLabel.Visible = !string.IsNullOrEmpty(lblSource.Text); }
private void treLifestyleQualities_AfterSelect(object sender, TreeViewEventArgs e) { string strSelectedQuality = treLifestyleQualities.SelectedNode?.Tag.ToString(); LifestyleQuality objQuality = null; // Locate the selected Quality. if (!string.IsNullOrEmpty(strSelectedQuality)) { objQuality = _objLifestyle.LifestyleQualities.FindById(strSelectedQuality) ?? _objLifestyle.FreeGrids.FindById(strSelectedQuality); } if (objQuality != null) { lblQualityLp.Text = objQuality.LP.ToString(); lblQualityCost.Text = objQuality.Cost.ToString(_objCharacter.Options.NuyenFormat, GlobalOptions.CultureInfo) + '¥'; string strPage = objQuality.Page(GlobalOptions.Language); lblQualitySource.Text = CommonFunctions.LanguageBookShort(objQuality.Source, GlobalOptions.Language) + ' ' + strPage; tipTooltip.SetToolTip(lblQualitySource, CommonFunctions.LanguageBookLong(objQuality.Source, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); cmdDeleteQuality.Enabled = !(objQuality.Free || objQuality.OriginSource == QualitySource.BuiltIn); } else { lblQualityLp.Text = string.Empty; lblQualityCost.Text = string.Empty; lblQualitySource.Text = string.Empty; tipTooltip.SetToolTip(lblQualitySource, null); cmdDeleteQuality.Enabled = false; } }
public SourceString(string strSourceString, string strLanguage = "", CultureInfo objCultureInfo = null) { Language = !string.IsNullOrEmpty(strLanguage) ? strLanguage : GlobalOptions.Language; CultureInfo = objCultureInfo ?? GlobalOptions.CultureInfo; string strCode = strSourceString ?? string.Empty; int intWhitespaceIndex = strCode.IndexOf(' '); if (intWhitespaceIndex != -1) { strCode = strCode.Substring(0, intWhitespaceIndex); if (intWhitespaceIndex + 1 < strCode.Length) { int.TryParse(strCode.Substring(intWhitespaceIndex + 1), NumberStyles.Integer, GlobalOptions.InvariantCultureInfo, out _intPage); } } Code = CommonFunctions.LanguageBookShort(strCode, Language); _intHashCode = new { Language, CultureInfo, Code, Page }.GetHashCode(); if (!_dicCachedStrings.ContainsKey(Language)) { _dicCachedStrings.TryAdd(Language, new Tuple <string, string>( LanguageManager.GetString("String_Space", Language), LanguageManager.GetString("String_Page", Language))); } string strSpace = _dicCachedStrings[Language].Item1; LanguageBookTooltip = new StringBuilder(CommonFunctions.LanguageBookLong(strCode, Language)) .Append(strSpace).Append(_dicCachedStrings[Language].Item2) .Append(strSpace).Append(_intPage.ToString(CultureInfo)).ToString(); }
private void lstArt_SelectedIndexChanged(object sender, EventArgs e) { if (_blnLoading) { return; } string strSelected = lstArt.SelectedValue?.ToString(); if (string.IsNullOrEmpty(strSelected)) { lblSource.Text = string.Empty; lblSource.SetToolTip(string.Empty); return; } // Retrieve the information for the selected art XPathNavigator objXmlMetamagic = _objXmlDocument.SelectSingleNode(_strBaseXPath + "[id = \"" + strSelected + "\"]"); if (objXmlMetamagic == null) { lblSource.Text = string.Empty; lblSource.SetToolTip(string.Empty); return; } string strSource = objXmlMetamagic.SelectSingleNode("source")?.Value ?? LanguageManager.GetString("String_Unknown", GlobalOptions.Language); string strPage = objXmlMetamagic.SelectSingleNode("altpage")?.Value ?? objXmlMetamagic.SelectSingleNode("page")?.Value ?? LanguageManager.GetString("String_Unknown", GlobalOptions.Language); string strSpaceCharacter = LanguageManager.GetString("String_Space", GlobalOptions.Language); lblSource.Text = CommonFunctions.LanguageBookShort(strSource, GlobalOptions.Language) + strSpaceCharacter + strPage; lblSource.SetToolTip(CommonFunctions.LanguageBookLong(strSource, GlobalOptions.Language) + strSpaceCharacter + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); }
private void lstMetamagic_SelectedIndexChanged(object sender, EventArgs e) { string strSelectedId = lstMetamagic.SelectedValue?.ToString(); if (!string.IsNullOrEmpty(strSelectedId)) { // Retireve the information for the selected piece of Cyberware. XmlNode objXmlMetamagic = _objXmlDocument.SelectSingleNode(_strRootXPath + "[id = \"" + strSelectedId + "\"]"); if (objXmlMetamagic != null) { string strSource = objXmlMetamagic["source"]?.InnerText; string strPage = objXmlMetamagic["altpage"]?.InnerText ?? objXmlMetamagic["page"]?.InnerText; string strSpaceCharacter = LanguageManager.GetString("String_Space", GlobalOptions.Language); lblSource.Text = CommonFunctions.LanguageBookShort(strSource, GlobalOptions.Language) + strSpaceCharacter + strPage; GlobalOptions.ToolTipProcessor.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(strSource, GlobalOptions.Language) + strSpaceCharacter + LanguageManager.GetString("String_Page", GlobalOptions.Language) + strSpaceCharacter + strPage); } else { lblSource.Text = string.Empty; GlobalOptions.ToolTipProcessor.SetToolTip(lblSource, string.Empty); } } else { lblSource.Text = string.Empty; GlobalOptions.ToolTipProcessor.SetToolTip(lblSource, string.Empty); } }
private void lstOptions_SelectedIndexChanged(object sender, EventArgs e) { string strSelectedId = lstOptions.SelectedValue?.ToString(); XmlNode xmlOption = null; if (!string.IsNullOrEmpty(strSelectedId)) { xmlOption = _objXmlDocument.SelectSingleNode("/chummer/options/option[name = " + strSelectedId.CleanXPath() + "]"); } if (xmlOption != null) { string strSource = xmlOption["source"].InnerText; string strPage = xmlOption["altpage"]?.InnerText ?? xmlOption["page"].InnerText; string strSpace = LanguageManager.GetString("String_Space"); lblSource.Text = CommonFunctions.LanguageBookShort(strSource) + strSpace + strPage; ToolTipFactory.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(strSource) + strSpace + LanguageManager.GetString("String_Page") + strSpace + strPage); } else { lblSource.Text = string.Empty; ToolTipFactory.SetToolTip(lblSource, string.Empty); } }
private void lstMartialArts_SelectedIndexChanged(object sender, EventArgs e) { string strSelectedId = lstManeuvers.SelectedValue?.ToString(); XmlNode xmlManeuver = null; if (!string.IsNullOrEmpty(strSelectedId)) { xmlManeuver = _objXmlDocument.SelectSingleNode("/chummer/maneuvers/maneuver[name = \"" + strSelectedId + "\"]"); } if (xmlManeuver != null) { string strSource = xmlManeuver["source"].InnerText; string strPage = xmlManeuver["altpage"]?.InnerText ?? xmlManeuver["page"].InnerText; lblSource.Text = CommonFunctions.LanguageBookShort(strSource, GlobalOptions.Language) + ' ' + strPage; tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(strSource, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); } else { lblSource.Text = string.Empty; tipTooltip.SetToolTip(lblSource, string.Empty); } }
private void lstPowers_SelectedIndexChanged(object sender, EventArgs e) { if (lstPowers.SelectedValue == null) { return; } // Display the information for the selected Power. XmlNode objXmlPower = _objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + lstPowers.SelectedValue + "\"]"); lblPowerPoints.Text = objXmlPower["points"].InnerText; if (objXmlPower["levels"]?.InnerText == System.Boolean.TrueString) { lblPowerPoints.Text += $" / {LanguageManager.GetString("Label_Power_Level", GlobalOptions.Language)}"; } if (objXmlPower["extrapointcost"] != null) { lblPowerPoints.Text = objXmlPower["extrapointcost"].InnerText + " + " + lblPowerPoints.Text; } string strBook = CommonFunctions.LanguageBookShort(objXmlPower["source"].InnerText, GlobalOptions.Language); string strPage = objXmlPower["page"].InnerText; if (objXmlPower["altpage"] != null) { strPage = objXmlPower["altpage"].InnerText; } lblSource.Text = strBook + " " + strPage; tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(objXmlPower["source"].InnerText, GlobalOptions.Language) + " " + LanguageManager.GetString("String_Page", GlobalOptions.Language) + " " + strPage); }
private void UpdateArmorInfo() { if (_blnLoading || _blnSkipUpdate) { return; } _blnSkipUpdate = true; if (_objSelectedArmor != null) { chkBlackMarketDiscount.Enabled = true; chkBlackMarketDiscount.Checked = _setBlackMarketMaps.Contains(_objSelectedArmor.Category); _objSelectedArmor.DiscountCost = chkBlackMarketDiscount.Checked; _objSelectedArmor.Rating = decimal.ToInt32(nudRating.Value); lblArmor.Text = _objSelectedArmor.DisplayName(GlobalOptions.Language); string strPage = _objSelectedArmor.Page(GlobalOptions.Language); string strSpaceCharacter = LanguageManager.GetString("String_Space", GlobalOptions.Language); lblSource.Text = CommonFunctions.LanguageBookShort(_objSelectedArmor.Source, GlobalOptions.Language) + strSpaceCharacter + strPage; GlobalOptions.ToolTipProcessor.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(_objSelectedArmor.Source, GlobalOptions.Language) + strSpaceCharacter + LanguageManager.GetString("String_Page", GlobalOptions.Language) + strSpaceCharacter + strPage); lblArmorValue.Text = _objSelectedArmor.DisplayArmorValue; lblCapacity.Text = _objSelectedArmor.CalculatedCapacity; decimal decItemCost = 0; if (chkFreeItem.Checked) { lblCost.Text = (0.0m).ToString(_objCharacter.Options.NuyenFormat, GlobalOptions.CultureInfo) + '¥'; } else { lblCost.Text = _objSelectedArmor.DisplayCost(out decItemCost, true, nudMarkup.Value / 100.0m); } AvailabilityValue objTotalAvail = _objSelectedArmor.TotalAvailTuple(); lblAvail.Text = objTotalAvail.ToString(GlobalOptions.CultureInfo, GlobalOptions.Language); lblTest.Text = _objCharacter.AvailTest(decItemCost, objTotalAvail); } else { chkBlackMarketDiscount.Enabled = false; chkBlackMarketDiscount.Checked = false; lblArmor.Text = string.Empty; lblSource.Text = string.Empty; GlobalOptions.ToolTipProcessor.SetToolTip(lblSource, string.Empty); lblArmorValue.Text = string.Empty; lblCapacity.Text = string.Empty; lblAvail.Text = string.Empty; lblTest.Text = string.Empty; } _blnSkipUpdate = false; }
public SourceString(string strSource, int intPage, string strLanguage) { Language = strLanguage; _intPage = intPage; Code = CommonFunctions.LanguageBookShort(strSource, Language); _strCachedSpace = LanguageManager.GetString("String_Space", strLanguage); LanguageBookTooltip = CommonFunctions.LanguageBookLong(strSource, Language) + _strCachedSpace + LanguageManager.GetString("String_Page", strLanguage) + _strCachedSpace + _intPage; }
public SourceString(string strSource, string strPage, string strLanguage) { Language = strLanguage; int.TryParse(strPage, NumberStyles.Integer, GlobalOptions.InvariantCultureInfo, out _intPage); Code = CommonFunctions.LanguageBookShort(strSource, Language); _strCachedSpace = LanguageManager.GetString("String_Space", strLanguage); LanguageBookTooltip = CommonFunctions.LanguageBookLong(strSource, Language) + _strCachedSpace + LanguageManager.GetString("String_Page", strLanguage) + _strCachedSpace + _intPage; }
public static SourceString GetSourceString(string strSource, int intPage, string strLanguage = "", CultureInfo objCultureInfo = null, Character objCharacter = null) { if (string.IsNullOrEmpty(strLanguage)) { strLanguage = GlobalSettings.Language; } return(new SourceString(CommonFunctions.LanguageBookShort(strSource, strLanguage, objCharacter), CommonFunctions.LanguageBookLong(strSource, strLanguage, objCharacter), intPage, strLanguage, objCultureInfo)); }
private void lstMartialArts_SelectedIndexChanged(object sender, EventArgs e) { // Populate the Martial Arts list. XmlNode objXmlArt = _objXmlDocument.SelectSingleNode("/chummer/martialarts/martialart[name = \"" + lstMartialArts.SelectedValue + "\"]"); string strBook = CommonFunctions.LanguageBookShort(objXmlArt["source"].InnerText, GlobalOptions.Language); string strPage = objXmlArt["altpage"]?.InnerText ?? objXmlArt["page"].InnerText; lblSource.Text = strBook + ' ' + strPage; tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(objXmlArt["source"].InnerText, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); }
private void lstOptions_SelectedIndexChanged(object sender, EventArgs e) { // Display the Program information. XmlNode objXmlOption = _objXmlDocument.SelectSingleNode("/chummer/options/option[name = \"" + lstOptions.SelectedValue + "\"]"); string strBook = CommonFunctions.LanguageBookShort(objXmlOption["source"].InnerText, GlobalOptions.Language); string strPage = objXmlOption["altpage"]?.InnerText ?? objXmlOption["page"].InnerText; lblSource.Text = strBook + ' ' + strPage; tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(objXmlOption["source"].InnerText, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); }
public SourceString(string strSource, int intPage, string strLanguage = "", CultureInfo objCultureInfo = null) { Language = !string.IsNullOrEmpty(strLanguage) ? strLanguage : GlobalOptions.Language; CultureInfo = objCultureInfo ?? GlobalOptions.CultureInfo; _intPage = intPage; Code = CommonFunctions.LanguageBookShort(strSource, Language); _intHashCode = new { Language, CultureInfo, Code, Page }.GetHashCode(); _strCachedSpace = LanguageManager.GetString("String_Space", strLanguage); LanguageBookTooltip = CommonFunctions.LanguageBookLong(strSource, Language) + _strCachedSpace + LanguageManager.GetString("String_Page", strLanguage) + _strCachedSpace + _intPage.ToString(CultureInfo); }
public SourceString(string strSource, string strPage, string strLanguage, CultureInfo objCultureInfo = null) { Language = !string.IsNullOrEmpty(strLanguage) ? strLanguage : GlobalOptions.Language; CultureInfo = objCultureInfo ?? GlobalOptions.CultureInfo; int.TryParse(strPage, NumberStyles.Integer, GlobalOptions.InvariantCultureInfo, out _intPage); Code = CommonFunctions.LanguageBookShort(strSource, Language); _intHashCode = new { Language, CultureInfo, Code, Page }.GetHashCode(); _strCachedSpace = LanguageManager.GetString("String_Space", strLanguage); LanguageBookTooltip = CommonFunctions.LanguageBookLong(strSource, Language) + _strCachedSpace + LanguageManager.GetString("String_Page", strLanguage) + _strCachedSpace + _intPage.ToString(CultureInfo); }
private void UpdateWeaponInfo() { chkBlackMarketDiscount.Checked = _setBlackMarketMaps.Contains(_objSelectedWeapon.Category); _objSelectedWeapon.DiscountCost = chkBlackMarketDiscount.Checked; lblWeaponReach.Text = _objSelectedWeapon.TotalReach.ToString(); lblWeaponDamage.Text = _objSelectedWeapon.CalculatedDamage(GlobalOptions.CultureInfo, GlobalOptions.Language); lblWeaponAP.Text = _objSelectedWeapon.TotalAP(GlobalOptions.Language); lblWeaponMode.Text = _objSelectedWeapon.CalculatedMode(GlobalOptions.Language); lblWeaponRC.Text = _objSelectedWeapon.TotalRC; lblWeaponAmmo.Text = _objSelectedWeapon.CalculatedAmmo(GlobalOptions.CultureInfo, GlobalOptions.Language); lblWeaponAccuracy.Text = _objSelectedWeapon.TotalAccuracy.ToString(); decimal decItemCost = 0; if (chkFreeItem.Checked) { lblWeaponCost.Text = 0.ToString(_objCharacter.Options.NuyenFormat, GlobalOptions.CultureInfo) + '¥'; } else { lblWeaponCost.Text = _objSelectedWeapon.DisplayCost(out decItemCost, nudMarkup.Value / 100.0m); } string strTotalAvail = _objSelectedWeapon.TotalAvail(GlobalOptions.Language); lblWeaponAvail.Text = strTotalAvail; lblTest.Text = _objCharacter.AvailTest(decItemCost, strTotalAvail); string strBook = CommonFunctions.LanguageBookShort(_objSelectedWeapon.Source, GlobalOptions.Language); string strPage = _objSelectedWeapon.DisplayPage(GlobalOptions.Language); lblSource.Text = strBook + ' ' + strPage; // Build a list of included Accessories and Modifications that come with the weapon. StringBuilder strAccessories = new StringBuilder(); foreach (WeaponAccessory objAccessory in _objSelectedWeapon.WeaponAccessories) { strAccessories.Append(objAccessory.DisplayName(GlobalOptions.Language)); strAccessories.Append('\n'); } if (strAccessories.Length > 0) { strAccessories.Length -= 1; } lblIncludedAccessories.Text = strAccessories.Length == 0 ? LanguageManager.GetString("String_None", GlobalOptions.Language) : strAccessories.ToString(); tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(_objSelectedWeapon.Source, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); }
/// <summary> /// Update the Program's information based on the Program selected. /// </summary> private void UpdateProgramInfo(XmlNode objXmlProgram) { if (!string.IsNullOrEmpty(lstAIPrograms.Text)) { string strRequiresProgram = strRequiresProgram = objXmlProgram["require"]?.InnerText ?? LanguageManager.GetString("String_None", GlobalOptions.Language); lblRequiresProgram.Text = strRequiresProgram; string strBook = CommonFunctions.LanguageBookShort(objXmlProgram["source"].InnerText, GlobalOptions.Language); string strPage = objXmlProgram["altpage"]?.InnerText ?? objXmlProgram["page"].InnerText; lblSource.Text = strBook + ' ' + strPage; tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(objXmlProgram["source"].InnerText, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + " " + strPage); } }
private void lstArt_SelectedIndexChanged(object sender, EventArgs e) { if (string.IsNullOrEmpty(lstArt.Text)) { return; } // Retireve the information for the selected piece of Cyberware. XmlNode objXmlMetamagic = _objXmlDocument.SelectSingleNode("/chummer/" + _strRoot + "/" + _strNode + "[name = \"" + lstArt.SelectedValue + "\"]"); string strBook = CommonFunctions.LanguageBookShort(objXmlMetamagic["source"]?.InnerText, GlobalOptions.Language); string strPage = objXmlMetamagic["altpage"]?.InnerText ?? objXmlMetamagic["page"]?.InnerText; lblSource.Text = $"{strBook} {strBook}"; tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(objXmlMetamagic["source"].InnerText, GlobalOptions.Language) + " " + LanguageManager.GetString("String_Page", GlobalOptions.Language) + " " + strPage); }
private void lstPowers_SelectedIndexChanged(object sender, EventArgs e) { if (_blnLoading) { return; } string strSelectedId = lstPowers.SelectedValue?.ToString(); XPathNavigator objXmlPower = null; if (!string.IsNullOrEmpty(strSelectedId)) { objXmlPower = _xmlBasePowerDataNode.SelectSingleNode("powers/power[id = \"" + strSelectedId + "\"]"); } if (objXmlPower != null) { string strSpace = LanguageManager.GetString("String_Space"); // Display the information for the selected Power. string strPowerPointsText = objXmlPower.SelectSingleNode("points")?.Value ?? string.Empty; if (objXmlPower.SelectSingleNode("levels")?.Value == bool.TrueString) { strPowerPointsText += strSpace + '/' + strSpace + LanguageManager.GetString("Label_Power_Level"); } string strExtrPointCost = objXmlPower.SelectSingleNode("extrapointcost")?.Value; if (!string.IsNullOrEmpty(strExtrPointCost)) { strPowerPointsText = strExtrPointCost + strSpace + '+' + strSpace + strPowerPointsText; } lblPowerPoints.Text = strPowerPointsText; string strSource = objXmlPower.SelectSingleNode("source")?.Value ?? LanguageManager.GetString("String_Unknown"); string strPage = objXmlPower.SelectSingleNode("altpage")?.Value ?? objXmlPower.SelectSingleNode("page")?.Value ?? LanguageManager.GetString("String_Unknown"); lblSource.Text = CommonFunctions.LanguageBookShort(strSource) + strSpace + strPage; lblSource.SetToolTip(CommonFunctions.LanguageBookLong(strSource) + strSpace + LanguageManager.GetString("String_Page") + strSpace + strPage); } else { lblPowerPoints.Text = string.Empty; lblSource.Text = string.Empty; lblSource.SetToolTip(string.Empty); } lblPowerPointsLabel.Visible = !string.IsNullOrEmpty(lblPowerPoints.Text); lblSourceLabel.Visible = !string.IsNullOrEmpty(lblSource.Text); }
private void lstTechniques_SelectedIndexChanged(object sender, EventArgs e) { string strSelectedId = lstTechniques.SelectedValue?.ToString(); if (!string.IsNullOrEmpty(strSelectedId)) { XmlNode xmlTechnique = _xmlDocument.SelectSingleNode("/chummer/techniques/technique[id = \"" + strSelectedId + "\"]"); if (xmlTechnique != null) { string strSource = xmlTechnique["source"].InnerText; string strPage = xmlTechnique["altpage"]?.InnerText ?? xmlTechnique["page"].InnerText; lblSource.Text = CommonFunctions.LanguageBookShort(strSource, GlobalOptions.Language) + ' ' + strPage; tipTooltip.SetToolTip(lblSource, CommonFunctions.LanguageBookLong(strSource, GlobalOptions.Language) + ' ' + LanguageManager.GetString("String_Page", GlobalOptions.Language) + ' ' + strPage); } } }
public SourceString(string strSource, int intPage, string strLanguage = "", CultureInfo objCultureInfo = null, Character objCharacter = null) { Language = !string.IsNullOrEmpty(strLanguage) ? strLanguage : GlobalOptions.Language; CultureInfo = objCultureInfo ?? GlobalOptions.CultureInfo; _intPage = intPage; Code = CommonFunctions.LanguageBookShort(strSource, Language, objCharacter); _intHashCode = new { Language, CultureInfo, Code, Page }.GetHashCode(); if (!_dicCachedStrings.ContainsKey(Language)) { _dicCachedStrings.TryAdd(Language, new Tuple <string, string>( LanguageManager.GetString("String_Space", Language), LanguageManager.GetString("String_Page", Language))); } string strSpace = _dicCachedStrings[Language].Item1; LanguageBookTooltip = CommonFunctions.LanguageBookLong(strSource, Language, objCharacter) + strSpace + _dicCachedStrings[Language].Item2 + strSpace + _intPage.ToString(CultureInfo); }
public SourceString(string strSourceString, string strLanguage) { Language = strLanguage; string strCode = strSourceString; int intWhitespaceIndex = strSourceString.IndexOf(' '); if (intWhitespaceIndex != -1) { strCode = strSourceString.Substring(0, intWhitespaceIndex); if (intWhitespaceIndex + 1 < strSourceString.Length) { int.TryParse(strSourceString.Substring(intWhitespaceIndex + 1), out _intPage); } } Code = CommonFunctions.LanguageBookShort(strCode, Language); _strCachedSpace = LanguageManager.GetString("String_Space", strLanguage); LanguageBookTooltip = CommonFunctions.LanguageBookLong(strCode, Language) + _strCachedSpace + LanguageManager.GetString("String_Page", strLanguage) + _strCachedSpace + _intPage; }