Launch from Desktop
This commit is contained in:
parent
7b6526a516
commit
1f8dc324a9
@ -77,14 +77,17 @@ namespace AlmToolkit
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ComparisonForm_Load(object sender, EventArgs e)
|
private void ComparisonForm_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_comparisonInfo == null)
|
||||||
{
|
{
|
||||||
_comparisonInfo = new ComparisonInfo();
|
_comparisonInfo = new ComparisonInfo();
|
||||||
_comparisonInfo.AppName = Utils.AssemblyProduct;
|
_comparisonInfo.AppName = Utils.AssemblyProduct;
|
||||||
|
|
||||||
GetFromAutoCompleteSource();
|
//GetFromAutoCompleteSource();
|
||||||
GetFromAutoCompleteTarget();
|
//GetFromAutoCompleteTarget();
|
||||||
|
|
||||||
SetNotComparedState();
|
SetNotComparedState();
|
||||||
|
}
|
||||||
|
|
||||||
//hdpi
|
//hdpi
|
||||||
Rescale();
|
Rescale();
|
||||||
@ -307,19 +310,19 @@ namespace AlmToolkit
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void GetFromAutoCompleteSource()
|
//private void GetFromAutoCompleteSource()
|
||||||
{
|
//{
|
||||||
string serverNameSource = ReverseArray<string>(Settings.Default.SourceServerAutoCompleteEntries.Substring(0,
|
// string serverNameSource = ReverseArray<string>(Settings.Default.SourceServerAutoCompleteEntries.Substring(0,
|
||||||
Settings.Default.SourceServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray()))[0]; //.Reverse().ToArray();
|
// Settings.Default.SourceServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray()))[0]; //.Reverse().ToArray();
|
||||||
// _connectionInfoSource = new ConnectionInfo(serverNameSource, Settings.Default.SourceCatalog);
|
// _connectionInfoSource = new ConnectionInfo(serverNameSource, Settings.Default.SourceCatalog);
|
||||||
}
|
//}
|
||||||
|
|
||||||
private void GetFromAutoCompleteTarget()
|
//private void GetFromAutoCompleteTarget()
|
||||||
{
|
//{
|
||||||
string serverNameTarget = ReverseArray<string>(Settings.Default.TargetServerAutoCompleteEntries.Substring(0,
|
// string serverNameTarget = ReverseArray<string>(Settings.Default.TargetServerAutoCompleteEntries.Substring(0,
|
||||||
Settings.Default.TargetServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray()))[0];
|
// Settings.Default.TargetServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray()))[0];
|
||||||
//_connectionInfoTarget = new ConnectionInfo(serverNameTarget, Settings.Default.TargetCatalog);
|
// //_connectionInfoTarget = new ConnectionInfo(serverNameTarget, Settings.Default.TargetCatalog);
|
||||||
}
|
//}
|
||||||
|
|
||||||
internal static T[] ReverseArray<T>(T[] array)
|
internal static T[] ReverseArray<T>(T[] array)
|
||||||
{
|
{
|
||||||
@ -351,7 +354,7 @@ namespace AlmToolkit
|
|||||||
Settings.Default.SourceCatalog = _comparisonInfo.ConnectionInfoSource.DatabaseName;
|
Settings.Default.SourceCatalog = _comparisonInfo.ConnectionInfoSource.DatabaseName;
|
||||||
|
|
||||||
Settings.Default.Save();
|
Settings.Default.Save();
|
||||||
GetFromAutoCompleteSource();
|
//GetFromAutoCompleteSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_comparisonInfo.ConnectionInfoTarget.UseProject && !_comparisonInfo.ConnectionInfoTarget.UseDesktop && !_comparisonInfo.ConnectionInfoTarget.UseBimFile)
|
if (!_comparisonInfo.ConnectionInfoTarget.UseProject && !_comparisonInfo.ConnectionInfoTarget.UseDesktop && !_comparisonInfo.ConnectionInfoTarget.UseBimFile)
|
||||||
@ -367,7 +370,7 @@ namespace AlmToolkit
|
|||||||
Settings.Default.TargetCatalog = _comparisonInfo.ConnectionInfoTarget.DatabaseName;
|
Settings.Default.TargetCatalog = _comparisonInfo.ConnectionInfoTarget.DatabaseName;
|
||||||
|
|
||||||
Settings.Default.Save();
|
Settings.Default.Save();
|
||||||
GetFromAutoCompleteTarget();
|
//GetFromAutoCompleteTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,22 +727,19 @@ namespace AlmToolkit
|
|||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetFileNameTitle(bool unsaved)
|
public void LoadFromDesktop(string serverName, string databaseName)
|
||||||
{
|
{
|
||||||
_unsaved = unsaved;
|
_comparisonInfo = new ComparisonInfo();
|
||||||
|
_comparisonInfo.AppName = Utils.AssemblyProduct;
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(_fileName))
|
_comparisonInfo.ConnectionInfoSource.UseDesktop = true;
|
||||||
{
|
_comparisonInfo.ConnectionInfoSource.ServerName = serverName;
|
||||||
this.Text = Utils.AssemblyProduct;
|
_comparisonInfo.ConnectionInfoSource.DatabaseName = databaseName;
|
||||||
}
|
|
||||||
else
|
//GetFromAutoCompleteSource();
|
||||||
{
|
//GetFromAutoCompleteTarget();
|
||||||
this.Text = Utils.AssemblyProduct + " - " + Path.GetFileName(_fileName);
|
|
||||||
if (unsaved)
|
SetNotComparedState();
|
||||||
{
|
|
||||||
this.Text += " *";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadFile(string fileName)
|
public void LoadFile(string fileName)
|
||||||
@ -762,6 +762,24 @@ namespace AlmToolkit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetFileNameTitle(bool unsaved)
|
||||||
|
{
|
||||||
|
_unsaved = unsaved;
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(_fileName))
|
||||||
|
{
|
||||||
|
this.Text = Utils.AssemblyProduct;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Text = Utils.AssemblyProduct + " - " + Path.GetFileName(_fileName);
|
||||||
|
if (unsaved)
|
||||||
|
{
|
||||||
|
this.Text += " *";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveFile(string fileName)
|
public void SaveFile(string fileName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using Microsoft.AnalysisServices;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -18,28 +19,37 @@ namespace AlmToolkit
|
|||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
//with args(user open file with the program)
|
|
||||||
if (args != null && args.Length > 0)
|
if (args != null && args.Length > 0)
|
||||||
|
{
|
||||||
|
if (args.Length > 1)
|
||||||
|
//User opened from Desktop with server/db name
|
||||||
|
{
|
||||||
|
string serverName = args[0];
|
||||||
|
string databaseName = args[1];
|
||||||
|
|
||||||
|
ComparisonForm MainFrom = new ComparisonForm();
|
||||||
|
MainFrom.LoadFromDesktop(serverName, databaseName);
|
||||||
|
Application.Run(MainFrom);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
//User opened file with the program
|
||||||
{
|
{
|
||||||
string fileName = args[0];
|
string fileName = args[0];
|
||||||
//Check file exists
|
//Check file exists, if not will run without args below
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
ComparisonForm MainFrom = new ComparisonForm();
|
ComparisonForm MainFrom = new ComparisonForm();
|
||||||
MainFrom.LoadFile(fileName);
|
MainFrom.LoadFile(fileName);
|
||||||
Application.Run(MainFrom);
|
Application.Run(MainFrom);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//The file does not exist
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
Application.Run(new ComparisonForm());
|
//Without valid args
|
||||||
}
|
|
||||||
}
|
|
||||||
//without args
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Application.Run(new ComparisonForm());
|
Application.Run(new ComparisonForm());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,5 @@ namespace AlmToolkit
|
|||||||
return ((AssemblyProductAttribute)attributes[0]).Product;
|
return ((AssemblyProductAttribute)attributes[0]).Product;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,8 @@ namespace BismNormalizer.TabularCompare.UI
|
|||||||
cboSourceDatabase.Text = Settings.Default.SourceCatalog;
|
cboSourceDatabase.Text = Settings.Default.SourceCatalog;
|
||||||
cboTargetDatabase.Text = Settings.Default.TargetCatalog;
|
cboTargetDatabase.Text = Settings.Default.TargetCatalog;
|
||||||
|
|
||||||
|
#region Prep Desktop/SSDT instances
|
||||||
|
|
||||||
cboSourceDesktop.Items.Clear();
|
cboSourceDesktop.Items.Clear();
|
||||||
cboTargetDesktop.Items.Clear();
|
cboTargetDesktop.Items.Clear();
|
||||||
|
|
||||||
@ -105,15 +107,17 @@ namespace BismNormalizer.TabularCompare.UI
|
|||||||
cboTargetDesktop.DataSource = desktopBindingTarget;
|
cboTargetDesktop.DataSource = desktopBindingTarget;
|
||||||
cboTargetDesktop.ValueMember = "Port";
|
cboTargetDesktop.ValueMember = "Port";
|
||||||
cboTargetDesktop.DisplayMember = "Name";
|
cboTargetDesktop.DisplayMember = "Name";
|
||||||
|
|
||||||
BindSourceConnectionInfo();
|
|
||||||
BindTargetConnectionInfo();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rdoSourceDesktop.Enabled = false;
|
rdoSourceDesktop.Enabled = false;
|
||||||
rdoTargetDesktop.Enabled = false;
|
rdoTargetDesktop.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
BindSourceConnectionInfo();
|
||||||
|
BindTargetConnectionInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool BindSourceConnectionInfo()
|
private bool BindSourceConnectionInfo()
|
||||||
@ -135,6 +139,8 @@ namespace BismNormalizer.TabularCompare.UI
|
|||||||
boundSuccessfully = true;
|
boundSuccessfully = true;
|
||||||
}
|
}
|
||||||
else if (_comparisonInfo.ConnectionInfoSource.UseDesktop)
|
else if (_comparisonInfo.ConnectionInfoSource.UseDesktop)
|
||||||
|
{
|
||||||
|
if (_powerBIInstances.Count > 0)
|
||||||
{
|
{
|
||||||
rdoSourceDesktop.Checked = true;
|
rdoSourceDesktop.Checked = true;
|
||||||
|
|
||||||
@ -157,6 +163,7 @@ namespace BismNormalizer.TabularCompare.UI
|
|||||||
}
|
}
|
||||||
boundSuccessfully = true;
|
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))
|
||||||
{
|
{
|
||||||
rdoSourceDataset.Checked = true;
|
rdoSourceDataset.Checked = true;
|
||||||
@ -193,6 +200,9 @@ namespace BismNormalizer.TabularCompare.UI
|
|||||||
}
|
}
|
||||||
else if (_comparisonInfo.ConnectionInfoTarget.UseDesktop)
|
else if (_comparisonInfo.ConnectionInfoTarget.UseDesktop)
|
||||||
{
|
{
|
||||||
|
if (_powerBIInstances.Count > 0)
|
||||||
|
{
|
||||||
|
|
||||||
rdoTargetDesktop.Checked = true;
|
rdoTargetDesktop.Checked = true;
|
||||||
|
|
||||||
pnlTargetDataset.Enabled = false;
|
pnlTargetDataset.Enabled = false;
|
||||||
@ -214,6 +224,7 @@ namespace BismNormalizer.TabularCompare.UI
|
|||||||
}
|
}
|
||||||
boundSuccessfully = true;
|
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))
|
||||||
{
|
{
|
||||||
rdoTargetDataset.Checked = true;
|
rdoTargetDataset.Checked = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user