Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R# refactor of all Helper classes #54

Merged
merged 1 commit into from
May 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/GUI/SqlCe35Toolbox/Commands/BaseCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void ReportTableData(object sender, ExecutedRoutedEventArgs e)
}
catch (System.IO.FileNotFoundException)
{
EnvDTEHelper.ShowError("Microsoft Report Viewer 2010 not installed, please download and install to use this feature http://www.microsoft.com/en-us/download/details.aspx?id=6442");
EnvDteHelper.ShowError("Microsoft Report Viewer 2010 not installed, please download and install to use this feature http://www.microsoft.com/en-us/download/details.aspx?id=6442");
return;
}
catch (Exception ex)
Expand All @@ -77,7 +77,7 @@ public void EditTableData(object sender, ExecutedRoutedEventArgs e)
|| menuInfo.DatabaseInfo.DatabaseType == DatabaseType.SQLite;
if (!dbProviderPresent)
{
EnvDTEHelper.ShowError("The required DbProvider registration is not present, please re-install/repair the SQL Server Compact runtime");
EnvDteHelper.ShowError("The required DbProvider registration is not present, please re-install/repair the SQL Server Compact runtime");
return;
}

Expand Down Expand Up @@ -488,7 +488,7 @@ public void GenerateDataDiffScript(object sender, ExecutedRoutedEventArgs e)
}
catch (ArgumentException ae)
{
EnvDTEHelper.ShowError(ae.Message);
EnvDteHelper.ShowError(ae.Message);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -535,7 +535,7 @@ public void ImportData(object sender, ExecutedRoutedEventArgs e)
}
catch (System.IO.IOException iox)
{
EnvDTEHelper.ShowError(iox.Message);
EnvDteHelper.ShowError(iox.Message);
}
catch (Exception ex)
{
Expand Down
8 changes: 4 additions & 4 deletions src/GUI/SqlCe35Toolbox/Commands/ColumnMenuCommandsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void ModifyColumn(object sender, ExecutedRoutedEventArgs e)
var col = columns.SingleOrDefault(c => c.TableName == menuInfo.Description && c.ColumnName == menuInfo.Name);
if (col == null)
{
EnvDTEHelper.ShowError("Could not find the column in the table, has it been dropped?");
EnvDteHelper.ShowError("Could not find the column in the table, has it been dropped?");
return;
}
TableBuilderDialog tbd = new TableBuilderDialog(menuInfo.Description, menuInfo.DatabaseInfo.DatabaseType);
Expand Down Expand Up @@ -68,7 +68,7 @@ public void ScriptAsCreate(object sender, ExecutedRoutedEventArgs e)
var col = columns.SingleOrDefault(c => c.TableName == menuInfo.Description && c.ColumnName == menuInfo.Name);
if (col == null)
{
EnvDTEHelper.ShowError("Could not find the column in the table, has it been dropped?");
EnvDteHelper.ShowError("Could not find the column in the table, has it been dropped?");
return;
}
else
Expand Down Expand Up @@ -100,7 +100,7 @@ public void ScriptAsDrop(object sender, ExecutedRoutedEventArgs e)
var col = columns.SingleOrDefault(c => c.TableName == menuInfo.Description && c.ColumnName == menuInfo.Name);
if (col == null)
{
EnvDTEHelper.ShowError("Could not find the column in the table, has it been dropped?");
EnvDteHelper.ShowError("Could not find the column in the table, has it been dropped?");
return;
}
else
Expand Down Expand Up @@ -132,7 +132,7 @@ public void ScriptAsAlter(object sender, ExecutedRoutedEventArgs e)
var col = columns.SingleOrDefault(c => c.TableName == menuInfo.Description && c.ColumnName == menuInfo.Name);
if (col == null)
{
EnvDTEHelper.ShowError("Could not find the column in the table, has it been dropped?");
EnvDteHelper.ShowError("Could not find the column in the table, has it been dropped?");
return;
}
else
Expand Down
156 changes: 78 additions & 78 deletions src/GUI/SqlCe35Toolbox/Commands/DatabaseMenuCommandsHandler.cs

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions src/GUI/SqlCe35Toolbox/Commands/DatabasesMenuCommandsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void AddCe35Database(object sender, ExecutedRoutedEventArgs e)
// http://www.mztools.com/articles/2007/MZ2007011.aspx
if (!DataConnectionHelper.DdexProviderIsInstalled(new Guid(Resources.SqlCompact35Provider)))
{
EnvDTEHelper.ShowError("The version 3.5 Visual Studio DDEX provider is not installed, cannot add connection");
EnvDteHelper.ShowError("The version 3.5 Visual Studio DDEX provider is not installed, cannot add connection");
return;
}
try
Expand Down Expand Up @@ -105,7 +105,7 @@ public void AddCe40Database(object sender, ExecutedRoutedEventArgs e)
// http://www.mztools.com/articles/2007/MZ2007011.aspx
if (!DataConnectionHelper.DdexProviderIsInstalled(new Guid(Resources.SqlCompact40Provider)))
{
EnvDTEHelper.ShowError("The version 4.0 Visual Studio DDEX provider is not installed, cannot add connection");
EnvDteHelper.ShowError("The version 4.0 Visual Studio DDEX provider is not installed, cannot add connection");
return;
}
try
Expand Down Expand Up @@ -137,7 +137,7 @@ public void AddCe40Database(object sender, ExecutedRoutedEventArgs e)
private bool TryGetInitialPath(SqlCeToolboxPackage package, out string path)
{
var dte = package.GetServiceHelper(typeof(DTE)) as DTE;
var dteHelper = new EnvDTEHelper();
var dteHelper = new EnvDteHelper();
try
{
path = dteHelper.GetInitialFolder(dte);
Expand Down Expand Up @@ -247,7 +247,7 @@ public void ScriptServerDatabase(object sender, ExecutedRoutedEventArgs e)
{
var generator = DataConnectionHelper.CreateGenerator(repository, fd.FileName, DatabaseType.SQLServer);
generator.ExcludeTables(ptd.Tables);
EnvDTEHelper.ShowMessage(generator.ScriptDatabaseToFile(scope));
EnvDteHelper.ShowMessage(generator.ScriptDatabaseToFile(scope));
DataConnectionHelper.LogUsage("DatabasesScriptServer");
}
catch (Exception ex)
Expand Down Expand Up @@ -431,7 +431,7 @@ void bw_DoWork(object sender, DoWorkEventArgs e)

public void DesignDatabase(object sender, ExecutedRoutedEventArgs e)
{
EnvDTEHelper.LaunchUrl("http://sqlcompact.dk/sqldesigner/");
EnvDteHelper.LaunchUrl("http://sqlcompact.dk/sqldesigner/");
}

public void GenerateServerDgmlFiles(object sender, ExecutedRoutedEventArgs e)
Expand Down Expand Up @@ -508,31 +508,31 @@ public void SyncFxGenerateLocalDatabaseCacheCode(object sender, ExecutedRoutedEv
var menuItem = sender as MenuItem;
if (menuItem == null) return;
var dte = _package.GetServiceHelper(typeof(DTE)) as DTE;
var dteH = new EnvDTEHelper();
var dteH = new EnvDteHelper();
var project = dteH.GetProject(dte);
if (project == null)
{
EnvDTEHelper.ShowError("Please select a project in Solution Explorer, where you want the SyncFx classes to be placed");
EnvDteHelper.ShowError("Please select a project in Solution Explorer, where you want the SyncFx classes to be placed");
return;
}
if (!dteH.AllowedProjectKinds.Contains(new Guid(project.Kind)))
{
EnvDTEHelper.ShowError("The selected project type does not support Sync Framework (please let me know if I am wrong)");
EnvDteHelper.ShowError("The selected project type does not support Sync Framework (please let me know if I am wrong)");
return;
}
if (project.CodeModel.Language != CodeModelLanguageConstants.vsCMLanguageCSharp)
{
EnvDTEHelper.ShowError("Unsupported code language, only C# is currently supported");
EnvDteHelper.ShowError("Unsupported code language, only C# is currently supported");
return;
}
if (project.Properties.Item("TargetFrameworkMoniker") == null)
{
EnvDTEHelper.ShowError("The selected project type does not support Sync Framework - missing TargetFrameworkMoniker");
EnvDteHelper.ShowError("The selected project type does not support Sync Framework - missing TargetFrameworkMoniker");
return;
}
if (!project.Properties.Item("TargetFrameworkMoniker").Value.ToString().Contains(".NETFramework"))
{
EnvDTEHelper.ShowError("The selected project type does not support .NET Desktop - wrong TargetFrameworkMoniker: " + project.Properties.Item("TargetFrameworkMoniker").Value);
EnvDteHelper.ShowError("The selected project type does not support .NET Desktop - wrong TargetFrameworkMoniker: " + project.Properties.Item("TargetFrameworkMoniker").Value);
return;
}

Expand Down Expand Up @@ -589,13 +589,13 @@ public void SyncFxGenerateLocalDatabaseCacheCode(object sender, ExecutedRoutedEv
project.ProjectItems.AddFromFile(fileName);
}
//Adding references - http://blogs.msdn.com/b/murat/archive/2008/07/30/envdte-adding-a-refernce-to-a-project.aspx
EnvDTEHelper.AddReference(project, "System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
EnvDteHelper.AddReference(project, "System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");

EnvDTEHelper.AddReference(project, "Microsoft.Synchronization, Version=2.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
EnvDTEHelper.AddReference(project, "Microsoft.Synchronization.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
EnvDTEHelper.AddReference(project, "Microsoft.Synchronization.Data.SqlServer, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
EnvDTEHelper.AddReference(project, "Microsoft.Synchronization.Data.SqlServerCe, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
EnvDTEHelper.ShowMessage("Scope: " + model + " code generated.");
EnvDteHelper.AddReference(project, "Microsoft.Synchronization, Version=2.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
EnvDteHelper.AddReference(project, "Microsoft.Synchronization.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
EnvDteHelper.AddReference(project, "Microsoft.Synchronization.Data.SqlServer, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
EnvDteHelper.AddReference(project, "Microsoft.Synchronization.Data.SqlServerCe, Version=3.1.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
EnvDteHelper.ShowMessage("Scope: " + model + " code generated.");
DataConnectionHelper.LogUsage("DatabasesSyncAddLocalDBCache");
}
}
Expand Down Expand Up @@ -636,12 +636,12 @@ public void CheckCeVersion(object sender, ExecutedRoutedEventArgs e)
default:
throw new ArgumentOutOfRangeException();
}
EnvDTEHelper.ShowMessage(string.Format("{0} is SQL Server Compact version {1}", Path.GetFileName(ofd.FileName), found));
EnvDteHelper.ShowMessage(string.Format("{0} is SQL Server Compact version {1}", Path.GetFileName(ofd.FileName), found));
DataConnectionHelper.LogUsage("DatabaseVersionDetect");
}
catch (Exception ex)
{
EnvDTEHelper.ShowError(ex.Message);
EnvDteHelper.ShowError(ex.Message);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/GUI/SqlCe35Toolbox/Commands/ScopesMenuCommandsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ScopesMenuCommandsHandler(ExplorerToolWindow parent)

public void DropScope(object sender, ExecutedRoutedEventArgs e)
{
if (EnvDTEHelper.ShowMessageBox("Do you really want to deprovision this scope?", Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON.OLEMSGBUTTON_YESNO, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON.OLEMSGICON_WARNING) == System.Windows.Forms.DialogResult.No)
if (EnvDteHelper.ShowMessageBox("Do you really want to deprovision this scope?", Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON.OLEMSGBUTTON_YESNO, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON.OLEMSGICON_WARNING) == System.Windows.Forms.DialogResult.No)
{
return;
}
Expand All @@ -29,7 +29,7 @@ public void DropScope(object sender, ExecutedRoutedEventArgs e)
try
{
SyncFxHelper.DeprovisionSqlCeScope(menuInfo.DatabaseInfo.ConnectionString, menuInfo.Name);
EnvDTEHelper.ShowMessage("Scope deprovisioned");
EnvDteHelper.ShowMessage("Scope deprovisioned");
if (_parentWindow != null && _parentWindow.Content != null)
{
ExplorerControl control = _parentWindow.Content as ExplorerControl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void NewSubscription(object sender, ExecutedRoutedEventArgs e)

public void DropSubscription(object sender, ExecutedRoutedEventArgs e)
{
if (EnvDTEHelper.ShowMessageBox("Do you really want to remove replication metadata from the SQL Server Compact database?", Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON.OLEMSGBUTTON_YESNO, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON.OLEMSGICON_WARNING) == System.Windows.Forms.DialogResult.No)
if (EnvDteHelper.ShowMessageBox("Do you really want to remove replication metadata from the SQL Server Compact database?", Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON.OLEMSGBUTTON_YESNO, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON.OLEMSGICON_WARNING) == System.Windows.Forms.DialogResult.No)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/GUI/SqlCe35Toolbox/Commands/ViewMenuCommandsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void ReportTableData(object sender, ExecutedRoutedEventArgs e)
}
catch (System.IO.FileNotFoundException)
{
EnvDTEHelper.ShowError("Microsoft Report Viewer 2010 not installed, please download and install to use this feature http://www.microsoft.com/en-us/download/details.aspx?id=6442");
EnvDteHelper.ShowError("Microsoft Report Viewer 2010 not installed, please download and install to use this feature http://www.microsoft.com/en-us/download/details.aspx?id=6442");
return;
}
catch (Exception ex)
Expand Down
6 changes: 3 additions & 3 deletions src/GUI/SqlCe35Toolbox/Dialogs/AboutDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
};
bw.RunWorkerAsync();

this.Background = Helpers.VSThemes.GetWindowBackground();
this.Background = Helpers.VsThemes.GetWindowBackground();
Version.Text = "Version " + Assembly.GetExecutingAssembly().GetName().Version;

txtStatus.Text = "SQL Server Compact 4.0 in GAC - ";
Expand Down Expand Up @@ -252,13 +252,13 @@ private void OKButton_Click(object sender, RoutedEventArgs e)

private void CodeplexLink_Click(object sender, RoutedEventArgs e)
{
Helpers.EnvDTEHelper.LaunchUrl("http://sqlcetoolbox.codeplex.com");
Helpers.EnvDteHelper.LaunchUrl("http://sqlcetoolbox.codeplex.com");
}

private void DDEXButton_Click(object sender, RoutedEventArgs e)
{
Helpers.DataConnectionHelper.RegisterDdexProviders(true);
EnvDTEHelper.ShowMessage("Providers registered, you may have to restart Visual Studio");
EnvDteHelper.ShowMessage("Providers registered, you may have to restart Visual Studio");
}

private void GalleryLink_Click(object sender, RoutedEventArgs e)
Expand Down
3 changes: 2 additions & 1 deletion src/GUI/SqlCe35Toolbox/Dialogs/CompareDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Windows;
using System.Collections.Generic;
using ErikEJ.SqlCeToolbox.Helpers;
using Microsoft.VisualStudio.PlatformUI;

namespace ErikEJ.SqlCeToolbox.Dialogs
Expand All @@ -23,7 +24,7 @@ public CompareDialog(string caption, Dictionary<string, DatabaseInfo> connection
{
Telemetry.TrackPageView(nameof(CompareDialog));
InitializeComponent();
this.Background = Helpers.VSThemes.GetWindowBackground();
this.Background = Helpers.VsThemes.GetWindowBackground();
this.lblCompare.Text = string.Format("Choose the target database to compare {0} (source) with:", caption);
if (!string.IsNullOrEmpty(tableName))
{
Expand Down
8 changes: 4 additions & 4 deletions src/GUI/SqlCe35Toolbox/Dialogs/ConnectionDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public ConnectionDialog()
Telemetry.TrackPageView(nameof(ConnectionDialog));
_loading = true;
InitializeComponent();
Background = VSThemes.GetWindowBackground();
Background = VsThemes.GetWindowBackground();
SaveButton.IsEnabled = false;
TestButton.IsEnabled = false;
_loading = false;
Expand Down Expand Up @@ -135,7 +135,7 @@ private bool TestConnection(bool showMessage)
{
if (showMessage)
{
EnvDTEHelper.ShowMessage("Connection OK!");
EnvDteHelper.ShowMessage("Connection OK!");
}
else
{
Expand All @@ -148,7 +148,7 @@ private bool TestConnection(bool showMessage)
{
if (ex.Message.Contains("Please upgrade using SqlCeEngine.Upgrade() method") && DbType == DatabaseType.SQLCE40)
{
if (EnvDTEHelper.ShowMessageBox("This database file is from an earlier version,\n\rwould you like to Upgrade it?\n\r(A copy of the original file will be named .bak)"
if (EnvDteHelper.ShowMessageBox("This database file is from an earlier version,\n\rwould you like to Upgrade it?\n\r(A copy of the original file will be named .bak)"
, Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON.OLEMSGBUTTON_YESNO
, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND
, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON.OLEMSGICON_WARNING) == System.Windows.Forms.DialogResult.Yes)
Expand All @@ -159,7 +159,7 @@ private bool TestConnection(bool showMessage)
{
if (System.IO.File.Exists(bakFile))
{
if (EnvDTEHelper.ShowMessageBox(string.Format("{0} already exists, do you wish to overwrite it?", bakFile)
if (EnvDteHelper.ShowMessageBox(string.Format("{0} already exists, do you wish to overwrite it?", bakFile)
, Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON.OLEMSGBUTTON_YESNO
, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND
, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON.OLEMSGICON_WARNING) == System.Windows.Forms.DialogResult.Yes)
Expand Down
Loading