Persist skips for Desktop source/target

This commit is contained in:
Christian Wade 2019-12-08 19:42:41 -08:00
parent 305b71f1be
commit b7c4550a8b
3 changed files with 44 additions and 6 deletions

View File

@ -208,6 +208,8 @@ namespace AlmToolkit
{ {
string sourceTemp = txtSource.Text; string sourceTemp = txtSource.Text;
string targetTemp = txtTarget.Text; string targetTemp = txtTarget.Text;
string sourceDesktopNameTemp = _comparisonInfo.ConnectionInfoSource.DesktopName;
string targetDesktopNameTemp = _comparisonInfo.ConnectionInfoTarget.DesktopName;
if (!ShowConnectionsForm()) return; if (!ShowConnectionsForm()) return;
@ -216,7 +218,12 @@ namespace AlmToolkit
toolStripStatusLabel1.Text = "ALM Toolkit - comparing datasets ..."; toolStripStatusLabel1.Text = "ALM Toolkit - comparing datasets ...";
PopulateSourceTargetTextBoxes(); PopulateSourceTargetTextBoxes();
if (sourceTemp != txtSource.Text || targetTemp != txtTarget.Text) if (
(_comparisonInfo.ConnectionInfoSource.UseDesktop && sourceDesktopNameTemp != _comparisonInfo.ConnectionInfoSource.DesktopName) ||
(!_comparisonInfo.ConnectionInfoSource.UseDesktop && sourceTemp != txtSource.Text) ||
(_comparisonInfo.ConnectionInfoTarget.UseDesktop && targetDesktopNameTemp != _comparisonInfo.ConnectionInfoTarget.DesktopName) ||
(!_comparisonInfo.ConnectionInfoTarget.UseDesktop && targetTemp != txtTarget.Text)
)
{ {
// New connections // New connections
//ComparisonCtrl.TriggerComparisonChanged(); //ComparisonCtrl.TriggerComparisonChanged();
@ -806,12 +813,20 @@ namespace AlmToolkit
_comparisonInfo.ConnectionInfoSource.ServerName = null; _comparisonInfo.ConnectionInfoSource.ServerName = null;
_comparisonInfo.ConnectionInfoSource.DatabaseName = null; _comparisonInfo.ConnectionInfoSource.DatabaseName = null;
} }
else
{
_comparisonInfo.ConnectionInfoSource.DesktopName = null;
}
if (_comparisonInfo.ConnectionInfoTarget.UseDesktop) if (_comparisonInfo.ConnectionInfoTarget.UseDesktop)
{ {
_comparisonInfo.ConnectionInfoTarget.ServerName = null; _comparisonInfo.ConnectionInfoTarget.ServerName = null;
_comparisonInfo.ConnectionInfoTarget.DatabaseName = null; _comparisonInfo.ConnectionInfoTarget.DatabaseName = null;
} }
else
{
_comparisonInfo.ConnectionInfoTarget.DesktopName = null;
}
} }
private void mnuOpen_Click(object sender, EventArgs e) private void mnuOpen_Click(object sender, EventArgs e)

View File

@ -75,7 +75,6 @@ namespace BismNormalizer.TabularCompare
/// <summary> /// <summary>
/// A Boolean specifying whether the connection represents a Power BI Desktop or SSDT workspace AS instance. /// A Boolean specifying whether the connection represents a Power BI Desktop or SSDT workspace AS instance.
/// </summary> /// </summary>
[XmlIgnore()]
public bool UseDesktop public bool UseDesktop
{ {
get { return _useDesktop; } get { return _useDesktop; }
@ -114,7 +113,6 @@ namespace BismNormalizer.TabularCompare
/// <summary> /// <summary>
/// Name of the PBIX or SSDT project to which workspace AS instance connected. /// Name of the PBIX or SSDT project to which workspace AS instance connected.
/// </summary> /// </summary>
[XmlIgnore()]
public string DesktopName public string DesktopName
{ {
get { return _desktopName; } get { return _desktopName; }

View File

@ -36,7 +36,6 @@ namespace BismNormalizer.TabularCompare.UI
//this.Width = Convert.ToInt32(this.Width * 1.3); //this.Width = Convert.ToInt32(this.Width * 1.3);
this.Height = Convert.ToInt32(grpSource.Height * 2.6); this.Height = Convert.ToInt32(grpSource.Height * 2.6);
if (_dpiScaleFactor > 1) if (_dpiScaleFactor > 1)
@ -157,11 +156,24 @@ namespace BismNormalizer.TabularCompare.UI
if (((PowerBIInstance)((BindingSource)cboSourceDesktop.DataSource)[i]).Port == portFromConnectionInfo) if (((PowerBIInstance)((BindingSource)cboSourceDesktop.DataSource)[i]).Port == portFromConnectionInfo)
{ {
cboSourceDesktop.SelectedIndex = i; cboSourceDesktop.SelectedIndex = i;
boundSuccessfully = true;
break;
}
}
}
//For case when open .almt file and want to connect to new server/port for same dataset
if (_comparisonInfo.ConnectionInfoSource.ServerName == null && _comparisonInfo.ConnectionInfoSource.DesktopName != null)
{
for (int i = 0; i < ((BindingSource)cboSourceDesktop.DataSource).Count; i++)
{
if (((PowerBIInstance)((BindingSource)cboSourceDesktop.DataSource)[i]).Name == _comparisonInfo.ConnectionInfoSource.DesktopName)
{
cboSourceDesktop.SelectedIndex = i;
boundSuccessfully = true;
break; break;
} }
} }
} }
boundSuccessfully = true;
} }
} }
else if (!String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoSource.ServerName) && !String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoSource.DatabaseName)) else if (!String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoSource.ServerName) && !String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoSource.DatabaseName))
@ -218,11 +230,24 @@ namespace BismNormalizer.TabularCompare.UI
if (((PowerBIInstance)((BindingSource)cboTargetDesktop.DataSource)[i]).Port == portFromConnectionInfo) if (((PowerBIInstance)((BindingSource)cboTargetDesktop.DataSource)[i]).Port == portFromConnectionInfo)
{ {
cboTargetDesktop.SelectedIndex = i; cboTargetDesktop.SelectedIndex = i;
boundSuccessfully = true;
break;
}
}
}
//For case when open .almt file and want to connect to new server/port for same dataset
if (_comparisonInfo.ConnectionInfoTarget.ServerName == null && _comparisonInfo.ConnectionInfoTarget.DesktopName != null)
{
for (int i = 0; i < ((BindingSource)cboTargetDesktop.DataSource).Count; i++)
{
if (((PowerBIInstance)((BindingSource)cboTargetDesktop.DataSource)[i]).Name == _comparisonInfo.ConnectionInfoTarget.DesktopName)
{
cboTargetDesktop.SelectedIndex = i;
boundSuccessfully = true;
break; break;
} }
} }
} }
boundSuccessfully = true;
} }
} }
else if (!String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoTarget.ServerName) && !String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoTarget.DatabaseName)) else if (!String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoTarget.ServerName) && !String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoTarget.DatabaseName))