Offline files

This commit is contained in:
Christian Wade 2019-09-19 19:37:44 -07:00
parent a305b8ff1e
commit 5e0dbd90e7
12 changed files with 486 additions and 126 deletions

View File

@ -339,7 +339,7 @@ namespace AlmToolkit
private void SetAutoComplete() private void SetAutoComplete()
{ {
if (!_comparisonInfo.ConnectionInfoSource.UseProject) if (!_comparisonInfo.ConnectionInfoSource.UseProject && !_comparisonInfo.ConnectionInfoSource.UseBimFile)
{ {
if (Settings.Default.SourceServerAutoCompleteEntries.IndexOf(_comparisonInfo.ConnectionInfoSource.ServerName + "|") > -1) if (Settings.Default.SourceServerAutoCompleteEntries.IndexOf(_comparisonInfo.ConnectionInfoSource.ServerName + "|") > -1)
{ {
@ -355,7 +355,7 @@ namespace AlmToolkit
GetFromAutoCompleteSource(); GetFromAutoCompleteSource();
} }
if (!_comparisonInfo.ConnectionInfoTarget.UseProject) if (!_comparisonInfo.ConnectionInfoTarget.UseProject && !_comparisonInfo.ConnectionInfoTarget.UseBimFile)
{ {
if (Settings.Default.TargetServerAutoCompleteEntries.IndexOf(_comparisonInfo.ConnectionInfoTarget.ServerName + "|") > -1) if (Settings.Default.TargetServerAutoCompleteEntries.IndexOf(_comparisonInfo.ConnectionInfoTarget.ServerName + "|") > -1)
{ {

View File

@ -322,5 +322,17 @@ namespace BismNormalizer {
this["OptionRetainStorageMode"] = value; this["OptionRetainStorageMode"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string LastBimFileLocation {
get {
return ((string)(this["LastBimFileLocation"]));
}
set {
this["LastBimFileLocation"] = value;
}
}
} }
} }

View File

@ -77,5 +77,8 @@
<Setting Name="OptionRetainStorageMode" Type="System.Boolean" Scope="User"> <Setting Name="OptionRetainStorageMode" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="LastBimFileLocation" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -65,14 +65,8 @@ namespace BismNormalizer.TabularCompare
{ {
Telemetry.TrackEvent("CreateComparisonInitialized", new Dictionary<string, string> { { "App", comparisonInfo.AppName.Replace(" ", "") } }); Telemetry.TrackEvent("CreateComparisonInitialized", new Dictionary<string, string> { { "App", comparisonInfo.AppName.Replace(" ", "") } });
////Currently can't source from PBIP to AS because AS doesn't work with inline data sources:
//if (comparisonInfo.ConnectionInfoSource.ServerName.StartsWith("powerbi://") && !comparisonInfo.ConnectionInfoTarget.ServerName.StartsWith("powerbi://"))
//{
// throw new ConnectionException($"Source model is a Power BI dataset and the target is Analysis Services, which is not supported in the current version.");
//}
//If composite models not allowed on AS, check DQ/Import at model level matches: //If composite models not allowed on AS, check DQ/Import at model level matches:
if (!comparisonInfo.ConnectionInfoSource.ServerName.StartsWith("powerbi://") && !Settings.Default.OptionCompositeModelsOverride && comparisonInfo.SourceDirectQuery != comparisonInfo.TargetDirectQuery) if (comparisonInfo.ConnectionInfoSource.ServerName != null && !comparisonInfo.ConnectionInfoSource.ServerName.StartsWith("powerbi://") && !Settings.Default.OptionCompositeModelsOverride && comparisonInfo.SourceDirectQuery != comparisonInfo.TargetDirectQuery)
{ {
throw new ConnectionException($"Mixed DirectQuery settings are not supported for AS skus.\nSource is {(comparisonInfo.SourceDirectQuery ? "On" : "Off")} and target is {(comparisonInfo.TargetDirectQuery ? "On" : "Off")}."); throw new ConnectionException($"Mixed DirectQuery settings are not supported for AS skus.\nSource is {(comparisonInfo.SourceDirectQuery ? "On" : "Off")} and target is {(comparisonInfo.TargetDirectQuery ? "On" : "Off")}.");
} }
@ -82,13 +76,13 @@ namespace BismNormalizer.TabularCompare
//If Power BI, check the default datasource version //If Power BI, check the default datasource version
//Source //Source
bool sourceDataSourceVersionRequiresUpgrade = false; bool sourceDataSourceVersionRequiresUpgrade = false;
if (comparisonInfo.ConnectionInfoSource.ServerName.StartsWith("powerbi://") && !_supportedDataSourceVersions.Contains(comparisonInfo.SourceDataSourceVersion)) if (comparisonInfo.ConnectionInfoSource.ServerName != null && comparisonInfo.ConnectionInfoSource.ServerName.StartsWith("powerbi://") && !_supportedDataSourceVersions.Contains(comparisonInfo.SourceDataSourceVersion))
{ {
sourceDataSourceVersionRequiresUpgrade = true; sourceDataSourceVersionRequiresUpgrade = true;
} }
//Target //Target
bool targetDataSourceVersionRequiresUpgrade = false; bool targetDataSourceVersionRequiresUpgrade = false;
if (comparisonInfo.ConnectionInfoTarget.ServerName.StartsWith("powerbi://") && !_supportedDataSourceVersions.Contains(comparisonInfo.TargetDataSourceVersion)) if (comparisonInfo.ConnectionInfoTarget.ServerName != null && comparisonInfo.ConnectionInfoTarget.ServerName.StartsWith("powerbi://") && !_supportedDataSourceVersions.Contains(comparisonInfo.TargetDataSourceVersion))
{ {
targetDataSourceVersionRequiresUpgrade = true; targetDataSourceVersionRequiresUpgrade = true;
} }

View File

@ -4,6 +4,7 @@ using System.Xml;
using System.Xml.Serialization; using System.Xml.Serialization;
using System.Security.Principal; using System.Security.Principal;
using Microsoft.AnalysisServices; using Microsoft.AnalysisServices;
using TOM = Microsoft.AnalysisServices.Tabular;
using EnvDTE; using EnvDTE;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -19,6 +20,8 @@ namespace BismNormalizer.TabularCompare
#region Private Variables #region Private Variables
private bool _useProject = false; private bool _useProject = false;
private bool _useBimFile = false;
private string _bimFile;
private string _serverName; private string _serverName;
private string _databaseName; private string _databaseName;
private string _projectName; private string _projectName;
@ -26,7 +29,7 @@ namespace BismNormalizer.TabularCompare
private int _compatibilityLevel; private int _compatibilityLevel;
private string _dataSourceVersion; private string _dataSourceVersion;
private bool _directQuery; private bool _directQuery;
private string _bimFileFullName; private string _ssdtBimFile;
private EnvDTE.Project _project; private EnvDTE.Project _project;
private string _deploymentServerName; private string _deploymentServerName;
private string _deploymentServerDatabase; private string _deploymentServerDatabase;
@ -53,7 +56,35 @@ namespace BismNormalizer.TabularCompare
public bool UseProject public bool UseProject
{ {
get { return _useProject; } get { return _useProject; }
set { _useProject = value; } set
{
if (value)
{
//To late to do an enum would break backwards compat
_useBimFile = false;
_bimFile = null;
}
_useProject = value;
}
}
/// <summary>
/// A Boolean specifying whether the connection represents a BIM file.
/// </summary>
public bool UseBimFile
{
get { return _useBimFile; }
set
{
if (value)
{
//To late to do an enum would break backwards compat
_useProject = false;
_serverName = null;
_databaseName = null;
}
_useBimFile = value;
}
} }
/// <summary> /// <summary>
@ -92,6 +123,25 @@ namespace BismNormalizer.TabularCompare
set { _projectFile = value; } set { _projectFile = value; }
} }
/// <summary>
/// Full path to the slected BIM file (offline).
/// </summary>
public string BimFile
{
get { return _bimFile; }
set { _bimFile = value; }
}
/// <summary>
/// Full path to the BIM file for the project.
/// </summary>
[XmlIgnore()]
public string SsdtBimFile
{
get { return _ssdtBimFile; }
set { _ssdtBimFile = value; }
}
/// <summary> /// <summary>
/// Compatibility level for the connection. /// Compatibility level for the connection.
/// </summary> /// </summary>
@ -120,12 +170,6 @@ namespace BismNormalizer.TabularCompare
set { _project = value; } set { _project = value; }
} }
/// <summary>
/// Full path to the BIM file for the project.
/// </summary>
[XmlIgnore()]
public string BimFileFullName => _bimFileFullName;
/// <summary> /// <summary>
/// The deployment server from the project file. /// The deployment server from the project file.
/// </summary> /// </summary>
@ -330,7 +374,7 @@ namespace BismNormalizer.TabularCompare
{ {
if (projectItem.Name.EndsWith(".bim") && projectItem.FileCount > 0) if (projectItem.Name.EndsWith(".bim") && projectItem.FileCount > 0)
{ {
_bimFileFullName = projectItem.FileNames[0]; _ssdtBimFile = projectItem.FileNames[0];
break; break;
} }
} }
@ -348,7 +392,7 @@ namespace BismNormalizer.TabularCompare
FileInfo[] files = _projectDirectoryInfo.GetFiles(compileNode.Attributes["Include"].Value, SearchOption.TopDirectoryOnly); FileInfo[] files = _projectDirectoryInfo.GetFiles(compileNode.Attributes["Include"].Value, SearchOption.TopDirectoryOnly);
if (files.Length > 0) if (files.Length > 0)
{ {
_bimFileFullName = files[0].FullName; _ssdtBimFile = files[0].FullName;
break; break;
} }
} }
@ -363,6 +407,30 @@ namespace BismNormalizer.TabularCompare
/// <param name="closedBimFile">A Boolean specifying if the user cancelled the comparison. For the case where running in Visual Studio, the user has the option of cancelling if the project BIM file is open.</param> /// <param name="closedBimFile">A Boolean specifying if the user cancelled the comparison. For the case where running in Visual Studio, the user has the option of cancelling if the project BIM file is open.</param>
public void InitializeCompatibilityLevel(bool closedBimFile = false) public void InitializeCompatibilityLevel(bool closedBimFile = false)
{ {
if (UseBimFile)
{
TOM.Database tomDatabase = null;
bool exceptionLoadingFile = false;
try
{
tomDatabase = TOM.JsonSerializer.DeserializeDatabase(File.ReadAllText(_bimFile));
}
catch
{
exceptionLoadingFile = true;
}
if (exceptionLoadingFile || tomDatabase == null)
{
throw new ConnectionException($"Can't load file \"{_bimFile}\".");
}
_compatibilityLevel = tomDatabase.CompatibilityLevel;
_dataSourceVersion = tomDatabase.Model.DefaultPowerBIDataSourceVersion.ToString();
_directQuery = (tomDatabase.Model != null && tomDatabase.Model.DefaultMode == Microsoft.AnalysisServices.Tabular.ModeType.DirectQuery);
return;
}
if (UseProject) if (UseProject)
{ {
//Initialize _projectDirectoryInfo //Initialize _projectDirectoryInfo
@ -440,8 +508,8 @@ namespace BismNormalizer.TabularCompare
throw new ConnectionException($"Analysis Server {this.ServerName} is not running in Tabular mode"); throw new ConnectionException($"Analysis Server {this.ServerName} is not running in Tabular mode");
} }
Database tabularDatabase = amoServer.Databases.FindByName(this.DatabaseName); Database amoDatabase = amoServer.Databases.FindByName(this.DatabaseName);
if (tabularDatabase == null) if (amoDatabase == null)
{ {
if (!this.UseProject) if (!this.UseProject)
{ {
@ -489,7 +557,7 @@ namespace BismNormalizer.TabularCompare
//attach //attach
amoServer.Attach(dbDir); amoServer.Attach(dbDir);
amoServer.Refresh(); amoServer.Refresh();
tabularDatabase = amoServer.Databases.FindByName(this.DatabaseName); amoDatabase = amoServer.Databases.FindByName(this.DatabaseName);
} }
} }
} }
@ -497,7 +565,7 @@ namespace BismNormalizer.TabularCompare
if (this.UseProject) if (this.UseProject)
{ {
//_bimFileFullName = GetBimFileFullName(); //_bimFileFullName = GetBimFileFullName();
if (String.IsNullOrEmpty(_bimFileFullName)) if (String.IsNullOrEmpty(_ssdtBimFile))
{ {
throw new ConnectionException("Could not load BIM file for Project " + this.ProjectName); throw new ConnectionException("Could not load BIM file for Project " + this.ProjectName);
} }
@ -510,11 +578,11 @@ namespace BismNormalizer.TabularCompare
try try
{ {
//Replace "SemanticModel" with db name. //Replace "SemanticModel" with db name.
JObject jDocument = JObject.Parse(File.ReadAllText(_bimFileFullName)); JObject jDocument = JObject.Parse(File.ReadAllText(_ssdtBimFile));
if (jDocument["name"] == null || jDocument["id"] == null) if (jDocument["name"] == null || jDocument["id"] == null)
{ {
throw new ConnectionException("Could not read JSON in BIM file " + _bimFileFullName); throw new ConnectionException("Could not read JSON in BIM file " + _ssdtBimFile);
} }
jDocument["name"] = DatabaseName; jDocument["name"] = DatabaseName;
@ -539,7 +607,7 @@ $@"{{
//Replace "SemanticModel" with db name. Could do a global replace, but just in case it's not called SemanticModel, use dom instead //Replace "SemanticModel" with db name. Could do a global replace, but just in case it's not called SemanticModel, use dom instead
//string xmlaScript = File.ReadAllText(xmlaFileFullName); //string xmlaScript = File.ReadAllText(xmlaFileFullName);
XmlDocument document = new XmlDocument(); XmlDocument document = new XmlDocument();
document.Load(_bimFileFullName); document.Load(_ssdtBimFile);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(document.NameTable); XmlNamespaceManager nsmgr = new XmlNamespaceManager(document.NameTable);
nsmgr.AddNamespace("myns1", "http://schemas.microsoft.com/analysisservices/2003/engine"); nsmgr.AddNamespace("myns1", "http://schemas.microsoft.com/analysisservices/2003/engine");
@ -549,7 +617,7 @@ $@"{{
if (objectDatabaseIdNode == null || objectDefinitionDatabaseIdNode == null || objectDefinitionDatabaseNameNode == null) if (objectDatabaseIdNode == null || objectDefinitionDatabaseIdNode == null || objectDefinitionDatabaseNameNode == null)
{ {
throw new ConnectionException("Could not access XMLA in BIM file " + _bimFileFullName); throw new ConnectionException("Could not access XMLA in BIM file " + _ssdtBimFile);
} }
objectDatabaseIdNode.InnerText = DatabaseName; objectDatabaseIdNode.InnerText = DatabaseName;
@ -566,17 +634,18 @@ $@"{{
amoServer.Disconnect(); amoServer.Disconnect();
amoServer.Connect(BuildConnectionString()); amoServer.Connect(BuildConnectionString());
tabularDatabase = amoServer.Databases.FindByName(this.DatabaseName); amoDatabase = amoServer.Databases.FindByName(this.DatabaseName);
} }
if (tabularDatabase == null) if (amoDatabase == null)
{ {
throw new ConnectionException($"Can not load/find database {this.DatabaseName}."); throw new ConnectionException($"Can not load/find database {this.DatabaseName}.");
} }
_compatibilityLevel = tabularDatabase.CompatibilityLevel;
_dataSourceVersion = tabularDatabase.Model.DefaultPowerBIDataSourceVersion.ToString(); _compatibilityLevel = amoDatabase.CompatibilityLevel;
_directQuery = ((tabularDatabase.Model != null && tabularDatabase.Model.DefaultMode == Microsoft.AnalysisServices.Tabular.ModeType.DirectQuery) || _dataSourceVersion = amoDatabase.Model.DefaultPowerBIDataSourceVersion.ToString();
tabularDatabase.DirectQueryMode == DirectQueryMode.DirectQuery || tabularDatabase.DirectQueryMode == DirectQueryMode.InMemoryWithDirectQuery || tabularDatabase.DirectQueryMode == DirectQueryMode.DirectQueryWithInMemory); _directQuery = ((amoDatabase.Model != null && amoDatabase.Model.DefaultMode == Microsoft.AnalysisServices.Tabular.ModeType.DirectQuery) ||
amoDatabase.DirectQueryMode == DirectQueryMode.DirectQuery || amoDatabase.DirectQueryMode == DirectQueryMode.InMemoryWithDirectQuery || amoDatabase.DirectQueryMode == DirectQueryMode.DirectQueryWithInMemory);
} }
/// <summary> /// <summary>

View File

@ -2515,9 +2515,9 @@ namespace BismNormalizer.TabularCompare.MultidimensionalMetadata
EnvDTE._DTE dte = _connectionInfo.Project.DTE; EnvDTE._DTE dte = _connectionInfo.Project.DTE;
//check out bim file if necessary //check out bim file if necessary
if (dte.SourceControl.IsItemUnderSCC(_connectionInfo.BimFileFullName) && !dte.SourceControl.IsItemCheckedOut(_connectionInfo.BimFileFullName)) if (dte.SourceControl.IsItemUnderSCC(_connectionInfo.SsdtBimFile) && !dte.SourceControl.IsItemCheckedOut(_connectionInfo.SsdtBimFile))
{ {
dte.SourceControl.CheckOutItem(_connectionInfo.BimFileFullName); dte.SourceControl.CheckOutItem(_connectionInfo.SsdtBimFile);
} }
} }
@ -2533,7 +2533,7 @@ namespace BismNormalizer.TabularCompare.MultidimensionalMetadata
objectDefinitionDatabaseNameNode.InnerText = "SemanticModel"; objectDefinitionDatabaseNameNode.InnerText = "SemanticModel";
xml = WriteXmlFromDoc(bimFileDoc); xml = WriteXmlFromDoc(bimFileDoc);
File.WriteAllText(_connectionInfo.BimFileFullName, xml); File.WriteAllText(_connectionInfo.SsdtBimFile, xml);
} }
#region Database deployment and processing methods #region Database deployment and processing methods

