// Internal Methods ------------------------------------------------------------------ #region Method: bool ItemNeedsAttention(LocItem item) bool ItemNeedsAttention(LocItem item) { LocAlternate alt = item.GetAlternate(iLanguage); if (null == alt) return true; bool bNeedsAttention = !string.IsNullOrEmpty(alt.NeedsAttention(item)); return bNeedsAttention; }
bool ShouldDisplayInTree(LocItem item) // Assume the parent Group has already been filtered { // Filter Option: All Needing Attention if (FilterCombo.Text == c_ThoseNeedingAttention) return ItemNeedsAttention(item); // Filter Option: Advisor Items if (FilterCombo.Text == c_TranslatorItemsNeedingAttention) return ItemNeedsAttention(item); // Filter Option: Advisor Items Needing Attention if (FilterCombo.Text == c_AdvisorItemsNeedingAttention) return ItemNeedsAttention(item); // Unknown filter return true; }
public LocItem FindOrAddItem(string sItemID, string sEnglish) { LocItem item = Find(sItemID); if (null == item) { item = new LocItem(sItemID); item.English = sEnglish; AppendItem(item); } Debug.Assert(null != item); return item; }
public LocItem AppendItem(LocItem item) { LocItem[] v = new LocItem[Items.Length + 1]; for (int i = 0; i < Items.Length; i++) v[i] = Items[i]; v[Items.Length] = item; m_vItems = v; return item; }
static public LocItem ReadXML(XmlRead xml) { // Collect the ID from the Tag line, and create an item from it string sID = xml.GetValue(c_sID); LocItem item = new LocItem(sID); string sCanHaveKey = xml.GetValue(c_sKey); if (!string.IsNullOrEmpty(sCanHaveKey) && sCanHaveKey == "true") item.CanHaveShortcutKey = true; string sCanHaveTip = xml.GetValue(c_sTip); if (!string.IsNullOrEmpty(sCanHaveTip) && sCanHaveTip == "true") item.CanHaveToolTip = true; // Loop through the other lines for the remaining data while (xml.ReadNextLineUntilEndTag(c_sTag)) { if (xml.IsTag(c_sInformation)) item.Information = xml.GetOneLinerData(); if (xml.IsTag(c_sEnglish)) item.English = xml.GetOneLinerData(); if (xml.IsTag(c_sKey)) item.ShortcutKey = xml.GetOneLinerData(); if (xml.IsTag(c_sTip)) item.ToolTip = xml.GetOneLinerData(); } return item; }
public string NeedsAttention(LocItem item) // Returns empty string if OK, otherwise, a string indicating the problem { // Is there a value? if (string.IsNullOrEmpty(Value)) return "There is no Value in this language"; // Colon handled? if (EndsWithColon(item.English) && !EndsWithColon(Value)) return "The Value needs to end with a colon \":\")"; if (!EndsWithColon(item.English) && EndsWithColon(Value)) return "The Value should not end with a colon \":\")"; // Ellipsis handled? if (EndsWithEllipsis(item.English) && !EndsWithEllipsis(Value)) return "The Value needs to end with a ellipsis \"...\")"; if (!EndsWithEllipsis(item.English) && EndsWithEllipsis(Value)) return "The Value should not end with a ellipsis \"...\")"; // Parameter count if (ParameterCount(item.English) != ParameterCount(Value)) { return "The English and the Value need to have the same number of " + "parameters, e.g., {0}, {1}, etc."; } // Ampersands if (HasAmpersand(item.English) && !HasAmpersand(Value)) { return "This Value needs an ampersand to indicate which letter is the " + "shortcut within the menu."; } return ""; }
public static DialogResult Message( string sID, string sApplicationOpenError, string sDefaultEnglish, string[] vsInsertions, MessageTypes MessageType, MessageDefault msgDefaultButton) { s_sLastMessageID = sID; // Retrieve the localized form of the message LocItem item = DB.Messages.Find(sID); if (null == item) { item = new LocItem(sID); item.English = sDefaultEnglish; DB.Messages.AppendItem(item); } string sMessageText = item.AltValue; // Not Used //MessageBoxButtons.YesNoCancel //MessageBoxIcon.None // Perform the insertions sMessageText = Insert(sMessageText, vsInsertions); // Decide which button(s) and which icon to show in the message box MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBoxIcon icon = MessageBoxIcon.Warning; MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1; switch (msgDefaultButton) { //case MessageDefault.First: //defaultButton = MessageBoxDefaultButton.Button1; //break; case MessageDefault.Second: defaultButton = MessageBoxDefaultButton.Button2; break; case MessageDefault.Third: defaultButton = MessageBoxDefaultButton.Button3; break; } switch (MessageType) { case MessageTypes.Warning: buttons = MessageBoxButtons.OK; icon = MessageBoxIcon.Warning; break; case MessageTypes.WarningYN: buttons = MessageBoxButtons.YesNo; icon = MessageBoxIcon.Warning; break; case MessageTypes.YN: buttons = MessageBoxButtons.YesNo; icon = MessageBoxIcon.Question; break; case MessageTypes.Info: buttons = MessageBoxButtons.OK; icon = MessageBoxIcon.Information; break; case MessageTypes.Error: buttons = MessageBoxButtons.OK; icon = MessageBoxIcon.Error; break; case MessageTypes.WarningYNC: buttons = MessageBoxButtons.YesNoCancel; icon = MessageBoxIcon.Question; break; } // Finally, we can show the message DialogResult result = MessageBox.Show(Form.ActiveForm, sApplicationOpenError + " \n" + sMessageText, s_AppTitle, buttons, icon, defaultButton); //return (result == DialogResult.Yes); return result; }