Skip to content

Commit

Permalink
Fixed #663 Option to hide "Info" tips.
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Feb 27, 2022
1 parent c261193 commit f417108
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 7 deletions.
1 change: 1 addition & 0 deletions FetchXmlBuilder/AppCode/FXBSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class FXBSettings
public XmlColors XmlColors { get; set; } = new XmlColors();
public bool ShowNodeType { get; set; } = false;
public bool ShowValidation { get; set; } = true;
public bool ShowValidationInfo { get; set; } = true;
public bool ShowRepository { get; set; } = false;
}

Expand Down
2 changes: 1 addition & 1 deletion FetchXmlBuilder/AppCode/TreeNodeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ private static void SetWarnings(TreeNode node, FetchXmlBuilder fxb)
{
return;
}
var warning = Validations.GetWarning(node, fxb);
var warning = fxb.GetWarning(node);
if (warning != null)
{
node.ToolTipText = warning.Message;
Expand Down
2 changes: 1 addition & 1 deletion FetchXmlBuilder/DockControls/TreeBuilderControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ private void SelectAttributes()

private void SetWarning(TreeNode node)
{
var warning = Validations.GetWarning(node, fxb);
var warning = fxb.GetWarning(node);
if (warning != null)
{
var leadingSpaces = " ";
Expand Down
16 changes: 16 additions & 0 deletions FetchXmlBuilder/FetchXmlBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Cinteros.Xrm.FetchXmlBuilder.AppCode;
using Cinteros.Xrm.FetchXmlBuilder.Controls;
using Cinteros.Xrm.FetchXmlBuilder.DockControls;
using Cinteros.Xrm.FetchXmlBuilder.Forms;
using Cinteros.Xrm.XmlEditorUtils;
Expand Down Expand Up @@ -711,6 +712,21 @@ internal string GetOData(int version)
}
}

internal ControlValidationResult GetWarning(TreeNode node)
{
if (!settings.ShowValidation || node == null)
{
return null;
}
var warning = Validations.GetWarning(node, this);
if (warning?.Level == ControlValidationLevel.Info && !settings.ShowValidationInfo)
{
warning = null;
}
return warning;
}


internal void LoadEntityDetails(string entityName, Action detailsLoaded, bool async = true, bool update = true)
{
if (detailsLoaded != null && !async)
Expand Down
24 changes: 19 additions & 5 deletions FetchXmlBuilder/Forms/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions FetchXmlBuilder/Forms/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Cinteros.Xrm.FetchXmlBuilder.Forms
public partial class Settings : Form
{
private FetchXmlBuilder fxb;
bool validateinfo;

public Settings(FetchXmlBuilder fxb)
{
Expand All @@ -33,6 +34,7 @@ private void PopulateSettings(FXBSettings settings)
chkShowNodeTypes.Checked = settings.ShowNodeType;
chkShowButtonTexts.Checked = settings.ShowButtonTexts;
chkShowValidation.Checked = settings.ShowValidation;
chkShowValidationInfo.Checked = settings.ShowValidationInfo;
chkShowRepository.Checked = settings.ShowRepository;
switch (settings.Results.ResultOutput)
{
Expand Down Expand Up @@ -66,6 +68,7 @@ internal FXBSettings GetSettings()
settings.ShowNodeType = chkShowNodeTypes.Checked;
settings.ShowButtonTexts = chkShowButtonTexts.Checked;
settings.ShowValidation = chkShowValidation.Checked;
settings.ShowValidationInfo = settings.ShowValidation && chkShowValidationInfo.Checked;
settings.ShowRepository = chkShowRepository.Checked;
settings.XmlColors = propXmlColors.SelectedObject as XmlColors;
return settings;
Expand Down Expand Up @@ -136,5 +139,19 @@ private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
Close();
fxb.ShowSelectSettings();
}

private void chkShowValidation_CheckedChanged(object sender, EventArgs e)
{
if (chkShowValidation.Checked)
{
chkShowValidationInfo.Checked = validateinfo;
}
else
{
validateinfo = chkShowValidationInfo.Checked;
chkShowValidationInfo.Checked = false;
}
chkShowValidationInfo.Enabled = chkShowValidation.Checked;
}
}
}

0 comments on commit f417108

Please sign in to comment.