View File

@ -646,11 +646,17 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
if (reconnect || _uncommitedChanges) if (reconnect || _uncommitedChanges)
{ {
// Reconnect to re-initialize // Reconnect to re-initialize
if (!_comparisonInfo.ConnectionInfoSource.UseBimFile)
{
_sourceTabularModel = new TabularModel(this, _comparisonInfo.ConnectionInfoSource, _comparisonInfo); _sourceTabularModel = new TabularModel(this, _comparisonInfo.ConnectionInfoSource, _comparisonInfo);
_sourceTabularModel.Connect(); _sourceTabularModel.Connect();
}
if (!_comparisonInfo.ConnectionInfoTarget.UseBimFile)
{
_targetTabularModel = new TabularModel(this, _comparisonInfo.ConnectionInfoTarget, _comparisonInfo); _targetTabularModel = new TabularModel(this, _comparisonInfo.ConnectionInfoTarget, _comparisonInfo);
_targetTabularModel.Connect(); _targetTabularModel.Connect();
} }
}
if (!_sourceTabularModel.ConnectionInfo.UseProject && _sourceTabularModel.TomDatabase.LastSchemaUpdate > _lastSourceSchemaUpdate) if (!_sourceTabularModel.ConnectionInfo.UseProject && _sourceTabularModel.TomDatabase.LastSchemaUpdate > _lastSourceSchemaUpdate)
{ {

View File

@ -57,6 +57,12 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
{ {
this.Disconnect(); this.Disconnect();
if (_connectionInfo.UseBimFile)
{
_database = JsonSerializer.DeserializeDatabase(File.ReadAllText(_connectionInfo.BimFile));
}
else
{
_server = new Server(); _server = new Server();
_server.Connect(_connectionInfo.BuildConnectionString()); _server.Connect(_connectionInfo.BuildConnectionString());
@ -67,6 +73,7 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
throw new Amo.ConnectionException($"Could not connect to database {_connectionInfo.DatabaseName}"); throw new Amo.ConnectionException($"Could not connect to database {_connectionInfo.DatabaseName}");
} }
InitializeCalcDependencies(); InitializeCalcDependencies();
}
//Shell model //Shell model
_model = new Model(this, _database.Model); _model = new Model(this, _database.Model);
@ -88,7 +95,7 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
foreach (ModelRole role in _database.Model.Roles) foreach (ModelRole role in _database.Model.Roles)
{ {
//Workaround for AAD role members - todo delete if changed in Azure AS //Workaround for AAD role members - todo delete if changed in Azure AS
if (_parentComparison?.TargetTabularModel?.ConnectionInfo?.ServerName.Substring(0, 7) == "asazure") if (_parentComparison?.TargetTabularModel?.ConnectionInfo?.ServerName?.Substring(0, 7) == "asazure")
{ {
List<ExternalModelRoleMember> membersToAdd = new List<ExternalModelRoleMember>(); List<ExternalModelRoleMember> membersToAdd = new List<ExternalModelRoleMember>();
foreach (ModelRoleMember member in role.Members) foreach (ModelRoleMember member in role.Members)
@ -1697,7 +1704,11 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
/// <returns>Boolean indicating whether update was successful.</returns> /// <returns>Boolean indicating whether update was successful.</returns>
public bool Update() public bool Update()
{ {
FinalValidation(); if (_connectionInfo.UseBimFile)
{
SaveBimFile();
return true;
}
if (_connectionInfo.UseProject) if (_connectionInfo.UseProject)
{ {
@ -1733,12 +1744,17 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
EnvDTE._DTE dte = _connectionInfo.Project.DTE; EnvDTE._DTE dte = _connectionInfo.Project.DTE;
//check out bim file if necessary //check out bim file if necessary
if (dte.SourceControl.IsItemUnderSCC(_connectionInfo.BimFileFullName) && !dte.SourceControl.IsItemCheckedOut(_connectionInfo.BimFileFullName)) if (dte.SourceControl.IsItemUnderSCC(_connectionInfo.SsdtBimFile) && !dte.SourceControl.IsItemCheckedOut(_connectionInfo.SsdtBimFile))
{ {
dte.SourceControl.CheckOutItem(_connectionInfo.BimFileFullName); dte.SourceControl.CheckOutItem(_connectionInfo.SsdtBimFile);
} }
} }
SaveBimFile();
}
private void SaveBimFile()
{
//Script out db and write to project file //Script out db and write to project file
//serialize db to json //serialize db to json
@ -1755,7 +1771,14 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
jDb["id"] = "SemanticModel"; jDb["id"] = "SemanticModel";
json = jDb.ToString(); json = jDb.ToString();
File.WriteAllText(_connectionInfo.BimFileFullName, json); if (_connectionInfo.UseBimFile)
{
File.WriteAllText(_connectionInfo.BimFile, json);
}
else
{
File.WriteAllText(_connectionInfo.SsdtBimFile, json);
}
} }
#region Database deployment and processing methods #region Database deployment and processing methods
@ -2119,8 +2142,6 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
/// <returns>JSON script of tabular model defintion.</returns> /// <returns>JSON script of tabular model defintion.</returns>
public string ScriptDatabase() public string ScriptDatabase()
{ {
FinalValidation();
//script db to json //script db to json
string json = JsonScripter.ScriptCreateOrReplace(_database); string json = JsonScripter.ScriptCreateOrReplace(_database);
@ -2141,14 +2162,6 @@ namespace BismNormalizer.TabularCompare.TabularMetadata
return json; return json;
} }
private void FinalValidation()
{
//if (_connectionInfo.DirectQuery && _dataSources.Count > 1)
//{
// throw new InvalidOperationException("Target model contains multiple data sources, which are not allowed for Direct Query models. Re-run comparison and (considering changes) ensure there is a single connection in the target model.");
//}
}
public override string ToString() => this.GetType().FullName; public override string ToString() => this.GetType().FullName;
public void Dispose() public void Dispose()

View File

@ -261,7 +261,7 @@ namespace BismNormalizer.TabularCompare.UI
private void SetAutoComplete() private void SetAutoComplete()
{ {
if (!_comparisonInfo.ConnectionInfoSource.UseProject) if (!_comparisonInfo.ConnectionInfoSource.UseProject && !_comparisonInfo.ConnectionInfoSource.UseBimFile)
{ {
if (Settings.Default.SourceServerAutoCompleteEntries.IndexOf(_comparisonInfo.ConnectionInfoSource.ServerName + "|") > -1) if (Settings.Default.SourceServerAutoCompleteEntries.IndexOf(_comparisonInfo.ConnectionInfoSource.ServerName + "|") > -1)
{ {
@ -277,7 +277,7 @@ namespace BismNormalizer.TabularCompare.UI
GetFromAutoCompleteSource(); GetFromAutoCompleteSource();
} }
if (!_comparisonInfo.ConnectionInfoTarget.UseProject) if (!_comparisonInfo.ConnectionInfoTarget.UseProject && !_comparisonInfo.ConnectionInfoTarget.UseBimFile)
{ {
if (Settings.Default.TargetServerAutoCompleteEntries.IndexOf(_comparisonInfo.ConnectionInfoTarget.ServerName + "|") > -1) if (Settings.Default.TargetServerAutoCompleteEntries.IndexOf(_comparisonInfo.ConnectionInfoTarget.ServerName + "|") > -1)
{ {
@ -772,9 +772,31 @@ namespace BismNormalizer.TabularCompare.UI
private void PopulateSourceTargetTextBoxes() private void PopulateSourceTargetTextBoxes()
{ {
txtSource.Text = (_comparisonInfo.ConnectionInfoSource.UseProject ? "Project: " + _comparisonInfo.ConnectionInfoSource.ProjectName : "Database: " + _comparisonInfo.ConnectionInfoSource.ServerName + ";" + _comparisonInfo.ConnectionInfoSource.DatabaseName); if (_comparisonInfo.ConnectionInfoSource.UseProject)
txtTarget.Text = (_comparisonInfo.ConnectionInfoTarget.UseProject ? "Project: " + _comparisonInfo.ConnectionInfoTarget.ProjectName : "Database: " + _comparisonInfo.ConnectionInfoTarget.ServerName + ";" + _comparisonInfo.ConnectionInfoTarget.DatabaseName); {
txtSource.Text = "Project: " + _comparisonInfo.ConnectionInfoSource.ProjectName;
}
else if (_comparisonInfo.ConnectionInfoSource.UseBimFile)
{
txtSource.Text = "File: " + _comparisonInfo.ConnectionInfoSource.BimFile;
}
else
{
txtSource.Text = "Database: " + _comparisonInfo.ConnectionInfoSource.ServerName + ";" + _comparisonInfo.ConnectionInfoSource.DatabaseName;
}
if (_comparisonInfo.ConnectionInfoTarget.UseProject)
{
txtTarget.Text = "Project: " + _comparisonInfo.ConnectionInfoTarget.ProjectName;
}
else if (_comparisonInfo.ConnectionInfoTarget.UseBimFile)
{
txtTarget.Text = "File: " + _comparisonInfo.ConnectionInfoTarget.BimFile;
}
else
{
txtTarget.Text = "Database: " + _comparisonInfo.ConnectionInfoTarget.ServerName + ";" + _comparisonInfo.ConnectionInfoTarget.DatabaseName;
}
} }
#region UI click handlers #region UI click handlers

View File

@ -34,11 +34,19 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.pnlSourceDb = new System.Windows.Forms.Panel(); this.pnlSourceDb = new System.Windows.Forms.Panel();
this.grpSource = new System.Windows.Forms.GroupBox(); this.grpSource = new System.Windows.Forms.GroupBox();
this.pnlSourceFile = new System.Windows.Forms.Panel();
this.btnSourceFileOpen = new System.Windows.Forms.Button();
this.txtSourceFile = new System.Windows.Forms.TextBox();
this.rdoSourceFile = new System.Windows.Forms.RadioButton();
this.pnlSourceProject = new System.Windows.Forms.Panel(); this.pnlSourceProject = new System.Windows.Forms.Panel();
this.cboSourceProject = new System.Windows.Forms.ComboBox(); this.cboSourceProject = new System.Windows.Forms.ComboBox();
this.rdoSourceProject = new System.Windows.Forms.RadioButton(); this.rdoSourceProject = new System.Windows.Forms.RadioButton();
this.rdoSourceDb = new System.Windows.Forms.RadioButton(); this.rdoSourceDb = new System.Windows.Forms.RadioButton();
this.grpTarget = new System.Windows.Forms.GroupBox(); this.grpTarget = new System.Windows.Forms.GroupBox();
this.pnlTargetFile = new System.Windows.Forms.Panel();
this.btnTargetFileOpen = new System.Windows.Forms.Button();
this.txtTargetFile = new System.Windows.Forms.TextBox();
this.rdoTargetFile = new System.Windows.Forms.RadioButton();
this.pnlTargetProject = new System.Windows.Forms.Panel(); this.pnlTargetProject = new System.Windows.Forms.Panel();
this.cboTargetProject = new System.Windows.Forms.ComboBox(); this.cboTargetProject = new System.Windows.Forms.ComboBox();
this.rdoTargetProject = new System.Windows.Forms.RadioButton(); this.rdoTargetProject = new System.Windows.Forms.RadioButton();
@ -53,8 +61,10 @@
this.btnSwitch = new System.Windows.Forms.Button(); this.btnSwitch = new System.Windows.Forms.Button();
this.pnlSourceDb.SuspendLayout(); this.pnlSourceDb.SuspendLayout();
this.grpSource.SuspendLayout(); this.grpSource.SuspendLayout();
this.pnlSourceFile.SuspendLayout();
this.pnlSourceProject.SuspendLayout(); this.pnlSourceProject.SuspendLayout();
this.grpTarget.SuspendLayout(); this.grpTarget.SuspendLayout();
this.pnlTargetFile.SuspendLayout();
this.pnlTargetProject.SuspendLayout(); this.pnlTargetProject.SuspendLayout();
this.pnlTargetDb.SuspendLayout(); this.pnlTargetDb.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -65,10 +75,11 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.cboSourceDatabase.FormattingEnabled = true; this.cboSourceDatabase.FormattingEnabled = true;
this.cboSourceDatabase.Location = new System.Drawing.Point(11, 39); this.cboSourceDatabase.Location = new System.Drawing.Point(16, 60);
this.cboSourceDatabase.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.cboSourceDatabase.MaxDropDownItems = 11; this.cboSourceDatabase.MaxDropDownItems = 11;
this.cboSourceDatabase.Name = "cboSourceDatabase"; this.cboSourceDatabase.Name = "cboSourceDatabase";
this.cboSourceDatabase.Size = new System.Drawing.Size(213, 21); this.cboSourceDatabase.Size = new System.Drawing.Size(318, 28);
this.cboSourceDatabase.TabIndex = 12; this.cboSourceDatabase.TabIndex = 12;
this.cboSourceDatabase.Enter += new System.EventHandler(this.cboSourceDatabase_Enter); this.cboSourceDatabase.Enter += new System.EventHandler(this.cboSourceDatabase_Enter);
// //
@ -78,28 +89,31 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.cboSourceServer.FormattingEnabled = true; this.cboSourceServer.FormattingEnabled = true;
this.cboSourceServer.Location = new System.Drawing.Point(11, 7); this.cboSourceServer.Location = new System.Drawing.Point(16, 11);
this.cboSourceServer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.cboSourceServer.MaxDropDownItems = 11; this.cboSourceServer.MaxDropDownItems = 11;
this.cboSourceServer.Name = "cboSourceServer"; this.cboSourceServer.Name = "cboSourceServer";
this.cboSourceServer.Size = new System.Drawing.Size(213, 21); this.cboSourceServer.Size = new System.Drawing.Size(318, 28);
this.cboSourceServer.TabIndex = 9; this.cboSourceServer.TabIndex = 9;
this.cboSourceServer.TextChanged += new System.EventHandler(this.cboSourceServer_TextChanged); this.cboSourceServer.TextChanged += new System.EventHandler(this.cboSourceServer_TextChanged);
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 108); this.label2.Location = new System.Drawing.Point(12, 166);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 13); this.label2.Size = new System.Drawing.Size(79, 20);
this.label2.TabIndex = 11; this.label2.TabIndex = 11;
this.label2.Text = "Database"; this.label2.Text = "Database";
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 76); this.label1.Location = new System.Drawing.Point(9, 117);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(38, 13); this.label1.Size = new System.Drawing.Size(55, 20);
this.label1.TabIndex = 10; this.label1.TabIndex = 10;
this.label1.Text = "Server"; this.label1.Text = "Server";
// //
@ -110,37 +124,85 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pnlSourceDb.Controls.Add(this.cboSourceServer); this.pnlSourceDb.Controls.Add(this.cboSourceServer);
this.pnlSourceDb.Controls.Add(this.cboSourceDatabase); this.pnlSourceDb.Controls.Add(this.cboSourceDatabase);
this.pnlSourceDb.Location = new System.Drawing.Point(67, 66); this.pnlSourceDb.Location = new System.Drawing.Point(100, 102);
this.pnlSourceDb.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlSourceDb.Name = "pnlSourceDb"; this.pnlSourceDb.Name = "pnlSourceDb";
this.pnlSourceDb.Size = new System.Drawing.Size(233, 66); this.pnlSourceDb.Size = new System.Drawing.Size(350, 101);
this.pnlSourceDb.TabIndex = 1; this.pnlSourceDb.TabIndex = 1;
// //
// grpSource // grpSource
// //
this.grpSource.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.grpSource.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left))); | System.Windows.Forms.AnchorStyles.Left)));
this.grpSource.Controls.Add(this.pnlSourceFile);
this.grpSource.Controls.Add(this.rdoSourceFile);
this.grpSource.Controls.Add(this.pnlSourceProject); this.grpSource.Controls.Add(this.pnlSourceProject);
this.grpSource.Controls.Add(this.rdoSourceProject); this.grpSource.Controls.Add(this.rdoSourceProject);
this.grpSource.Controls.Add(this.rdoSourceDb); this.grpSource.Controls.Add(this.rdoSourceDb);
this.grpSource.Controls.Add(this.label1); this.grpSource.Controls.Add(this.label1);
this.grpSource.Controls.Add(this.label2); this.grpSource.Controls.Add(this.label2);
this.grpSource.Controls.Add(this.pnlSourceDb); this.grpSource.Controls.Add(this.pnlSourceDb);
this.grpSource.Location = new System.Drawing.Point(12, 12); this.grpSource.Location = new System.Drawing.Point(18, 18);
this.grpSource.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grpSource.Name = "grpSource"; this.grpSource.Name = "grpSource";
this.grpSource.Size = new System.Drawing.Size(305, 137); this.grpSource.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grpSource.Size = new System.Drawing.Size(458, 274);
this.grpSource.TabIndex = 16; this.grpSource.TabIndex = 16;
this.grpSource.TabStop = false; this.grpSource.TabStop = false;
this.grpSource.Text = "Source"; this.grpSource.Text = "Source";
// //
// pnlSourceFile
//
this.pnlSourceFile.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlSourceFile.Controls.Add(this.btnSourceFileOpen);
this.pnlSourceFile.Controls.Add(this.txtSourceFile);
this.pnlSourceFile.Location = new System.Drawing.Point(100, 216);
this.pnlSourceFile.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlSourceFile.Name = "pnlSourceFile";
this.pnlSourceFile.Size = new System.Drawing.Size(350, 47);
this.pnlSourceFile.TabIndex = 20;
//
// btnSourceFileOpen
//
this.btnSourceFileOpen.Location = new System.Drawing.Point(294, 10);
this.btnSourceFileOpen.Name = "btnSourceFileOpen";
this.btnSourceFileOpen.Size = new System.Drawing.Size(40, 28);
this.btnSourceFileOpen.TabIndex = 1;
this.btnSourceFileOpen.Text = "...";
this.btnSourceFileOpen.UseVisualStyleBackColor = true;
this.btnSourceFileOpen.Click += new System.EventHandler(this.btnSourceFileOpen_Click);
//
// txtSourceFile
//
this.txtSourceFile.Location = new System.Drawing.Point(16, 11);
this.txtSourceFile.Name = "txtSourceFile";
this.txtSourceFile.Size = new System.Drawing.Size(271, 26);
this.txtSourceFile.TabIndex = 0;
//
// rdoSourceFile
//
this.rdoSourceFile.AutoSize = true;
this.rdoSourceFile.Location = new System.Drawing.Point(10, 231);
this.rdoSourceFile.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.rdoSourceFile.Name = "rdoSourceFile";
this.rdoSourceFile.Size = new System.Drawing.Size(52, 24);
this.rdoSourceFile.TabIndex = 19;
this.rdoSourceFile.Text = "File";
this.rdoSourceFile.UseVisualStyleBackColor = true;
this.rdoSourceFile.CheckedChanged += new System.EventHandler(this.rdoSourceFile_CheckedChanged);
//
// pnlSourceProject // pnlSourceProject
// //
this.pnlSourceProject.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.pnlSourceProject.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pnlSourceProject.Controls.Add(this.cboSourceProject); this.pnlSourceProject.Controls.Add(this.cboSourceProject);
this.pnlSourceProject.Location = new System.Drawing.Point(67, 9); this.pnlSourceProject.Location = new System.Drawing.Point(100, 14);
this.pnlSourceProject.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlSourceProject.Name = "pnlSourceProject"; this.pnlSourceProject.Name = "pnlSourceProject";
this.pnlSourceProject.Size = new System.Drawing.Size(233, 34); this.pnlSourceProject.Size = new System.Drawing.Size(350, 47);
this.pnlSourceProject.TabIndex = 18; this.pnlSourceProject.TabIndex = 18;
// //
// cboSourceProject // cboSourceProject
@ -151,19 +213,21 @@
this.cboSourceProject.DisplayMember = "Name"; this.cboSourceProject.DisplayMember = "Name";
this.cboSourceProject.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboSourceProject.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboSourceProject.FormattingEnabled = true; this.cboSourceProject.FormattingEnabled = true;
this.cboSourceProject.Location = new System.Drawing.Point(11, 7); this.cboSourceProject.Location = new System.Drawing.Point(16, 11);
this.cboSourceProject.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.cboSourceProject.MaxDropDownItems = 11; this.cboSourceProject.MaxDropDownItems = 11;
this.cboSourceProject.Name = "cboSourceProject"; this.cboSourceProject.Name = "cboSourceProject";
this.cboSourceProject.Size = new System.Drawing.Size(213, 21); this.cboSourceProject.Size = new System.Drawing.Size(318, 28);
this.cboSourceProject.TabIndex = 9; this.cboSourceProject.TabIndex = 9;
this.cboSourceProject.SelectedIndexChanged += new System.EventHandler(this.cboSourceProject_SelectedIndexChanged); this.cboSourceProject.SelectedIndexChanged += new System.EventHandler(this.cboSourceProject_SelectedIndexChanged);
// //
// rdoSourceProject // rdoSourceProject
// //
this.rdoSourceProject.AutoSize = true; this.rdoSourceProject.AutoSize = true;
this.rdoSourceProject.Location = new System.Drawing.Point(7, 19); this.rdoSourceProject.Location = new System.Drawing.Point(10, 29);
this.rdoSourceProject.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.rdoSourceProject.Name = "rdoSourceProject"; this.rdoSourceProject.Name = "rdoSourceProject";
this.rdoSourceProject.Size = new System.Drawing.Size(58, 17); this.rdoSourceProject.Size = new System.Drawing.Size(76, 24);
this.rdoSourceProject.TabIndex = 17; this.rdoSourceProject.TabIndex = 17;
this.rdoSourceProject.Text = "Project"; this.rdoSourceProject.Text = "Project";
this.rdoSourceProject.UseVisualStyleBackColor = true; this.rdoSourceProject.UseVisualStyleBackColor = true;
@ -173,9 +237,10 @@
// //
this.rdoSourceDb.AutoSize = true; this.rdoSourceDb.AutoSize = true;
this.rdoSourceDb.Checked = true; this.rdoSourceDb.Checked = true;
this.rdoSourceDb.Location = new System.Drawing.Point(7, 46); this.rdoSourceDb.Location = new System.Drawing.Point(10, 71);
this.rdoSourceDb.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.rdoSourceDb.Name = "rdoSourceDb"; this.rdoSourceDb.Name = "rdoSourceDb";
this.rdoSourceDb.Size = new System.Drawing.Size(71, 17); this.rdoSourceDb.Size = new System.Drawing.Size(97, 24);
this.rdoSourceDb.TabIndex = 16; this.rdoSourceDb.TabIndex = 16;
this.rdoSourceDb.TabStop = true; this.rdoSourceDb.TabStop = true;
this.rdoSourceDb.Text = "Database"; this.rdoSourceDb.Text = "Database";
@ -186,28 +251,75 @@
// //
this.grpTarget.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.grpTarget.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.grpTarget.Controls.Add(this.pnlTargetFile);
this.grpTarget.Controls.Add(this.rdoTargetFile);
this.grpTarget.Controls.Add(this.pnlTargetProject); this.grpTarget.Controls.Add(this.pnlTargetProject);
this.grpTarget.Controls.Add(this.rdoTargetProject); this.grpTarget.Controls.Add(this.rdoTargetProject);
this.grpTarget.Controls.Add(this.rdoTargetDb); this.grpTarget.Controls.Add(this.rdoTargetDb);
this.grpTarget.Controls.Add(this.label3); this.grpTarget.Controls.Add(this.label3);
this.grpTarget.Controls.Add(this.label4); this.grpTarget.Controls.Add(this.label4);
this.grpTarget.Controls.Add(this.pnlTargetDb); this.grpTarget.Controls.Add(this.pnlTargetDb);
this.grpTarget.Location = new System.Drawing.Point(365, 12); this.grpTarget.Location = new System.Drawing.Point(548, 18);
this.grpTarget.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grpTarget.Name = "grpTarget"; this.grpTarget.Name = "grpTarget";
this.grpTarget.Size = new System.Drawing.Size(305, 137); this.grpTarget.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grpTarget.Size = new System.Drawing.Size(458, 274);
this.grpTarget.TabIndex = 17; this.grpTarget.TabIndex = 17;
this.grpTarget.TabStop = false; this.grpTarget.TabStop = false;
this.grpTarget.Text = "Target"; this.grpTarget.Text = "Target";
// //
// pnlTargetFile
//
this.pnlTargetFile.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnlTargetFile.Controls.Add(this.btnTargetFileOpen);
this.pnlTargetFile.Controls.Add(this.txtTargetFile);
this.pnlTargetFile.Location = new System.Drawing.Point(100, 216);
this.pnlTargetFile.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlTargetFile.Name = "pnlTargetFile";
this.pnlTargetFile.Size = new System.Drawing.Size(348, 47);
this.pnlTargetFile.TabIndex = 20;
//
// btnTargetFileOpen
//
this.btnTargetFileOpen.Location = new System.Drawing.Point(294, 10);
this.btnTargetFileOpen.Name = "btnTargetFileOpen";
this.btnTargetFileOpen.Size = new System.Drawing.Size(40, 28);
this.btnTargetFileOpen.TabIndex = 2;
this.btnTargetFileOpen.Text = "...";
this.btnTargetFileOpen.UseVisualStyleBackColor = true;
this.btnTargetFileOpen.Click += new System.EventHandler(this.btnTargetFileOpen_Click);
//
// txtTargetFile
//
this.txtTargetFile.Location = new System.Drawing.Point(16, 11);
this.txtTargetFile.Name = "txtTargetFile";
this.txtTargetFile.Size = new System.Drawing.Size(271, 26);
this.txtTargetFile.TabIndex = 1;
//
// rdoTargetFile
//
this.rdoTargetFile.AutoSize = true;
this.rdoTargetFile.Location = new System.Drawing.Point(10, 231);
this.rdoTargetFile.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.rdoTargetFile.Name = "rdoTargetFile";
this.rdoTargetFile.Size = new System.Drawing.Size(52, 24);
this.rdoTargetFile.TabIndex = 19;
this.rdoTargetFile.Text = "File";
this.rdoTargetFile.UseVisualStyleBackColor = true;
this.rdoTargetFile.CheckedChanged += new System.EventHandler(this.rdoTargetFile_CheckedChanged);
//
// pnlTargetProject // pnlTargetProject
// //
this.pnlTargetProject.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.pnlTargetProject.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pnlTargetProject.Controls.Add(this.cboTargetProject); this.pnlTargetProject.Controls.Add(this.cboTargetProject);
this.pnlTargetProject.Location = new System.Drawing.Point(67, 9); this.pnlTargetProject.Location = new System.Drawing.Point(100, 14);
this.pnlTargetProject.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlTargetProject.Name = "pnlTargetProject"; this.pnlTargetProject.Name = "pnlTargetProject";
this.pnlTargetProject.Size = new System.Drawing.Size(232, 34); this.pnlTargetProject.Size = new System.Drawing.Size(348, 47);
this.pnlTargetProject.TabIndex = 18; this.pnlTargetProject.TabIndex = 18;
// //
// cboTargetProject // cboTargetProject
@ -218,18 +330,20 @@
this.cboTargetProject.DisplayMember = "Name"; this.cboTargetProject.DisplayMember = "Name";
this.cboTargetProject.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cboTargetProject.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboTargetProject.FormattingEnabled = true; this.cboTargetProject.FormattingEnabled = true;
this.cboTargetProject.Location = new System.Drawing.Point(11, 7); this.cboTargetProject.Location = new System.Drawing.Point(16, 11);
this.cboTargetProject.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.cboTargetProject.MaxDropDownItems = 11; this.cboTargetProject.MaxDropDownItems = 11;
this.cboTargetProject.Name = "cboTargetProject"; this.cboTargetProject.Name = "cboTargetProject";
this.cboTargetProject.Size = new System.Drawing.Size(213, 21); this.cboTargetProject.Size = new System.Drawing.Size(318, 28);
this.cboTargetProject.TabIndex = 9; this.cboTargetProject.TabIndex = 9;
// //
// rdoTargetProject // rdoTargetProject
// //
this.rdoTargetProject.AutoSize = true; this.rdoTargetProject.AutoSize = true;
this.rdoTargetProject.Location = new System.Drawing.Point(7, 19); this.rdoTargetProject.Location = new System.Drawing.Point(10, 29);
this.rdoTargetProject.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.rdoTargetProject.Name = "rdoTargetProject"; this.rdoTargetProject.Name = "rdoTargetProject";
this.rdoTargetProject.Size = new System.Drawing.Size(58, 17); this.rdoTargetProject.Size = new System.Drawing.Size(76, 24);
this.rdoTargetProject.TabIndex = 17; this.rdoTargetProject.TabIndex = 17;
this.rdoTargetProject.Text = "Project"; this.rdoTargetProject.Text = "Project";
this.rdoTargetProject.UseVisualStyleBackColor = true; this.rdoTargetProject.UseVisualStyleBackColor = true;
@ -239,9 +353,10 @@
// //
this.rdoTargetDb.AutoSize = true; this.rdoTargetDb.AutoSize = true;
this.rdoTargetDb.Checked = true; this.rdoTargetDb.Checked = true;
this.rdoTargetDb.Location = new System.Drawing.Point(7, 46); this.rdoTargetDb.Location = new System.Drawing.Point(10, 71);
this.rdoTargetDb.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.rdoTargetDb.Name = "rdoTargetDb"; this.rdoTargetDb.Name = "rdoTargetDb";
this.rdoTargetDb.Size = new System.Drawing.Size(71, 17); this.rdoTargetDb.Size = new System.Drawing.Size(97, 24);
this.rdoTargetDb.TabIndex = 16; this.rdoTargetDb.TabIndex = 16;
this.rdoTargetDb.TabStop = true; this.rdoTargetDb.TabStop = true;
this.rdoTargetDb.Text = "Database"; this.rdoTargetDb.Text = "Database";
@ -251,18 +366,20 @@
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 76); this.label3.Location = new System.Drawing.Point(9, 117);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(38, 13); this.label3.Size = new System.Drawing.Size(55, 20);
this.label3.TabIndex = 10; this.label3.TabIndex = 10;
this.label3.Text = "Server"; this.label3.Text = "Server";
// //
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 108); this.label4.Location = new System.Drawing.Point(9, 166);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 13); this.label4.Size = new System.Drawing.Size(79, 20);
this.label4.TabIndex = 11; this.label4.TabIndex = 11;
this.label4.Text = "Database"; this.label4.Text = "Database";
// //
@ -273,9 +390,10 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pnlTargetDb.Controls.Add(this.cboTargetServer); this.pnlTargetDb.Controls.Add(this.cboTargetServer);
this.pnlTargetDb.Controls.Add(this.cboTargetDatabase); this.pnlTargetDb.Controls.Add(this.cboTargetDatabase);
this.pnlTargetDb.Location = new System.Drawing.Point(67, 66); this.pnlTargetDb.Location = new System.Drawing.Point(100, 102);
this.pnlTargetDb.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.pnlTargetDb.Name = "pnlTargetDb"; this.pnlTargetDb.Name = "pnlTargetDb";
this.pnlTargetDb.Size = new System.Drawing.Size(232, 66); this.pnlTargetDb.Size = new System.Drawing.Size(348, 101);
this.pnlTargetDb.TabIndex = 15; this.pnlTargetDb.TabIndex = 15;
// //
// cboTargetServer // cboTargetServer
@ -284,10 +402,11 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.cboTargetServer.FormattingEnabled = true; this.cboTargetServer.FormattingEnabled = true;
this.cboTargetServer.Location = new System.Drawing.Point(11, 7); this.cboTargetServer.Location = new System.Drawing.Point(16, 11);
this.cboTargetServer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.cboTargetServer.MaxDropDownItems = 11; this.cboTargetServer.MaxDropDownItems = 11;
this.cboTargetServer.Name = "cboTargetServer"; this.cboTargetServer.Name = "cboTargetServer";
this.cboTargetServer.Size = new System.Drawing.Size(213, 21); this.cboTargetServer.Size = new System.Drawing.Size(318, 28);
this.cboTargetServer.TabIndex = 9; this.cboTargetServer.TabIndex = 9;
this.cboTargetServer.TextChanged += new System.EventHandler(this.cboTargetServer_TextChanged); this.cboTargetServer.TextChanged += new System.EventHandler(this.cboTargetServer_TextChanged);
// //
@ -297,10 +416,11 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.cboTargetDatabase.FormattingEnabled = true; this.cboTargetDatabase.FormattingEnabled = true;
this.cboTargetDatabase.Location = new System.Drawing.Point(11, 39); this.cboTargetDatabase.Location = new System.Drawing.Point(16, 60);
this.cboTargetDatabase.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.cboTargetDatabase.MaxDropDownItems = 11; this.cboTargetDatabase.MaxDropDownItems = 11;
this.cboTargetDatabase.Name = "cboTargetDatabase"; this.cboTargetDatabase.Name = "cboTargetDatabase";
this.cboTargetDatabase.Size = new System.Drawing.Size(213, 21); this.cboTargetDatabase.Size = new System.Drawing.Size(318, 28);
this.cboTargetDatabase.TabIndex = 12; this.cboTargetDatabase.TabIndex = 12;
this.cboTargetDatabase.Enter += new System.EventHandler(this.cboTargetDatabase_Enter); this.cboTargetDatabase.Enter += new System.EventHandler(this.cboTargetDatabase_Enter);
// //
@ -308,9 +428,10 @@
// //
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(506, 159); this.btnOK.Location = new System.Drawing.Point(759, 308);
this.btnOK.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnOK.Name = "btnOK"; this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.Size = new System.Drawing.Size(112, 35);
this.btnOK.TabIndex = 18; this.btnOK.TabIndex = 18;
this.btnOK.Text = "OK"; this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true; this.btnOK.UseVisualStyleBackColor = true;
@ -320,9 +441,10 @@
// //
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(587, 159); this.btnCancel.Location = new System.Drawing.Point(880, 308);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.Size = new System.Drawing.Size(112, 35);
this.btnCancel.TabIndex = 19; this.btnCancel.TabIndex = 19;
this.btnCancel.Text = "Cancel"; this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
@ -332,9 +454,10 @@
this.btnSwitch.Anchor = System.Windows.Forms.AnchorStyles.None; this.btnSwitch.Anchor = System.Windows.Forms.AnchorStyles.None;
this.btnSwitch.BackgroundImage = global::BismNormalizer.Resources.ButtonSwitch; this.btnSwitch.BackgroundImage = global::BismNormalizer.Resources.ButtonSwitch;
this.btnSwitch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.btnSwitch.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.btnSwitch.Location = new System.Drawing.Point(323, 50); this.btnSwitch.Location = new System.Drawing.Point(484, 108);
this.btnSwitch.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnSwitch.Name = "btnSwitch"; this.btnSwitch.Name = "btnSwitch";
this.btnSwitch.Size = new System.Drawing.Size(36, 32); this.btnSwitch.Size = new System.Drawing.Size(54, 49);
this.btnSwitch.TabIndex = 20; this.btnSwitch.TabIndex = 20;
this.btnSwitch.UseVisualStyleBackColor = true; this.btnSwitch.UseVisualStyleBackColor = true;
this.btnSwitch.Click += new System.EventHandler(this.btnSwitch_Click); this.btnSwitch.Click += new System.EventHandler(this.btnSwitch_Click);
@ -342,16 +465,17 @@
// Connections // Connections
// //
this.AcceptButton = this.btnOK; this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel; this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(682, 194); this.ClientSize = new System.Drawing.Size(1023, 361);
this.Controls.Add(this.btnSwitch); this.Controls.Add(this.btnSwitch);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK); this.Controls.Add(this.btnOK);
this.Controls.Add(this.grpTarget); this.Controls.Add(this.grpTarget);
this.Controls.Add(this.grpSource); this.Controls.Add(this.grpSource);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "Connections"; this.Name = "Connections";
@ -362,9 +486,13 @@
this.pnlSourceDb.ResumeLayout(false); this.pnlSourceDb.ResumeLayout(false);
this.grpSource.ResumeLayout(false); this.grpSource.ResumeLayout(false);
this.grpSource.PerformLayout(); this.grpSource.PerformLayout();
this.pnlSourceFile.ResumeLayout(false);
this.pnlSourceFile.PerformLayout();
this.pnlSourceProject.ResumeLayout(false); this.pnlSourceProject.ResumeLayout(false);
this.grpTarget.ResumeLayout(false); this.grpTarget.ResumeLayout(false);
this.grpTarget.PerformLayout(); this.grpTarget.PerformLayout();
this.pnlTargetFile.ResumeLayout(false);
this.pnlTargetFile.PerformLayout();
this.pnlTargetProject.ResumeLayout(false); this.pnlTargetProject.ResumeLayout(false);
this.pnlTargetDb.ResumeLayout(false); this.pnlTargetDb.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
@ -396,5 +524,13 @@
private System.Windows.Forms.Button btnSwitch; private System.Windows.Forms.Button btnSwitch;
private System.Windows.Forms.Panel pnlSourceProject; private System.Windows.Forms.Panel pnlSourceProject;
private System.Windows.Forms.Panel pnlTargetProject; private System.Windows.Forms.Panel pnlTargetProject;
private System.Windows.Forms.Panel pnlSourceFile;
private System.Windows.Forms.RadioButton rdoSourceFile;
private System.Windows.Forms.Panel pnlTargetFile;
private System.Windows.Forms.RadioButton rdoTargetFile;
private System.Windows.Forms.Button btnSourceFileOpen;
private System.Windows.Forms.TextBox txtSourceFile;
private System.Windows.Forms.Button btnTargetFileOpen;
private System.Windows.Forms.TextBox txtTargetFile;
} }
} }

