void UpdateNeedsAttentionStatus() // Assumes changes have been Harvested to the LocAlternative { if (null == Item) { return; } LocAlternate alt = new LocAlternate( m_textYourLanguage.Text, m_comboShortcutKey.Text, m_textToolTip.Text); // Do the test string sNeedsMessage = alt.NeedsAttention(Item); bool bNeedsAttention = !string.IsNullOrEmpty(sNeedsMessage); // Update the tree node if (null != Tree.SelectedNode && null != Tree.SelectedNode.Tag as LocItem) { Tree.SelectedNode.ForeColor = (bNeedsAttention ? Color.Red : Color.Navy); } // Update the message m_labelNeedsAttention.Text = sNeedsMessage; }
// 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); }
void HarvestChanges() { if (null == Item || -1 == iLanguage) { return; } LocAlternate alt = new LocAlternate(ItemYourLanguage, null, null); Item.AddAlternate(iLanguage, alt); alt.ShortcutKey = m_comboShortcutKey.Text; alt.ToolTip = m_textToolTip.Text; }
void PopulateItemControls() { // Start with completely empty controls ClearItemControls(); if (null == Item) { return; } // We'll build the contents of the Info Rich Text Box here string sRTF = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033"; sRTF += "{\\fonttbl" + "{\\f0\\fswiss\\fprq2\\fcharset0 Arial;}" + "{\\f1\\fswiss\\fprq2\\fcharset0 Arial Narrow;}" + "{\\f2\\fswiss\\fprq2\\fcharset0 Microsoft Sans Serif;}" + "}"; sRTF += "{\\colortbl ;\\red0\\green0\\blue128;}"; // First Paragraph: Group Title and Group Description sRTF += "\\pard{\\b\\f0\\fs22 " + Group.Title + ": }"; sRTF += "{\\f2\\fs16 " + Group.Description + "}\\par"; // Skip a line sRTF += "{\\f2\\fs16 }\\par"; // Item to be translated intro sRTF += "\\pard{\\b\\f0\\fs22 Item to be Translated: }"; sRTF += "\\par"; // Item ID sRTF += "\\pard{\\f0\\fs14 Internal ID: }"; sRTF += "{\\f2\\fs14 (" + Item.ID + ")}"; sRTF += "\\par"; // Item Description sRTF += "\\pard{\\f0\\fs16 Description: }"; sRTF += "{\\f2\\fs16 " + Item.Information + "}"; sRTF += "\\par"; // Item in English sRTF += "{\\f2\\fs16 }\\par"; sRTF += "\\pard{\\f2\\fs18 English: }"; sRTF += "{\\f0\\fs28\\b\\cf1 " + _TextToRtfBox(Item.English) + "}"; sRTF += "\\par"; // Item Shortcut Key if (Item.CanHaveShortcutKey) { string s = Item.ShortcutKey; if (string.IsNullOrEmpty(s)) { s = "(none)"; } sRTF += "{\\f2\\fs16 }\\par"; sRTF += "\\pard{\\f2\\fs18 Shortcut key: }"; sRTF += "{\\f0\\fs28\\b\\cf1 " + s + "}"; } // Item Tooltip if (Item.CanHaveToolTip) { string s = Item.ToolTip; if (string.IsNullOrEmpty(s)) { s = "(none)"; } sRTF += "{\\f2\\fs16 }\\par"; sRTF += "\\pard{\\f2\\fs18 ToolTip: }"; sRTF += "{\\f0\\fs28\\b\\cf1 " + s + "}"; } // Place into the control sRTF += "}"; m_rtbInfo.Rtf = sRTF; // What's currently in the language LocAlternate altYours = Item.GetAlternate(iLanguage); ItemYourLanguage = ((null == altYours) ? "" : altYours.Value); // Shortcut Key, if any if (Item.CanHaveShortcutKey) { if (null != altYours) { m_comboShortcutKey.Text = altYours.ShortcutKey; } m_comboShortcutKey.Enabled = true; m_lblShortcutKey.Enabled = true; } else { m_comboShortcutKey.Text = ""; m_comboShortcutKey.Enabled = false; m_lblShortcutKey.Enabled = false; } // Tooltip, if any if (Item.CanHaveToolTip) { if (null != altYours) { m_textToolTip.Text = altYours.ToolTip; } m_textToolTip.Enabled = true; m_lblToolTip.Enabled = true; } else { m_textToolTip.Text = ""; m_textToolTip.Enabled = false; m_lblToolTip.Enabled = false; } // Status m_lblRemaining.Text = ""; // Update controls & status UpdateNeedsAttentionStatus(); CalculateCounts(); }