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