Skip to content

Commit

Permalink
Merge pull request #262 from MarkMpn/live-changes
Browse files Browse the repository at this point in the history
Apply updates live
  • Loading branch information
rappen committed Dec 1, 2019
2 parents c42637b + 020c938 commit c0fb02d
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 49 deletions.
13 changes: 8 additions & 5 deletions FetchXmlBuilder/Controls/attributeControl.cs
Expand Up @@ -43,7 +43,7 @@ public attributeControl(TreeNode Node, AttributeMetadata[] attributes, TreeBuild
}
node = Node;
PopulateControls(Node, attributes);
ControlUtils.FillControls(collec, this.Controls);
ControlUtils.FillControls(collec, this.Controls, this);
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
Saved += tree.CtrlSaved;
}
Expand All @@ -68,7 +68,7 @@ private void PopulateControls(TreeNode node, AttributeMetadata[] attributes)
}
}

public void Save()
public void Save(bool silent)
{
try
{
Expand All @@ -81,8 +81,11 @@ public void Save()
}
catch (ArgumentNullException ex)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
Focus();
if (!silent)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
Focus();
}
}
}

Expand Down Expand Up @@ -119,7 +122,7 @@ private void Control_Leave(object sender, EventArgs e)
{
if (controlsCheckSum != ControlUtils.ControlsChecksum(this.Controls))
{
Save();
Save(false);
}
}

Expand Down
9 changes: 5 additions & 4 deletions FetchXmlBuilder/Controls/commentControl.cs
Expand Up @@ -35,12 +35,12 @@ public commentControl(Dictionary<string, string> collection, TreeBuilderControl
if (collection != null)
collec = collection;

ControlUtils.FillControls(collec, this.Controls);
ControlUtils.FillControls(collec, this.Controls, this);
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
Saved += tree.CtrlSaved;
}

public void Save()
public void Save(bool silent)
{
try
{
Expand All @@ -49,7 +49,8 @@ public void Save()
}
catch (ArgumentNullException ex)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
if (!silent)
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
}
Expand All @@ -73,7 +74,7 @@ private void Control_Leave(object sender, EventArgs e)
{
if (controlsCheckSum != ControlUtils.ControlsChecksum(this.Controls))
{
Save();
Save(false);
}
}
}
Expand Down
17 changes: 9 additions & 8 deletions FetchXmlBuilder/Controls/conditionControl.cs
Expand Up @@ -48,7 +48,7 @@ public conditionControl(TreeNode Node, FetchXmlBuilder fetchXmlBuilder, TreeBuil
}
PopulateControls();
RefreshAttributes();
ControlUtils.FillControls(collec, this.Controls);
ControlUtils.FillControls(collec, this.Controls, this);
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
Saved += tree.CtrlSaved;
}
Expand Down Expand Up @@ -84,13 +84,13 @@ private List<EntityNode> GetEntities(TreeNode node)
return result;
}

public void Save()
public void Save(bool silent)
{
try
{
if (ValidateForm())
{
if (cmbOperator.SelectedItem != null && cmbOperator.SelectedItem is OperatorItem)
if (!silent && cmbOperator.SelectedItem != null && cmbOperator.SelectedItem is OperatorItem)
{
var oper = (OperatorItem)cmbOperator.SelectedItem;
if (oper.IsMultipleValuesType && !string.IsNullOrWhiteSpace(cmbValue.Text))
Expand All @@ -115,7 +115,8 @@ public void Save()
}
catch (ArgumentNullException ex)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
if (!silent)
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}

Expand Down Expand Up @@ -269,7 +270,7 @@ private void Control_Leave(object sender, EventArgs e)
{
if (controlsCheckSum != ControlUtils.ControlsChecksum(this.Controls))
{
Save();
Save(false);
}
}

Expand Down Expand Up @@ -305,8 +306,8 @@ private void RefreshAttributes()
AttributeItem.AddAttributeToComboBox(cmbAttribute, attribute, true, FetchXmlBuilder.friendlyNames);
}
// RefreshFill now that attributes are loaded
ControlUtils.FillControl(collec, cmbAttribute);
ControlUtils.FillControl(collec, cmbValue);
ControlUtils.FillControl(collec, cmbAttribute, this);
ControlUtils.FillControl(collec, cmbValue, this);
}

private static TreeNode GetClosestEntityNode(TreeNode node)
Expand Down Expand Up @@ -398,7 +399,7 @@ private void cmbAttribute_SelectedIndexChanged(object sender, EventArgs e)
cmbOperator.SelectedItem = null;
cmbOperator.Items.Clear();
cmbOperator.Items.AddRange(OperatorItem.GetConditionsByAttributeType(attributeType.Value));
ControlUtils.FillControl(tmpColl, cmbOperator);
ControlUtils.FillControl(tmpColl, cmbOperator, this);
}
}
UpdateValueField();
Expand Down
9 changes: 5 additions & 4 deletions FetchXmlBuilder/Controls/entityControl.cs
Expand Up @@ -39,7 +39,7 @@ public entityControl(Dictionary<string, string> collection, FetchXmlBuilder fetc
collec = collection;

PopulateControls();
ControlUtils.FillControls(collec, this.Controls);
ControlUtils.FillControls(collec, this.Controls, this);
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
Saved += tree.CtrlSaved;
}
Expand All @@ -57,7 +57,7 @@ private void PopulateControls()
}
}

public void Save()
public void Save(bool silent)
{
try
{
Expand All @@ -66,7 +66,8 @@ public void Save()
}
catch (ArgumentNullException ex)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
if (!silent)
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
}
Expand All @@ -90,7 +91,7 @@ private void Control_Leave(object sender, EventArgs e)
{
if (controlsCheckSum != ControlUtils.ControlsChecksum(this.Controls))
{
Save();
Save(false);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions FetchXmlBuilder/Controls/fetchControl.cs
Expand Up @@ -35,12 +35,12 @@ public fetchControl(Dictionary<string, string> collection, TreeBuilderControl tr
if (collection != null)
collec = collection;

ControlUtils.FillControls(collec, this.Controls);
ControlUtils.FillControls(collec, this.Controls, this);
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
Saved += tree.CtrlSaved;
}

public void Save()
public void Save(bool silent)
{
try
{
Expand All @@ -49,7 +49,8 @@ public void Save()
}
catch (ArgumentNullException ex)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
if (!silent)
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
}
Expand All @@ -73,7 +74,7 @@ private void Control_Leave(object sender, EventArgs e)
{
if (controlsCheckSum != ControlUtils.ControlsChecksum(this.Controls))
{
Save();
Save(false);
}
}

Expand Down
9 changes: 5 additions & 4 deletions FetchXmlBuilder/Controls/filterControl.cs
Expand Up @@ -35,12 +35,12 @@ public filterControl(Dictionary<string, string> collection, TreeBuilderControl t
if (collection != null)
collec = collection;

ControlUtils.FillControls(collec, this.Controls);
ControlUtils.FillControls(collec, this.Controls, this);
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
Saved += tree.CtrlSaved;
}

public void Save()
public void Save(bool silent)
{
try
{
Expand All @@ -49,7 +49,8 @@ public void Save()
}
catch (ArgumentNullException ex)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
if (!silent)
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
}
Expand All @@ -73,7 +74,7 @@ private void Control_Leave(object sender, EventArgs e)
{
if (controlsCheckSum != ControlUtils.ControlsChecksum(this.Controls))
{
Save();
Save(false);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions FetchXmlBuilder/Controls/linkEntityControl.cs
Expand Up @@ -45,7 +45,7 @@ public linkEntityControl(TreeNode Node, FetchXmlBuilder fetchXmlBuilder, TreeBui
collec = new Dictionary<string, string>();
}
PopulateControls();
ControlUtils.FillControls(collec, this.Controls);
ControlUtils.FillControls(collec, this.Controls, this);
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
Saved += tree.CtrlSaved;
}
Expand Down Expand Up @@ -77,7 +77,7 @@ private void PopulateControls()
RefreshAttributes();
}

public void Save()
public void Save(bool silent)
{
try
{
Expand All @@ -86,7 +86,8 @@ public void Save()
}
catch (ArgumentNullException ex)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
if (!silent)
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
}
Expand All @@ -107,7 +108,7 @@ private void Control_Leave(object sender, EventArgs e)
{
if (controlsCheckSum != ControlUtils.ControlsChecksum(this.Controls))
{
Save();
Save(false);
}
}

Expand Down
9 changes: 5 additions & 4 deletions FetchXmlBuilder/Controls/orderControl.cs
Expand Up @@ -45,7 +45,7 @@ public orderControl(TreeNode Node, AttributeMetadata[] attributes, TreeBuilderCo
}

PopulateControls(Node, attributes);
ControlUtils.FillControls(collec, this.Controls);
ControlUtils.FillControls(collec, this.Controls, this);
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
Saved += tree.CtrlSaved;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ private List<string> GetAliases(TreeNode node)
return result;
}

public void Save()
public void Save(bool silent)
{
try
{
Expand All @@ -107,7 +107,8 @@ public void Save()
}
catch (ArgumentNullException ex)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
if (!silent)
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
}
Expand All @@ -131,7 +132,7 @@ private void Control_Leave(object sender, EventArgs e)
{
if (controlsCheckSum != ControlUtils.ControlsChecksum(this.Controls))
{
Save();
Save(false);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions FetchXmlBuilder/Controls/valueControl.cs
Expand Up @@ -35,12 +35,12 @@ public valueControl(Dictionary<string, string> collection, TreeBuilderControl tr
if (collection != null)
collec = collection;

ControlUtils.FillControls(collec, this.Controls);
ControlUtils.FillControls(collec, this.Controls, this);
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
Saved += tree.CtrlSaved;
}

public void Save()
public void Save(bool silent)
{
try
{
Expand All @@ -49,7 +49,8 @@ public void Save()
}
catch (ArgumentNullException ex)
{
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
if (!silent)
MessageBox.Show(ex.Message, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
controlsCheckSum = ControlUtils.ControlsChecksum(this.Controls);
}
Expand All @@ -73,7 +74,7 @@ private void Control_Leave(object sender, EventArgs e)
{
if (controlsCheckSum != ControlUtils.ControlsChecksum(this.Controls))
{
Save();
Save(false);
}
}
}
Expand Down

0 comments on commit c0fb02d

Please sign in to comment.