diff --git a/BismNormalizer/AlmToolkit/ComparisonForm.cs b/BismNormalizer/AlmToolkit/ComparisonForm.cs index 0e0e17b..c8023a4 100644 --- a/BismNormalizer/AlmToolkit/ComparisonForm.cs +++ b/BismNormalizer/AlmToolkit/ComparisonForm.cs @@ -208,6 +208,8 @@ namespace AlmToolkit { string sourceTemp = txtSource.Text; string targetTemp = txtTarget.Text; + string sourceDesktopNameTemp = _comparisonInfo.ConnectionInfoSource.DesktopName; + string targetDesktopNameTemp = _comparisonInfo.ConnectionInfoTarget.DesktopName; if (!ShowConnectionsForm()) return; @@ -216,7 +218,12 @@ namespace AlmToolkit toolStripStatusLabel1.Text = "ALM Toolkit - comparing datasets ..."; 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 //ComparisonCtrl.TriggerComparisonChanged(); @@ -806,12 +813,20 @@ namespace AlmToolkit _comparisonInfo.ConnectionInfoSource.ServerName = null; _comparisonInfo.ConnectionInfoSource.DatabaseName = null; } + else + { + _comparisonInfo.ConnectionInfoSource.DesktopName = null; + } if (_comparisonInfo.ConnectionInfoTarget.UseDesktop) { _comparisonInfo.ConnectionInfoTarget.ServerName = null; _comparisonInfo.ConnectionInfoTarget.DatabaseName = null; } + else + { + _comparisonInfo.ConnectionInfoTarget.DesktopName = null; + } } private void mnuOpen_Click(object sender, EventArgs e) diff --git a/BismNormalizer/BismNormalizer/TabularCompare/ConnectionInfo.cs b/BismNormalizer/BismNormalizer/TabularCompare/ConnectionInfo.cs index 12767f0..2d13c4f 100644 --- a/BismNormalizer/BismNormalizer/TabularCompare/ConnectionInfo.cs +++ b/BismNormalizer/BismNormalizer/TabularCompare/ConnectionInfo.cs @@ -75,7 +75,6 @@ namespace BismNormalizer.TabularCompare /// /// A Boolean specifying whether the connection represents a Power BI Desktop or SSDT workspace AS instance. /// - [XmlIgnore()] public bool UseDesktop { get { return _useDesktop; } @@ -114,7 +113,6 @@ namespace BismNormalizer.TabularCompare /// /// Name of the PBIX or SSDT project to which workspace AS instance connected. /// - [XmlIgnore()] public string DesktopName { get { return _desktopName; } diff --git a/BismNormalizer/BismNormalizer/TabularCompare/UI/ConnectionsAlmt.cs b/BismNormalizer/BismNormalizer/TabularCompare/UI/ConnectionsAlmt.cs index 01400c4..b351b60 100644 --- a/BismNormalizer/BismNormalizer/TabularCompare/UI/ConnectionsAlmt.cs +++ b/BismNormalizer/BismNormalizer/TabularCompare/UI/ConnectionsAlmt.cs @@ -36,7 +36,6 @@ namespace BismNormalizer.TabularCompare.UI //this.Width = Convert.ToInt32(this.Width * 1.3); - this.Height = Convert.ToInt32(grpSource.Height * 2.6); if (_dpiScaleFactor > 1) @@ -157,11 +156,24 @@ namespace BismNormalizer.TabularCompare.UI if (((PowerBIInstance)((BindingSource)cboSourceDesktop.DataSource)[i]).Port == portFromConnectionInfo) { 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; } } } - boundSuccessfully = true; } } 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) { 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; } } } - boundSuccessfully = true; } } else if (!String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoTarget.ServerName) && !String.IsNullOrEmpty(_comparisonInfo.ConnectionInfoTarget.DatabaseName))