Skip to content

Commit

Permalink
Added Preferences page back into VSIX, attribute on package. Updated …
Browse files Browse the repository at this point in the history
…expression editor, and added preferences for font and colours, on expression editor as requested.
  • Loading branch information
DarrenSQLIS_cp authored and DarrenSQLIS_cp committed Jan 5, 2017
1 parent 685bd59 commit b4edf91
Show file tree
Hide file tree
Showing 13 changed files with 387 additions and 103 deletions.
2 changes: 1 addition & 1 deletion BidsHelperPackage.cs
Expand Up @@ -51,7 +51,7 @@ public enum enumIDEMode
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
[ProvideMenuResource("Menus.ctmenu", 1)]
[ProvideOptionPage(typeof(BIDSHelperOptionsFeatures), "BIDS Helper", "Features", 0, 0, true)]
//[ProvideOptionPage(typeof(BIDSHelperOptionsPreferences), "BIDS Helper", "Preferences", 0, 0, true)]
[ProvideOptionPage(typeof(BIDSHelperPreferencesDialogPage), "BIDS Helper", "Preferences", 0, 0, true)]
[ProvideOptionPage(typeof(BIDSHelperOptionsVersion), "BIDS Helper", "Version", 0, 0, true)]
public sealed class BIDSHelperPackage : Package, IVsDebuggerEvents
{
Expand Down
6 changes: 0 additions & 6 deletions Core/Options/BIDSHelperOptionsPage.cs
Expand Up @@ -16,9 +16,6 @@ public partial class BIDSHelperOptionsPage : UserControl //, EnvDTE.IDTToolsOpti
/// </summary>
private static string DefaultMessageBoxCaption = "BIDS Helper Options";




/// <summary>
/// Initializes a new instance of the <see cref="BIDSHelperOptionsPage"/> class.
/// </summary>
Expand All @@ -27,12 +24,9 @@ public BIDSHelperOptionsPage()
InitializeComponent();
}



/// <summary>
/// Called after the dialog has been created.
/// </summary>
/// <param name="DTEObject">The DTE object.</param>
public void Initialize()
{
// Enumerate plug-ins and create a dynamic properties
Expand Down
Expand Up @@ -13,18 +13,17 @@ namespace BIDSHelper.Core
{
[ClassInterface(ClassInterfaceType.AutoDual)]
[CLSCompliant(false), ComVisible(true)]
//[Guid(BIDSHelperOptionsVersion.OptionsGuidString)]
public class BIDSHelperOptionsPreferences : DialogPage
[Guid("5F8DEE5F-2790-4EE2-B709-A3F2D11E2042")]
public class BIDSHelperPreferencesDialogPage : DialogPage
{
// public const string OptionsGuidString = "9EBCE16B-26C2-4A22-A409-9752750A16AE";
BIDSHelperPreferencesPage page = null;
private BIDSHelperPreferencesPage page = null;

protected override IWin32Window Window
{
get
{
page = new BIDSHelperPreferencesPage();
//page.optionsPage = this;
page.OptionsPage = this;
page.Initialize();
return page;
}
Expand Down
230 changes: 181 additions & 49 deletions Core/Options/BIDSHelperPreferencesPage.Designer.cs

Large diffs are not rendered by default.

91 changes: 57 additions & 34 deletions Core/Options/BIDSHelperPreferencesPage.cs
@@ -1,33 +1,31 @@
namespace BIDSHelper.Core
{
using BIDSHelper.SSIS;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using EnvDTE;
using BIDSHelper.SSIS;


public partial class BIDSHelperPreferencesPage : UserControl
{
public BIDSHelperPreferencesPage()
{
InitializeComponent();
}

#region IDTToolsOptionsPage Members
public BIDSHelperPreferencesDialogPage OptionsPage
{
get;
set;
}

public void Initialize()
{
this.Width = 395; //392
this.Height = 290;

// Smart Diff
lblTFS.Text = "Visual Studio Built-in";
lblVSS.Text = string.Empty;


if (string.IsNullOrEmpty(SmartDiffPlugin.CustomDiffViewer))
{
radSmartDiffDefault.Checked = true;
Expand All @@ -38,19 +36,28 @@ public void Initialize()
radSmartDiffCustom.Checked = true;
txtSmartDiffCustom.Text = SmartDiffPlugin.CustomDiffViewer;
}

FixSmartDiffCustomEnabled();

// Expression & Configuration highlighter
btnExpressionColor.BackColor = ExpressionHighlighterPlugin.ExpressionColor;
btnConfigurationColor.BackColor = ExpressionHighlighterPlugin.ConfigurationColor;

// Measure group free space
txtFreeSpaceFactor.Text = MeasureGroupHealthCheckPlugin.FreeSpaceFactor.ToString();
}

// Expression editor, font and colours
buttonExpressionFontSample.Font = ExpressionListPlugin.ExpressionFont;
buttonExpressionFontSample.ForeColor = ExpressionListPlugin.ExpressionColor;
buttonResultFontSample.Font = ExpressionListPlugin.ResultFont;
buttonResultFontSample.ForeColor = ExpressionListPlugin.ResultColor;
}

public void Apply()
{
try
{
// Smart Diff
if (radSmartDiffCustom.Checked)
{
SmartDiffPlugin.CustomDiffViewer = txtSmartDiffCustom.Text;
Expand All @@ -60,36 +67,29 @@ public void Apply()
SmartDiffPlugin.CustomDiffViewer = null;
}

// Expression & Configuration highlighter
ExpressionHighlighterPlugin.ExpressionColor = btnExpressionColor.BackColor;
ExpressionHighlighterPlugin.ConfigurationColor = btnConfigurationColor.BackColor;

// Measure group free space
int iFreeSpaceFactor;
if (int.TryParse(txtFreeSpaceFactor.Text, out iFreeSpaceFactor))
{
MeasureGroupHealthCheckPlugin.FreeSpaceFactor = iFreeSpaceFactor;
//BIDSHelperPluginBase pu = null;
////foreach (object itm in lstPlugins.Items) //(BIDSHelperPluginReference puRef in Connect.Plugins.Values)
//for (int i = 0;i<lstPlugins.Items.Count;i++)
//{
// pu = (BIDSHelperPluginBase)lstPlugins.Items[i];
// if (pu.Enabled != lstPlugins.GetItemChecked(i))
// {
// pu.Enabled = lstPlugins.GetItemChecked(i);
// }
//}
}

// Expression editor, font and colours
ExpressionListPlugin.ExpressionFont = buttonExpressionFontSample.Font;
ExpressionListPlugin.ExpressionColor = buttonExpressionFontSample.ForeColor;
ExpressionListPlugin.ResultFont = buttonResultFontSample.Font;
ExpressionListPlugin.ResultColor = buttonResultFontSample.ForeColor;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
}
}

#endregion

private void BIDSHelperPreferencesPage_Load(object sender, EventArgs e)
{

}

private void radSmartDiffDefault_CheckedChanged(object sender, EventArgs e)
{
FixSmartDiffCustomEnabled();
Expand All @@ -107,19 +107,19 @@ private void radSmartDiffCustom_CheckedChanged(object sender, EventArgs e)

private void btnExpressionColor_Click(object sender, EventArgs e)
{
colorDialog1.Color = btnExpressionColor.BackColor;
if (colorDialog1.ShowDialog() == DialogResult.OK)
colorDialog.Color = btnExpressionColor.BackColor;
if (colorDialog.ShowDialog() == DialogResult.OK)
{
btnExpressionColor.BackColor = colorDialog1.Color;
btnExpressionColor.BackColor = colorDialog.Color;
}
}

private void btnConfigurationColor_Click(object sender, EventArgs e)
{
colorDialog1.Color = btnConfigurationColor.BackColor;
if (colorDialog1.ShowDialog() == DialogResult.OK)
colorDialog.Color = btnConfigurationColor.BackColor;
if (colorDialog.ShowDialog() == DialogResult.OK)
{
btnConfigurationColor.BackColor = colorDialog1.Color;
btnConfigurationColor.BackColor = colorDialog.Color;
}
}

Expand All @@ -138,6 +138,29 @@ private void txtFreeSpaceFactor_Leave(object sender, EventArgs e)
if (!int.TryParse(txtFreeSpaceFactor.Text, out i))
txtFreeSpaceFactor.Text = MeasureGroupHealthCheckPlugin.FreeSpaceFactor.ToString();
}

private void buttonExpressionFont_Click(object sender, EventArgs e)
{
fontDialog.Font = buttonExpressionFontSample.Font;
fontDialog.Color = buttonExpressionFontSample.ForeColor;
if (fontDialog.ShowDialog() == DialogResult.OK)
{
buttonExpressionFontSample.Font = fontDialog.Font;
buttonExpressionFontSample.ForeColor = fontDialog.Color;
}
}

private void buttonResultFont_Click(object sender, EventArgs e)
{
fontDialog.Font = buttonResultFontSample.Font;
fontDialog.Color = buttonResultFontSample.ForeColor;
if (fontDialog.ShowDialog() == DialogResult.OK)
{
buttonResultFontSample.Font = fontDialog.Font;
buttonResultFontSample.ForeColor = fontDialog.Color;
}

}
}

}
9 changes: 6 additions & 3 deletions Core/Options/BIDSHelperPreferencesPage.resx
Expand Up @@ -112,12 +112,15 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="colorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="fontDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>131, 17</value>
</metadata>
</root>
Binary file modified DLLs/SQL2012/ExpressionEditor.dll
Binary file not shown.
Binary file modified DLLs/SQL2014/ExpressionEditor.dll
Binary file not shown.
Binary file modified DLLs/SQL2016/ExpressionEditor.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion SQL2012_BidsHelper-VSIX.csproj
Expand Up @@ -85,7 +85,7 @@
<Compile Include="Core\Logger\LogLevels.cs" />
<Compile Include="Core\Logger\NullLogger.cs" />
<Compile Include="Core\Logger\OutputLogger.cs" />
<Compile Include="Core\Options\BIDSHelperOptionsPreferences.cs">
<Compile Include="Core\Options\BIDSHelperPreferencesDialogPage.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Core\Options\BIDSHelperOptionsVersion.cs">
Expand Down
2 changes: 1 addition & 1 deletion SQL2016_BidsHelper.csproj
Expand Up @@ -107,7 +107,7 @@
<Compile Include="Core\Logger\LogLevels.cs" />
<Compile Include="Core\Logger\NullLogger.cs" />
<Compile Include="Core\Logger\OutputLogger.cs" />
<Compile Include="Core\Options\BIDSHelperOptionsPreferences.cs">
<Compile Include="Core\Options\BIDSHelperPreferencesDialogPage.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Core\Options\BIDSHelperOptionsVersion.cs">
Expand Down

0 comments on commit b4edf91

Please sign in to comment.