View File

@ -127,6 +127,7 @@ namespace BismNormalizer.TabularCompare.UI
rdoTargetProject.Checked = true; rdoTargetProject.Checked = true;
pnlTargetProject.Enabled = true; pnlTargetProject.Enabled = true;
cboSourceProject.SelectedIndex = 0;
cboTargetProject.SelectedIndex = 1; cboTargetProject.SelectedIndex = 1;
} }
} }
@ -163,7 +164,7 @@ namespace BismNormalizer.TabularCompare.UI
private bool BindSourceConnectionInfo() private bool BindSourceConnectionInfo()
{ {
bool returnVal = false; bool boundSuccessfully = false;
if (_comparisonInfo?.ConnectionInfoSource != null) if (_comparisonInfo?.ConnectionInfoSource != null)
{ {
@ -173,6 +174,8 @@ namespace BismNormalizer.TabularCompare.UI
{ {
rdoSourceProject.Checked = true; rdoSourceProject.Checked = true;
pnlSourceProject.Enabled = true; pnlSourceProject.Enabled = true;
pnlSourceDb.Enabled = false;
pnlSourceFile.Enabled = false;
for (int i = 0; i < ((BindingSource)cboSourceProject.DataSource).Count; i++) for (int i = 0; i < ((BindingSource)cboSourceProject.DataSource).Count; i++)
{ {
@ -183,27 +186,39 @@ namespace BismNormalizer.TabularCompare.UI
} }
} }
returnVal = true; boundSuccessfully = true;
} }
} }
else if (_comparisonInfo.ConnectionInfoSource.UseBimFile)
{
rdoSourceFile.Checked = true;
pnlSourceProject.Enabled = false;
pnlSourceDb.Enabled = false;
pnlSourceFile.Enabled = true;
txtSourceFile.Text = _comparisonInfo.ConnectionInfoSource.BimFile;
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))
{ {
rdoSourceDb.Checked = true; rdoSourceDb.Checked = true;
pnlSourceProject.Enabled = false; pnlSourceProject.Enabled = false;
pnlSourceDb.Enabled = true;
pnlSourceFile.Enabled = false;
cboSourceServer.Text = _comparisonInfo.ConnectionInfoSource.ServerName; cboSourceServer.Text = _comparisonInfo.ConnectionInfoSource.ServerName;
cboSourceDatabase.Text = _comparisonInfo.ConnectionInfoSource.DatabaseName; cboSourceDatabase.Text = _comparisonInfo.ConnectionInfoSource.DatabaseName;
returnVal = true; boundSuccessfully = true;
} }
} }
return returnVal; return boundSuccessfully;
} }
private bool BindTargetConnectionInfo(out bool boundTargetDatabase) private bool BindTargetConnectionInfo(out bool boundTargetDatabase)
{ {
bool returnVal = false; bool boundSuccessfully = false;
boundTargetDatabase = false; boundTargetDatabase = false;
if (_comparisonInfo?.ConnectionInfoTarget != null) if (_comparisonInfo?.ConnectionInfoTarget != null)
@ -214,6 +229,8 @@ namespace BismNormalizer.TabularCompare.UI
{ {
rdoTargetProject.Checked = true; rdoTargetProject.Checked = true;
pnlTargetProject.Enabled = true; pnlTargetProject.Enabled = true;
pnlTargetDb.Enabled = false;
pnlTargetFile.Enabled = false;
for (int i = 0; i < ((BindingSource)cboTargetProject.DataSource).Count; i++) for (int i = 0; i < ((BindingSource)cboTargetProject.DataSource).Count; i++)
{ {
@ -224,23 +241,35 @@ namespace BismNormalizer.TabularCompare.UI
} }
} }
returnVal = true; boundSuccessfully = true;
} }
} }
else if (_comparisonInfo.ConnectionInfoTarget.UseBimFile)
{
rdoTargetFile.Checked = true;
pnlTargetProject.Enabled = false;
pnlTargetDb.Enabled = false;
pnlTargetFile.Enabled = true;
txtTargetFile.Text = _comparisonInfo.ConnectionInfoTarget.BimFile;
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))
{ {
rdoTargetDb.Checked = true; rdoTargetDb.Checked = true;
pnlTargetProject.Enabled = false; pnlTargetProject.Enabled = false;
pnlTargetDb.Enabled = true;
pnlTargetFile.Enabled = false;
cboTargetServer.Text = _comparisonInfo.ConnectionInfoTarget.ServerName; cboTargetServer.Text = _comparisonInfo.ConnectionInfoTarget.ServerName;
cboTargetDatabase.Text = _comparisonInfo.ConnectionInfoTarget.DatabaseName; cboTargetDatabase.Text = _comparisonInfo.ConnectionInfoTarget.DatabaseName;
boundTargetDatabase = true; boundTargetDatabase = true;
returnVal = true; boundSuccessfully = true;
} }
} }
return returnVal; return boundSuccessfully;
} }
private static void IterateProject(SortedList projects, EnvDTE.Project project, string derivedProjectName = "") private static void IterateProject(SortedList projects, EnvDTE.Project project, string derivedProjectName = "")
@ -299,26 +328,44 @@ namespace BismNormalizer.TabularCompare.UI
{ {
pnlSourceProject.Enabled = true; pnlSourceProject.Enabled = true;
pnlSourceDb.Enabled = false; pnlSourceDb.Enabled = false;
pnlSourceFile.Enabled = false;
cboSourceProject.Focus(); cboSourceProject.Focus();
} }
private void rdoSourceDb_CheckedChanged(object sender, EventArgs e) private void rdoSourceDb_CheckedChanged(object sender, EventArgs e)
{ {
pnlSourceProject.Enabled = false; pnlSourceProject.Enabled = false;
pnlSourceDb.Enabled = true; pnlSourceDb.Enabled = true;
pnlSourceFile.Enabled = false;
cboSourceServer.Focus(); cboSourceServer.Focus();
} }
private void rdoSourceFile_CheckedChanged(object sender, EventArgs e)
{
pnlSourceProject.Enabled = false;
pnlSourceDb.Enabled = false;
pnlSourceFile.Enabled = true;
btnSourceFileOpen.Focus();
}
private void rdoTargetProject_CheckedChanged(object sender, EventArgs e) private void rdoTargetProject_CheckedChanged(object sender, EventArgs e)
{ {
pnlTargetProject.Enabled = true; pnlTargetProject.Enabled = true;
pnlTargetDb.Enabled = false; pnlTargetDb.Enabled = false;
pnlTargetFile.Enabled = false;
cboTargetProject.Focus(); cboTargetProject.Focus();
} }
private void rdoTargetDb_CheckedChanged(object sender, EventArgs e) private void rdoTargetDb_CheckedChanged(object sender, EventArgs e)
{ {
pnlTargetProject.Enabled = false; pnlTargetProject.Enabled = false;
pnlTargetDb.Enabled = true; pnlTargetDb.Enabled = true;
pnlTargetFile.Enabled = false;
cboTargetServer.Focus(); cboTargetServer.Focus();
} }
private void rdoTargetFile_CheckedChanged(object sender, EventArgs e)
{
pnlTargetProject.Enabled = false;
pnlTargetDb.Enabled = false;
pnlTargetFile.Enabled = true;
btnTargetFileOpen.Focus();
}
private void btnOK_Click(object sender, EventArgs e) private void btnOK_Click(object sender, EventArgs e)
{ {
@ -328,14 +375,24 @@ namespace BismNormalizer.TabularCompare.UI
_comparisonInfo.ConnectionInfoSource.Project = (EnvDTE.Project)cboSourceProject.SelectedValue; _comparisonInfo.ConnectionInfoSource.Project = (EnvDTE.Project)cboSourceProject.SelectedValue;
_comparisonInfo.ConnectionInfoSource.ProjectName = cboSourceProject.Text; _comparisonInfo.ConnectionInfoSource.ProjectName = cboSourceProject.Text;
_comparisonInfo.ConnectionInfoSource.ProjectFile = ((EnvDTE.Project)cboSourceProject.SelectedValue).FullName; _comparisonInfo.ConnectionInfoSource.ProjectFile = ((EnvDTE.Project)cboSourceProject.SelectedValue).FullName;
_comparisonInfo.ConnectionInfoSource.BimFile = null;
}
else if (rdoSourceFile.Checked)
{
_comparisonInfo.ConnectionInfoSource.UseBimFile = true;
_comparisonInfo.ConnectionInfoSource.BimFile = txtSourceFile.Text;
_comparisonInfo.ConnectionInfoSource.ProjectName = null;
_comparisonInfo.ConnectionInfoSource.ProjectFile = null;
} }
else else
{ {
_comparisonInfo.ConnectionInfoSource.UseProject = false; _comparisonInfo.ConnectionInfoSource.UseProject = false;
_comparisonInfo.ConnectionInfoSource.UseBimFile = false;
_comparisonInfo.ConnectionInfoSource.ServerName = cboSourceServer.Text; _comparisonInfo.ConnectionInfoSource.ServerName = cboSourceServer.Text;
_comparisonInfo.ConnectionInfoSource.DatabaseName = cboSourceDatabase.Text; _comparisonInfo.ConnectionInfoSource.DatabaseName = cboSourceDatabase.Text;
_comparisonInfo.ConnectionInfoSource.ProjectName = null; _comparisonInfo.ConnectionInfoSource.ProjectName = null;
_comparisonInfo.ConnectionInfoSource.ProjectFile = null; _comparisonInfo.ConnectionInfoSource.ProjectFile = null;
_comparisonInfo.ConnectionInfoSource.BimFile = null;
} }
if (rdoTargetProject.Checked) if (rdoTargetProject.Checked)
@ -344,14 +401,24 @@ namespace BismNormalizer.TabularCompare.UI
_comparisonInfo.ConnectionInfoTarget.Project = (EnvDTE.Project)cboTargetProject.SelectedValue; _comparisonInfo.ConnectionInfoTarget.Project = (EnvDTE.Project)cboTargetProject.SelectedValue;
_comparisonInfo.ConnectionInfoTarget.ProjectName = cboTargetProject.Text; _comparisonInfo.ConnectionInfoTarget.ProjectName = cboTargetProject.Text;
_comparisonInfo.ConnectionInfoTarget.ProjectFile = ((EnvDTE.Project)cboTargetProject.SelectedValue).FullName; _comparisonInfo.ConnectionInfoTarget.ProjectFile = ((EnvDTE.Project)cboTargetProject.SelectedValue).FullName;
_comparisonInfo.ConnectionInfoTarget.BimFile = null;
}
else if (rdoTargetFile.Checked)
{
_comparisonInfo.ConnectionInfoTarget.UseBimFile = true;
_comparisonInfo.ConnectionInfoTarget.BimFile = txtTargetFile.Text;
_comparisonInfo.ConnectionInfoTarget.ProjectName = null;
_comparisonInfo.ConnectionInfoTarget.ProjectFile = null;
} }
else else
{ {
_comparisonInfo.ConnectionInfoTarget.UseProject = false; _comparisonInfo.ConnectionInfoTarget.UseProject = false;
_comparisonInfo.ConnectionInfoTarget.UseBimFile = false;
_comparisonInfo.ConnectionInfoTarget.ServerName = cboTargetServer.Text; _comparisonInfo.ConnectionInfoTarget.ServerName = cboTargetServer.Text;
_comparisonInfo.ConnectionInfoTarget.DatabaseName = cboTargetDatabase.Text; _comparisonInfo.ConnectionInfoTarget.DatabaseName = cboTargetDatabase.Text;
_comparisonInfo.ConnectionInfoTarget.ProjectName = null; _comparisonInfo.ConnectionInfoTarget.ProjectName = null;
_comparisonInfo.ConnectionInfoTarget.ProjectFile = null; _comparisonInfo.ConnectionInfoTarget.ProjectFile = null;
_comparisonInfo.ConnectionInfoTarget.BimFile = null;
} }
} }
@ -361,24 +428,30 @@ namespace BismNormalizer.TabularCompare.UI
ConnectionInfo infoSourceTemp = new ConnectionInfo(); ConnectionInfo infoSourceTemp = new ConnectionInfo();
infoSourceTemp.UseProject = rdoSourceProject.Checked; infoSourceTemp.UseProject = rdoSourceProject.Checked;
infoSourceTemp.UseBimFile = rdoSourceFile.Checked;
infoSourceTemp.ProjectName = cboSourceProject.Text; infoSourceTemp.ProjectName = cboSourceProject.Text;
infoSourceTemp.Project = (EnvDTE.Project)cboSourceProject.SelectedValue; infoSourceTemp.Project = (EnvDTE.Project)cboSourceProject.SelectedValue;
infoSourceTemp.ServerName = cboSourceServer.Text; infoSourceTemp.ServerName = cboSourceServer.Text;
infoSourceTemp.DatabaseName = cboSourceDatabase.Text; infoSourceTemp.DatabaseName = cboSourceDatabase.Text;
infoSourceTemp.BimFile = txtSourceFile.Text;
rdoSourceProject.Checked = rdoTargetProject.Checked; rdoSourceProject.Checked = rdoTargetProject.Checked;
rdoSourceFile.Checked = rdoTargetFile.Checked;
rdoSourceDb.Checked = rdoTargetDb.Checked; rdoSourceDb.Checked = rdoTargetDb.Checked;
cboSourceProject.Text = cboTargetProject.Text; cboSourceProject.Text = cboTargetProject.Text;
cboSourceProject.SelectedValue = cboTargetProject.SelectedValue; cboSourceProject.SelectedValue = cboTargetProject.SelectedValue;
cboSourceServer.Text = cboTargetServer.Text; cboSourceServer.Text = cboTargetServer.Text;
cboSourceDatabase.Text = cboTargetDatabase.Text; cboSourceDatabase.Text = cboTargetDatabase.Text;
txtSourceFile.Text = txtTargetFile.Text;
rdoTargetProject.Checked = infoSourceTemp.UseProject; rdoTargetProject.Checked = infoSourceTemp.UseProject;
rdoTargetDb.Checked = !infoSourceTemp.UseProject; rdoTargetFile.Checked = infoSourceTemp.UseBimFile;
rdoTargetDb.Checked = (!infoSourceTemp.UseProject && !infoSourceTemp.UseBimFile);
cboTargetProject.Text = infoSourceTemp.ProjectName; cboTargetProject.Text = infoSourceTemp.ProjectName;
cboTargetProject.SelectedValue = infoSourceTemp.Project; cboTargetProject.SelectedValue = infoSourceTemp.Project;
cboTargetServer.Text = infoSourceTemp.ServerName; cboTargetServer.Text = infoSourceTemp.ServerName;
cboTargetDatabase.Text = infoSourceTemp.DatabaseName; cboTargetDatabase.Text = infoSourceTemp.DatabaseName;
txtTargetFile.Text = infoSourceTemp.BimFile;
_SetTargetDatabaseFromSourceProjectConfigurationAllowed = true; _SetTargetDatabaseFromSourceProjectConfigurationAllowed = true;
} }
@ -419,6 +492,35 @@ namespace BismNormalizer.TabularCompare.UI
} }
} }
private void btnSourceFileOpen_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = OpenBimFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
txtSourceFile.Text = ofd.FileName;
Settings.Default.LastBimFileLocation = ofd.FileName;
}
}
private void btnTargetFileOpen_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = OpenBimFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
txtTargetFile.Text = ofd.FileName;
Settings.Default.LastBimFileLocation = ofd.FileName;
}
}
private OpenFileDialog OpenBimFileDialog()
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = (String.IsNullOrEmpty(Settings.Default.LastBimFileLocation) ? Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) : Settings.Default.LastBimFileLocation);
ofd.Filter = "BIM Files (.bim)|*.bim|All files (*.*)|*.*";
ofd.Title = "Open";
return ofd;
}
private void BindDatabaseList(string serverName, ComboBox cboCatalog) private void BindDatabaseList(string serverName, ComboBox cboCatalog)
{ {
try try

View File

@ -82,6 +82,9 @@
<setting name="OptionRetainStorageMode" serializeAs="String"> <setting name="OptionRetainStorageMode" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="LastBimFileLocation" serializeAs="String">
<value />
</setting>
</BismNormalizer.Settings> </BismNormalizer.Settings>
</userSettings> </userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup>