protected override bool PrepareToolTip(UIElement element, UltraToolTipInfo toolTipInfo) { // See if this is a RowUIElement. var result = prepareRowToolTip(element, toolTipInfo); if(result) return true; // See if this is a CellUIElement. result = prepareCellToolTip(element, toolTipInfo); if(result) return true; // See if this is a DataErrorIconUIElement. result = prepareDataErrorIconToolTip(element, toolTipInfo); if(result) return true; // See if this is a HeaderUIElement result = prepareHeaderToolTip(element, toolTipInfo); if(result) return true; // See if this is a GroupByRowUIElement result = prepareGroupbyRowToolTip(element, toolTipInfo); if(result) return true; // Since the element was not one of the types being checked for, // return false so no tooltip will be shown. return false; }
private void TXT_Gender_MouseHover(object sender, EventArgs e) { // Create a new ToolTipInfo UltraToolTipInfo toolTipInfo = new UltraToolTipInfo("برجاء اختيار النوع ", ToolTipImage.Info, "", DefaultableBoolean.True); this.ultraToolTipManager1.SetUltraToolTip(TXT_Gender, toolTipInfo); }
private void TXT_BirthDate_MouseHover(object sender, EventArgs e) { // Create a new ToolTipInfo UltraToolTipInfo toolTipInfo = new UltraToolTipInfo("برجاء اختيار عمود تاريخ الميلاد ", ToolTipImage.Info, "", DefaultableBoolean.True); this.ultraToolTipManager1.SetUltraToolTip(TXT_BirthDate, toolTipInfo); }
private void control_MouseLeave(object sender, EventArgs e) { // If the mouse leaves the control, we won't get a MouseMove, so // just clear any tooltips. // Get the ToolTipInfo UltraToolTipInfo toolTipInfo = this.ToolTipInfo; // Hide any currently displayed tooltips toolTipManager.HideToolTip(); // Disable the ToolTipInfo for this control. toolTipInfo.Enabled = DefaultableBoolean.False; // Clear the cached element so that if the mouse re-enters the control // on the same element from which it exited, it will still show a // tooltip. this.lastToolTipElement = null; }
private bool prepareRowToolTip(UIElement element, UltraToolTipInfo toolTipInfo) { try { toolTipInfo.Enabled = DefaultableBoolean.False; // See if the element is a RowUIElement var rowElement = element as RowUIElement; // If it's not a RowUIElement, return false. if (rowElement == null) return false; // Get the Cell from the CellUIElement var row = rowElement.GetContext(typeof(UltraGridRow)) as UltraGridRow; if (row != null) { var tag = row.Tag as ToolTipCellInfo; if (tag != null) { var info = tag; toolTipInfo.ToolTipTextFormatted = info.Text; toolTipInfo.ToolTipTitle = info.Title; toolTipInfo.ToolTipImage = getImage(info.ImageType); toolTipInfo.ToolTipTextStyle = ToolTipTextStyle.Formatted; row.ToolTipText = string.Empty; toolTipInfo.Enabled = DefaultableBoolean.True; } } // Return true to indicate that a tooltip should be displayed when the // mouse is over this element. return row != null && row.Tag != null && row.Tag is ToolTipCellInfo; } catch (Exception ex) { _log.ErrorFormat("Errore inaspettato durante la impostazione del tool tip su una grid - {0} - grid:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), _grid.Name, Login.Instance.CurrentLogin().Azienda); throw; } }
private void GenerateTooltip(ChampionSpellStatic champSpell, UltraToolTipInfo thisToolTipInfo) { try { //Prepare Desc// string sDescPrep = champSpell.Tooltip; //Replace Var.Ceoff markers in tooltip if (champSpell.Vars != null) { foreach (SpellVarsStatic spellVars in champSpell.Vars) { string sTarget = "{{ " + spellVars.Key + " }}"; string sReplacement = ""; string ofAdAp = ""; string dynText = spellVars.Dyn != null ? spellVars.Dyn : ""; if (spellVars.Coeff != null) { var varsCoeff = (Newtonsoft.Json.Linq.JArray)spellVars.Coeff; int index = 0; int icount = varsCoeff.Count; bool isPercent = false; foreach (string sVar in varsCoeff) { string sVarNew = sVar; try { double dVar = Convert.ToDouble(sVarNew); if (dVar < 3) { sVarNew = (dVar * 100).ToString(); isPercent = true; } } catch { //do nothing } sReplacement += sVarNew; if ((index + 1) != icount) { sReplacement += "/"; } index++; } if (isPercent) { sReplacement += "%"; } } if (spellVars.Link.Contains("bonusarmor")) { ofAdAp = " of bonus armor"; } else if (spellVars.Link.Contains("bonusattackdamage")) { ofAdAp = " of bonus attack damage"; } else if (spellVars.Link.Contains("bonushealth")) { ofAdAp = " of bonus health"; } else if (spellVars.Link.Contains("maxhealth")) //This one was made up by for ChampionDataCorrections { ofAdAp = " of max health"; } else if (spellVars.Link.Contains("bonusspellblock")) { ofAdAp = " of bonus magic resist"; } else if (spellVars.Link.Contains("armor")) { ofAdAp = " of total armor"; } else if (spellVars.Link.Contains("attackdamage")) { ofAdAp = " of attack damage"; } else if (spellVars.Link.Contains("health")) { ofAdAp = " of health"; } else if (spellVars.Link.Contains("spelldamage")) { ofAdAp = " of ability power"; } else if (spellVars.Link.Contains("mana")) { ofAdAp = " of mana"; } else if (spellVars.Link.Contains("@text")) { } else if (spellVars.Link.Contains("@cooldownchampion")) { } else if (spellVars.Link.Contains("@dynamic.abilitypower")) { ofAdAp = " of ability power"; } else if (spellVars.Link.Contains("@dynamic.attackdamage") && champSpell.Name == "Savagery") //Rengar { sReplacement = ""; } else if (spellVars.Link.Contains("@dynamic.attackdamage")) { ofAdAp = " per attack damage"; } else if (spellVars.Link.Contains("@stacks")) { ofAdAp = " of stacks"; } else if (spellVars.Link.Contains("@special.BraumWArmor")) { //TODO } else if (spellVars.Link.Contains("@special.BraumWMR")) { //TODO } else if (spellVars.Link.Contains("@special.dariusr3")) { //TODO } else if (spellVars.Link.Contains("@special.jaycew")) { //TODO } else if (spellVars.Link.Contains("@special.jaxrarmor")) { sReplacement = "bonus"; } else if (spellVars.Link.Contains("@special.jaxrmr")) { sReplacement = "bonus"; } else if (spellVars.Link.Contains("@special.nautilusq")) { //TODO } else if (spellVars.Link.Contains("@special.viw")) { dynText = "1% per "; ofAdAp = " bonus AD"; } else if (spellVars.Link.Contains("@custom.MagicDamage")) //This one was made up by for ChampionDataCorrections { ofAdAp = ""; } else if (spellVars.Link.Contains("@custom.percentOfAttack")) //This one was made up by for ChampionDataCorrections { ofAdAp = "% of attack damage"; } else if (spellVars.Link.Contains("@custom.percentOfMana")) //This one was made up by for ChampionDataCorrections { ofAdAp = "% of mana"; } else if (spellVars.Link.Contains("@custom.percentOfAP")) //This one was made up by for ChampionDataCorrections { ofAdAp = "% of AP"; } else if (spellVars.Link.Contains("@custom.percent")) //This one was made up by for ChampionDataCorrections { ofAdAp = "%"; } sDescPrep = sDescPrep.Replace(sTarget, dynText + sReplacement + ofAdAp); } } //Replace effect markers in tooltip if (champSpell.EffectBurns != null) { int i = 0; foreach (string sReplacement in champSpell.EffectBurns) { if (sReplacement != "") { string newReplace = sReplacement; string sTarget = "{{ e" + i + " }}"; sDescPrep = sDescPrep.Replace(sTarget, newReplace); } i++; } } //Replace cost marker in tooltip if (sDescPrep.Contains("{{ cost }}")) { string sTarget = "{{ cost }}"; sDescPrep = sDescPrep.Replace(sTarget, champSpell.CostBurn); } //replace tags in Resource string resourceCost = champSpell.Resource != null?champSpell.Resource.Replace("{{ cost }}", champSpell.CostBurn) : "Passive"; if (champSpell.EffectBurns != null) { int i = 0; foreach (string sReplacement in champSpell.EffectBurns) { if (sReplacement != "") { string newReplace = sReplacement; string sTarget = "{{ e" + i + " }}"; resourceCost = resourceCost.Replace(sTarget, newReplace); } i++; } } //Fix color tags sDescPrep = sDescPrep.Replace("class=\"color", "style=\"color:#"); //Artificial Word-wrap sDescPrep = StringExtensions.BrWrapper(sDescPrep); //Prep Image for tooltip string version = getChampionsFromServer.version; string file = string.Format(@"{0}\Data\Champions\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, version, champSpell.Image.Sprite); string dir = string.Format(@"{0}\Data\Champions\Images", PublicStaticVariables.thisAppDataDir); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } Image imageTemp = Image.FromFile(file); imageTemp = CommonMethods.cropImage(imageTemp, new Rectangle(champSpell.Image.X, champSpell.Image.Y, champSpell.Image.Width, champSpell.Image.Height)); string image = FormattedLinkEditor.EncodeImage(imageTemp); //Compile Description string tipDesc = string.Format(@" <div style='color:White; font-family:Tahoma; font-size:10pt; text-smoothing-mode:AntiAlias; border-style:solid; border-width:2px; width:400px'> <img style='padding: 4 4 0 4;' data='{5}' width='48' height='48'/> <div> <br/> <b>{0}</b><br/> <span style='font-size:8pt'> {1}<br/> {2}<br/> {3} </span> </div> <hr style='border-style:solid; margin: 0 0 0 0;'/> {4} </div>" , champSpell.Name, "Cooldown: " + (champSpell.Resource != null ? champSpell.CooldownBurn : "Passive"), "Cost: " + resourceCost, "Range: " + champSpell.RangeBurn, sDescPrep, image); tipDesc = tipDesc.Replace("<br>", "<br/>"); tipDesc = tipDesc.Replace("\"", "'"); //tipDesc = tipDesc.Replace("\r", ""); //tipDesc = tipDesc.Replace("\n", ""); //tipDesc = tipDesc.Replace("\t", ""); //TODO: add \r for troubleshooting tipDesc = tipDesc.Replace("<br/>", "<br/>\r\n"); //These tags needed to be closed for UltraToolTipInfo to accept it as well-formed html because by default HtmlAgilityPack removes the /> at the end HtmlNode.ElementsFlags["img"] = HtmlElementFlag.Closed; HtmlNode.ElementsFlags["hr"] = HtmlElementFlag.Closed; HtmlNode.ElementsFlags["br"] = HtmlElementFlag.Closed; //Fixes Riots malformed html HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(tipDesc); MemoryStream memoryStream = new MemoryStream(); doc.Save(memoryStream); memoryStream.Seek(0, System.IO.SeekOrigin.Begin); StreamReader streamReader = new StreamReader(memoryStream); tipDesc = streamReader.ReadToEnd(); thisToolTipInfo.ToolTipTextFormatted = tipDesc; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void GenerateTooltip(PassiveStatic passiveStatic, UltraToolTipInfo thisToolTipInfo) { try { string sDescPrep = passiveStatic.Description; //Fix color tags sDescPrep = sDescPrep.Replace("class=\"color", "style=\"color:#"); //Artificial Word-wrap sDescPrep = StringExtensions.BrWrapper(sDescPrep); //Prep Image for tooltip string version = getChampionsFromServer.version; string file = string.Format(@"{0}\Data\Champions\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, version, passiveStatic.Image.Sprite); string dir = string.Format(@"{0}\Data\Champions\Images", PublicStaticVariables.thisAppDataDir); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } Image imageTemp = Image.FromFile(file); imageTemp = CommonMethods.cropImage(imageTemp, new Rectangle(passiveStatic.Image.X, passiveStatic.Image.Y, passiveStatic.Image.Width, passiveStatic.Image.Height)); string image = FormattedLinkEditor.EncodeImage(imageTemp); //Compile Description string tipDesc = string.Format(@" <div style='color:White; font-family:Tahoma; font-size:10pt; text-smoothing-mode:AntiAlias; border-style:solid; border-width:2px; width:400px'> <img style='padding: 4 4 0 4;' data='{2}' width='48' height='48'/> <div> <br/> <b>{0}</b> </div> <hr style='border-style:solid; margin: 0 0 0 0;'/> {1} </div>" , passiveStatic.Name, sDescPrep, image); tipDesc = tipDesc.Replace("<br>", "<br/>"); tipDesc = tipDesc.Replace("\"", "'"); //tipDesc = tipDesc.Replace("\r", ""); //tipDesc = tipDesc.Replace("\n", ""); //tipDesc = tipDesc.Replace("\t", ""); //TODO: add \r for troubleshooting tipDesc = tipDesc.Replace("<br/>", "<br/>\r\n"); //These tags needed to be closed for UltraToolTipInfo to accept it as well-formed html because by default HtmlAgilityPack removes the /> at the end HtmlNode.ElementsFlags["img"] = HtmlElementFlag.Closed; HtmlNode.ElementsFlags["hr"] = HtmlElementFlag.Closed; HtmlNode.ElementsFlags["br"] = HtmlElementFlag.Closed; //Fixes Riots malformed html HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(tipDesc); MemoryStream memoryStream = new MemoryStream(); doc.Save(memoryStream); memoryStream.Seek(0, System.IO.SeekOrigin.Begin); StreamReader streamReader = new StreamReader(memoryStream); tipDesc = streamReader.ReadToEnd(); thisToolTipInfo.ToolTipTextFormatted = tipDesc; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private bool prepareGroupbyRowToolTip(UIElement element, UltraToolTipInfo toolTipInfo) { try { // See if the element is a GroupByRowUIElement var groupByRowUIElement = element as GroupByRowUIElement; // if this is not a GroupByRowUIElement, return false. if (groupByRowUIElement == null) return false; // Get the UltraGridGroupByRow from the GroupByRowUIElement var groupByRow = groupByRowUIElement.GetContext(typeof(UltraGridGroupByRow)) as UltraGridGroupByRow; // Set the Properties on the tooltip var toolTipText = groupByRow != null && groupByRow.Expanded ? "Doppio click qui per chiudere la riga" : "Doppio click qui per espandere la riga"; toolTipInfo.ToolTipTextFormatted = toolTipText; if (groupByRow != null && groupByRow.Value is object[]) toolTipInfo.ToolTipTitle = String.Format("Raggruppamento: {0}", (object[])groupByRow.Value); toolTipInfo.ToolTipImage = ToolTipImage.Info; // Return true to indicate that a tooltip should be displayed when the // mouse is over this element. return true; } catch (Exception ex) { _log.Error("Errore inaspettato durante la impostazione del tool tip su una grid - " + Utility.GetMethodDescription() + " - grid:" + _grid.Name + " - azienda:" + Login.Instance.CurrentLogin().Azienda, ex); throw; } }
private static bool prepareHeaderToolTip(UIElement element, UltraToolTipInfo toolTipInfo) { // Per ora nessun tooltip sulla colonna return false; // See if the element is a cell var headerElement = element as HeaderUIElement; // If it's not a HeaderUIElement, return false. if (headerElement == null) return false; // There are different types of headers in the grid and they all // use the same type of element (HeaderUIElement). // So determine if this is a Column Header var columnHeader = headerElement.GetContext(typeof(ColumnHeader)) as ColumnHeader; if (columnHeader != null) { toolTipInfo.ToolTipTextFormatted = @"Clicca qui per ordinare la lista per questa colonna."; toolTipInfo.ToolTipTitle = string.Format("Colonna: {0}", columnHeader.Caption); toolTipInfo.ToolTipImage = ToolTipImage.Info; return true; } // Return true to indicate that a tooltip should be displayed when the // mouse is over this element. return false; }
private bool prepareCellToolTip(UIElement element, UltraToolTipInfo toolTipInfo) { try { toolTipInfo.Enabled = DefaultableBoolean.False; // See if the element is a CellUIElement var cellElement = element as CellUIElement; // If it's not a CellUIElement, return false. if (cellElement == null) return false; // Get the Cell from the CellUIElement var cell = cellElement.GetContext(typeof(UltraGridCell)) as UltraGridCell; // If this is an image column, display the image in // the tooltip. if (cell != null && cell.Column.DataType == typeof(Image)) { var tag = cell.Tag as ToolTipCellInfo; if (tag != null) { var info = tag; toolTipInfo.ToolTipTextFormatted = info.Text; toolTipInfo.ToolTipTitle = info.Title; toolTipInfo.ToolTipImage = ToolTipImage.Custom; toolTipInfo.Appearance.Image = cell.Value as Image; toolTipInfo.Enabled = DefaultableBoolean.True; } } else { if (cell != null) { var tag = cell.Tag as ToolTipCellInfo; if (tag != null) { var info = tag; toolTipInfo.ToolTipTextFormatted = info.Text; toolTipInfo.ToolTipTitle = info.Title; toolTipInfo.ToolTipImage = getImage(info.ImageType); toolTipInfo.ToolTipTextStyle = ToolTipTextStyle.Formatted; cell.ToolTipText = string.Empty; toolTipInfo.Enabled = DefaultableBoolean.True; } } } // Return true to indicate that a tooltip should be displayed when the // mouse is over this element. return cell != null && cell.Tag != null && cell.Tag is ToolTipCellInfo; } catch (Exception ex) { _log.ErrorFormat("Errore inaspettato durante la impostazione del tool tip su una grid - {0} - grid:{1} - azienda:{2}", ex, Utility.GetMethodDescription(), _grid.Name, Login.Instance.CurrentLogin().Azienda); throw; } }
/// <summary> /// Handles the MouseMove event of the Control /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void control_MouseMove(object sender, MouseEventArgs e) { bool showToolTipForElement = false; object element = null; // Get the toolTipInfo UltraToolTipInfo toolTipInfo = this.ToolTipInfo; // Get the main UIElement of the control. All UltraControlBase // controls implement IUltraControlElement, so they will all // have a main element. IUltraControlElement iMainElement = this.control as IUltraControlElement; if (iMainElement != null) // Infragistics Controls... { UIElement mainElement = iMainElement.MainUIElement; // Get the element under the mouse UIElement uiElement = mainElement.ElementFromPoint(new Point(e.X, e.Y)); // Start with the element under the mouse and walk up it's parent chain // until we find an element that should display a tooltip, or // come to the end of the chain (where element == null). while (uiElement != null && !showToolTipForElement) { // If this is the same element we evaluated last time through, // just return. This is both for efficiency and so the tooltip // does not continuously hide and re-display. if (uiElement == this.lastToolTipElement) { return; } // Call PrepareToolTip. This will allow the derived class to // determine if the element should show a tooltip and to // set the properties on the toolTipInfo. showToolTipForElement = this.PrepareToolTip(uiElement, toolTipInfo); // If PrepareToolTip returned true, there's no reason to continue looping. // If not, get the parent element and try again. if (!showToolTipForElement) { uiElement = uiElement.Parent; } } element = uiElement; } else // other (Std.) controls... // Get the element under the mouse { element = this.ElementFromPoint(new Point(e.X, e.Y)); // Start with the element under the mouse and walk up it's parent chain // until we find an element that should display a tooltip, or // come to the end of the chain (where element == null). while (element != null && !showToolTipForElement) { // If this is the same element we evaluated last time through, // just return. This is both for efficiency and so the tooltip // does not continuously hide and re-display. if (element == this.lastToolTipElement) { return; } // Call PrepareToolTip. This will allow the derived class to // determine if the element should show a tooltip and to // set the properties on the toolTipInfo. showToolTipForElement = this.PrepareToolTip(element, toolTipInfo); // If PrepareToolTip returned true, there's no reason to continue looping. if (!showToolTipForElement) { element = null; } } } // If showToolTipForElement is true, enabled the tooltip if (showToolTipForElement) { // If we are showing a tooltip for a different element than we did // last, Hide the old tooltip. if (element != this.lastToolTipElement) { toolTipManager.HideToolTip(); } // Enabled to ToolTipInfo. The tooltip will not actually display // until the InitialDelay of the UtraToolTipManager expires. toolTipInfo.Enabled = DefaultableBoolean.True; } else { //showToolTipForElement is false. So no tooltip should be shown. // Hide any tooltips that were displayed. toolTipManager.HideToolTip(); // Disable the ToolTipInfo toolTipInfo.Enabled = DefaultableBoolean.False; } // Store the last element we just processed. this.lastToolTipElement = element; }
/// <summary> /// The PrepareToolTip method fires each time an element is evaluated for tooltip display. /// </summary> /// <param name="element">The object currently needing evaluation.</param> /// <param name="toolTipInfo">The UltraToolTipInfo for the control</param> /// <returns>Returns true if the element in question should display a tooltip, false if it should not.</returns> /// <remarks> /// This method must be overriden in a derived class and each element evaluated. /// If an element is evaluated by this method and the method returns false indicating /// that the element does not need a tooltip, the method will be called with the /// parent element, all the way up the element chain. In this way, elements that /// are contained by other elements can show more specific tooltips. /// To properly use this method, derive a class from UltraToolTipContextHelperBase /// and override the PrepareToolTip method. Inisde the method, examine the /// UIElement and determine if a tooltip is needed. If so, set the appropriate /// properties of toolTipInfo such as ToolTipText, ToolTipTitle, ToolTipImage, Appearance, /// etc. and return true from the method. If the element does not need a tooltip, return /// false. /// </remarks> protected abstract bool PrepareToolTip(object element, UltraToolTipInfo toolTipInfo);
private void updateSystemStatus() { string status = string.Empty; UltraToolTipInfo tooltip; // Set the status. if (m_IsConnected) { // get SQL Server Agent Status if (m_IsAgentOk) { if (Program.gController.isAdmin) { _pictureBox_Agent.Image = AppIcons.AppImage48(AppIcons.EnumImageList48.AgentStarted); _linkLabel_AgentStatus.Text = Utility.ErrorMsgs.SQLServerAgentStarted; tooltip = new UltraToolTipInfo(ToolTip_AgentOK, ToolTipImage.Info, ToolTip_AgentTitle, Infragistics.Win.DefaultableBoolean.False); } else { _pictureBox_Agent.Image = AppIcons.AppImage16(AppIcons.Enum.Unknown); _linkLabel_AgentStatus.Text = Utility.ErrorMsgs.SQLServerAgentUnknown; tooltip = new UltraToolTipInfo(ToolTip_AgentUnknown, ToolTipImage.Warning, ToolTip_AgentTitle, Infragistics.Win.DefaultableBoolean.False); } } else { _pictureBox_Agent.Image = AppIcons.AppImage48(AppIcons.EnumImageList48.AgentStopped); _linkLabel_AgentStatus.Text = Utility.ErrorMsgs.SQLServerAgentStopped; tooltip = new UltraToolTipInfo(ToolTip_AgentBad, ToolTipImage.Error, ToolTip_AgentTitle, Infragistics.Win.DefaultableBoolean.False); status += (status.Length == 0 ? string.Empty : "\n") + StatusAttend_Agent; } _linkLabel_AgentStatus.LinkArea = new LinkArea(0, _linkLabel_AgentStatus.Text.Length); _ultraToolTipManager.SetUltraToolTip(_linkLabel_AgentStatus, tooltip); // get License Status if (m_IsLicenseOk) { if (m_IsLicenseNotExpiring) { _pictureBox_License.Image = global::Idera.SQLsecure.UI.Console.Properties.Resources.check_32; _linkLabel_LicenseStatus.Text = Status_LicenseOK; } else { _linkLabel_LicenseStatus.Text = Status_LicenseExpiring; _pictureBox_License.Image = global::Idera.SQLsecure.UI.Console.Properties.Resources.warning_32; status += (status.Length == 0 ? string.Empty : "\n") + StatusAttend_License; } } else { _linkLabel_LicenseStatus.Text = Status_LicenseBad; _pictureBox_License.Image = global::Idera.SQLsecure.UI.Console.Properties.Resources.error_32; status += (status.Length == 0 ? string.Empty : "\n") + StatusAttend_License; } if (Program.gController.Permissions.hasSecurity(Utility.Security.Functions.ManageLicense)) { _linkLabel_LicenseStatus.LinkArea = new LinkArea(0, _linkLabel_LicenseStatus.Text.Length); } else { _linkLabel_LicenseStatus.LinkArea = new LinkArea(0, 0); } // get Audited Servers Status if (m_AllServersOk) { _pictureBox_Servers.Image = global::Idera.SQLsecure.UI.Console.Properties.Resources._32_SystemOK; _linkLabel_ServersStatus.Text = Status_ServersOK; tooltip = new UltraToolTipInfo(m_ServersWarn == 0 ? ToolTip_ServersOK : String.Format(ToolTip_ServersWarn, m_ServersWarn.ToString()), ToolTipImage.Info, ToolTip_ServersTitle, Infragistics.Win.DefaultableBoolean.False); } else { if (m_ServersError == m_Servers.Count) { _pictureBox_Servers.Image = global::Idera.SQLsecure.UI.Console.Properties.Resources._32_SystemWarn; _linkLabel_ServersStatus.Text = String.Format(Status_ServersBad, m_ServersError.ToString()); tooltip = new UltraToolTipInfo(ToolTip_ServersAllBad, ToolTipImage.Error, ToolTip_ServersTitle, Infragistics.Win.DefaultableBoolean.False); } else { _pictureBox_Servers.Image = global::Idera.SQLsecure.UI.Console.Properties.Resources._32_SystemWarn; _linkLabel_ServersStatus.Text = String.Format(Status_ServersBad, m_ServersError.ToString()); tooltip = new UltraToolTipInfo(m_ServersWarn == 0 ? String.Format(ToolTip_ServersBad, m_ServersWarn.ToString()) : String.Format(ToolTip_ServersWarnBad, m_ServersError.ToString(), m_ServersWarn.ToString()), ToolTipImage.Error, ToolTip_ServersTitle, Infragistics.Win.DefaultableBoolean.False); } status += (status.Length == 0 ? string.Empty : "\n") + StatusAttend_Servers; } _linkLabel_ServersStatus.LinkArea = new LinkArea(0, _linkLabel_ServersStatus.Text.Length); _ultraToolTipManager.SetUltraToolTip(_linkLabel_ServersStatus, tooltip); // Overall repository status if (m_IsAgentOk && m_IsLicenseOk && m_IsLicenseNotExpiring && m_AllServersOk) { _pictureBox_ServerStatus.Image = AppIcons.AppImage48(AppIcons.EnumImageList48.StatusGood); _linkLabel_ServerStatus.Text = SystemNormal; } else { if (m_ServersError == m_Servers.Count) { _pictureBox_ServerStatus.Image = AppIcons.AppImage48(AppIcons.EnumImageList48.StatusError); _linkLabel_ServerStatus.Text = status; } else { _pictureBox_ServerStatus.Image = AppIcons.AppImage48(AppIcons.EnumImageList48.StatusWarning); _linkLabel_ServerStatus.Text = status; } } // Repository Info _lbl_Repository.Text = String.Format(ServerFmt, Program.gController.Repository.Instance, Program.gController.Repository.SQLServerVersionFriendlyLong); _lbl_License.Text = String.Format(LicenseFmt, Program.gController.Repository.GetStrLicensedServers()); _lbl_Size.Text = m_DbSize; _lbl_LastGroomed.Text = m_LastGroomed == null ? "Never" : m_LastGroomed.Value.ToString(Utility.Constants.DATETIME_FORMAT); } else { //_pictureBox_ServerStatus.Image = AppIcons.AppImage48(AppIcons.EnumImageList48.StatusWarning); //_linkLabel_ServerStatus.Text = SystemNotConnected; _lbl_Repository.Text = SystemNotConnected; _lbl_License.Text = _lbl_Size.Text = _lbl_LastGroomed.Text = String.Empty; } }
private void pnlItem_DragDrop(object sender, DragEventArgs e) { try { string dataString = e.Data.GetData(DataFormats.Text) as string; if ((dataString.Contains("ITEM") || dataString.Contains("ELIXIR")) && form1.itemsTab.getItemsFromServer.itemsPrepared != null) { string itemID = dataString.Replace("ITEM", ""); itemID = itemID.Replace("ELIXIR", ""); if (form1.itemsTab.getItemsFromServer.itemsPrepared.Count > 0) { //Generate PicBox CreateItemDiv itemPreped = form1.itemsTab.getItemsFromServer.itemsPrepared.Find(o => o.thisID.ToString() == itemID); PictureBox itemPicBox = new PictureBox(); itemPicBox.Size = new Size(48, 48); itemPicBox.Location = new Point(0, 0); string file = string.Format(@"{0}\Data\Items\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, itemPreped.thisVersion, itemPreped.aItem.Image.Sprite); Image imageItem = Image.FromFile(file); Image image = CommonMethods.cropImage(imageItem, new Rectangle(itemPreped.aItem.Image.X, itemPreped.aItem.Image.Y, itemPreped.aItem.Image.Width, itemPreped.aItem.Image.Height)); itemPicBox.Image = image; itemPicBox.MouseClick += itemPicBox_MouseClick; itemPicBox.Cursor = Cursors.Hand; itemPicBox.Tag = itemPreped; Panel thisPnl = sender as Panel; thisPnl.Tag = itemPreped; if (thisPnl.Controls.Count > 0) { List <Control> ctrls = thisPnl.Controls.Cast <Control>().ToList(); thisPnl.Controls.Clear(); foreach (Control c in ctrls) { c.Dispose(); } } thisPnl.Controls.Add(itemPicBox); string sTooltip = CreateItemPicBoxTooltip(itemPreped); //tooltip UltraToolTipInfo temp = new UltraToolTipInfo(); switch (thisPnl.Name) { case "pnlItem1": { temp = tipInfoItem1; break; } case "pnlItem2": { temp = tipInfoItem2; break; } case "pnlItem3": { temp = tipInfoItem3; break; } case "pnlItem4": { temp = tipInfoItem4; break; } case "pnlItem5": { temp = tipInfoItem5; break; } case "pnlItem6": { temp = tipInfoItem6; break; } case "pnlElixir": { temp = tipInfoItemElixir; break; } } ultraToolTipManagerGearIcon.SetUltraToolTip(itemPicBox, temp); temp.ToolTipTextFormatted = sTooltip; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } UpdateTotalGoldCost(); }
private static bool prepareDataErrorIconToolTip(UIElement element, UltraToolTipInfo toolTipInfo) { // See if the element is a DataErrorIconUIElement var dataErrorIconUIElement = element as DataErrorIconUIElement; // if this is not a DataErrorIconUIElement, return false. if (dataErrorIconUIElement == null) return false; // Get the Cell from the CellUIElement var cell = dataErrorIconUIElement.GetContext(typeof(UltraGridCell)) as UltraGridCell; // Get the Data Row associated with this cell. if (cell != null) { var row = ((DataRowView)cell.Row.ListObject).Row; // Now that we have the row, we can get the error text. var errorText = row.GetColumnError(cell.Column.Key); // Set the Properties on the tooltip toolTipInfo.ToolTipTextFormatted = errorText; toolTipInfo.ToolTipTitle = string.Format("Column: {0}, Row: {1}", cell.Column.Key, cell.Row.VisibleIndex); } toolTipInfo.ToolTipImage = ToolTipImage.Error; // Return true to indicate that a tooltip should be displayed when the // mouse is over this element. return true; }
/// <summary> /// The PrepareToolTip method fires each time an element is evaluated for tooltip display. /// </summary> /// <param name="element">The UIElement currently needing evaluation.</param> /// <param name="toolTipInfo">The UltraToolTipInfo for the control</param> /// <returns>Returns true if the element in question should display a tooltip, false if it should not.</returns> /// <remarks> /// This method must be overriden in a derived class and each element evaluated. /// If an element is evaluated by this method and the method returns false indicating /// that the element does not need a tooltip, the method will be called with the /// parent element, all the way up the element chain. In this way, elements that /// are contained by other elements can show more specific tooltips. /// To properly use this method, derive a class from UltraToolTipContextHelperBase /// and override the PrepareToolTip method. Inisde the method, examine the /// UIElement and determine if a tooltip is needed. If so, set the appropriate /// properties of toolTipInfo such as ToolTipText, ToolTipTitle, ToolTipImage, Appearance, /// etc. and return true from the method. If the element does not need a tooltip, return /// false. /// </remarks> protected abstract bool PrepareToolTip(UIElement element, UltraToolTipInfo toolTipInfo);
private void setVersionSettings(ServerVersionId serverVersion) { // _view.ToolTipManager.Enabled = false; _view.ToolTipManager.ResetUltraToolTip(_view.cboVendors); _view.ToolTipManager.HideToolTip(); _currentVersion = serverVersion; if (serverVersion == ServerVersionId.SQLite_3) { _view.chkWindowsAuthentication.Checked = false; _view.chkWindowsAuthentication.Enabled = false; _view.txtServer.Enabled = false; _view.txtServer.Width = 100; _view.txtUser.Enabled = false; _view.txtPassword.Enabled = false; setFileBasedDb(true, true, true); if (_view.txtServer.Text.Equals(".")) { _view.txtServer.Text = ""; } } else if (serverVersion == ServerVersionId.FireBird_2) { _view.chkWindowsAuthentication.Checked = false; _view.chkWindowsAuthentication.Enabled = false; _view.txtServer.Enabled = false; _view.txtServer.Width = 100; _view.txtUser.Enabled = false; _view.txtPassword.Enabled = false; setFileBasedDb(true, true, true); if (_view.txtServer.Text.Equals(".")) { _view.txtServer.Text = ""; } if (!ElevationHelper.IsAdmin()) { // TODO specify with privilege we need var ctrl = _view.cboVendors; UltraToolTipInfo tip = _view.ToolTipManager.GetUltraToolTip(ctrl); if (string.IsNullOrEmpty(tip.ToolTipText)) { var info = new UltraToolTipInfo("Requires elevation, please restart SQL8r with more privileges", ToolTipImage.Warning, "Warning", DefaultableBoolean.Default); _view.ToolTipManager.SetUltraToolTip(ctrl, info); } _view.ToolTipManager.ShowToolTip(ctrl, ctrl.PointToScreen(ctrl.Location)); } } else if (serverVersion == ServerVersionId.ODBC_Access || serverVersion == ServerVersionId.ODBC_Excel) { _view.chkWindowsAuthentication.Checked = false; _view.chkWindowsAuthentication.Enabled = false; _view.txtServer.Enabled = false; _view.txtServer.Width = 100; _view.txtUser.Enabled = false; _view.txtPassword.Enabled = false; setFileBasedDb(true, false, true); if (_view.txtServer.Text.Equals(".")) { _view.txtServer.Text = ""; } } else if (serverVersion == ServerVersionId.MySql_5) { _view.chkWindowsAuthentication.Checked = false; _view.chkWindowsAuthentication.Enabled = false; _view.txtServer.Enabled = true; _view.txtServer.Width = _view.txtDatabase.Width; _view.txtUser.Enabled = true; _view.txtPassword.Enabled = true; setFileBasedDb(false, false, false); } else if (serverVersion == ServerVersionId.SqlServer_2005 || serverVersion == ServerVersionId.SqlServer_2008) { _view.chkWindowsAuthentication.Enabled = true; _view.chkWindowsAuthentication.Checked = true; _view.txtServer.Enabled = true; _view.txtServer.Width = _view.txtDatabase.Width; _view.txtUser.Enabled = false; _view.txtPassword.Enabled = false; setFileBasedDb(false, false, false); if (string.IsNullOrEmpty(_view.txtServer.Text)) { _view.txtServer.Text = "."; } } else { throw new SQL8rException(string.Format("Unsupported ServerVersionId: {0}", serverVersion)); } }