AppName fix and docs link

This commit is contained in:
Christian Wade 2019-11-27 14:09:36 -08:00
parent 6e01a28d10
commit 095409165e
20 changed files with 146 additions and 120 deletions

View File

@ -32,6 +32,7 @@
this.logoPictureBox = new System.Windows.Forms.PictureBox();
this.lblProductVersion = new System.Windows.Forms.Label();
this.lblProductName = new System.Windows.Forms.Label();
this.linkDocumentation = new System.Windows.Forms.LinkLabel();
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit();
this.SuspendLayout();
//
@ -39,7 +40,7 @@
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.okButton.Location = new System.Drawing.Point(292, 102);
this.okButton.Location = new System.Drawing.Point(292, 109);
this.okButton.Margin = new System.Windows.Forms.Padding(4);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(100, 31);
@ -75,18 +76,30 @@
this.lblProductName.TabIndex = 27;
this.lblProductName.Text = "label1";
//
// linkDocumentation
//
this.linkDocumentation.AutoSize = true;
this.linkDocumentation.Location = new System.Drawing.Point(117, 78);
this.linkDocumentation.Name = "linkDocumentation";
this.linkDocumentation.Size = new System.Drawing.Size(98, 16);
this.linkDocumentation.TabIndex = 28;
this.linkDocumentation.TabStop = true;
this.linkDocumentation.Text = "Documentation";
this.linkDocumentation.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkDocumentation_LinkClicked);
//
// About
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(408, 148);
this.ClientSize = new System.Drawing.Size(408, 155);
this.Controls.Add(this.linkDocumentation);
this.Controls.Add(this.lblProductName);
this.Controls.Add(this.lblProductVersion);
this.Controls.Add(this.logoPictureBox);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "About";
@ -106,5 +119,6 @@
private System.Windows.Forms.PictureBox logoPictureBox;
private System.Windows.Forms.Label lblProductVersion;
private System.Windows.Forms.Label lblProductName;
private System.Windows.Forms.LinkLabel linkDocumentation;
}
}

View File

@ -14,9 +14,16 @@ namespace AlmToolkit
public About()
{
InitializeComponent();
this.Text = "ALM Toolkit";
this.Text = Utils.AssemblyProduct;
this.lblProductName.Text = this.Text;
this.lblProductVersion.Text = String.Format("Version {0}", AssemblyVersion);
this.linkDocumentation.LinkVisited = false;
}
private void linkDocumentation_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
this.linkDocumentation.LinkVisited = true;
System.Diagnostics.Process.Start("https://github.com/microsoft/Analysis-Services/blob/master/BismNormalizer/Model%20Comparison%20and%20Merging%20for%20Analysis%20Services.pdf");
}
#region Assembly Attribute Accessors
@ -59,44 +66,7 @@ namespace AlmToolkit
}
}
public string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
public string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
public string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}
#endregion
}
}

View File

@ -97,6 +97,7 @@
<Compile Include="Model\ComparisonNode.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" />
<Compile Include="WarningListForm.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -317,7 +317,7 @@
this.btnHelp.LargeImage = ((System.Drawing.Image)(resources.GetObject("btnHelp.LargeImage")));
this.btnHelp.Name = "btnHelp";
this.btnHelp.SmallImage = ((System.Drawing.Image)(resources.GetObject("btnHelp.SmallImage")));
this.btnHelp.Text = "About";
this.btnHelp.Text = "Info";
this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
//
// pnlRibbon
@ -495,7 +495,7 @@
this.txtTarget.Location = new System.Drawing.Point(60, 7);
this.txtTarget.Margin = new System.Windows.Forms.Padding(4);
this.txtTarget.Name = "txtTarget";
this.txtTarget.Size = new System.Drawing.Size(438, 22);
this.txtTarget.Size = new System.Drawing.Size(437, 22);
this.txtTarget.TabIndex = 42;
//
// label2

View File

@ -26,7 +26,6 @@ namespace AlmToolkit
private Comparison _comparison;
private ComparisonJSInteraction _comparisonInter; // CEFSharp Interface to connect to Angular Tree Control
private ChromiumWebBrowser chromeBrowser;
private const string _appName = "ALM Toolkit";
private CompareState _compareState = CompareState.NotCompared;
private string _fileName = "";
private bool _unsaved = false;
@ -80,7 +79,7 @@ namespace AlmToolkit
private void ComparisonForm_Load(object sender, EventArgs e)
{
_comparisonInfo = new ComparisonInfo();
_comparisonInfo.AppName = _appName;
_comparisonInfo.AppName = Utils.AssemblyProduct;
GetFromAutoCompleteSource();
GetFromAutoCompleteTarget();
@ -227,7 +226,7 @@ namespace AlmToolkit
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(exc.Message, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
SetNotComparedState();
}
finally
@ -399,12 +398,12 @@ namespace AlmToolkit
{
File.WriteAllText(saveFile.FileName, _comparison.ScriptDatabase());
toolStripStatusLabel1.Text = "ALM Toolkit - finished generating script";
MessageBox.Show("Created script\n" + saveFile.FileName, _appName, MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("Created script\n" + saveFile.FileName, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(exc.Message, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
SetNotComparedState();
}
finally
@ -452,7 +451,7 @@ namespace AlmToolkit
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(exc.Message, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
@ -592,7 +591,7 @@ namespace AlmToolkit
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(exc.Message, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
SetNotComparedState();
}
finally
@ -604,7 +603,7 @@ namespace AlmToolkit
private void btnUpdate_Click(object sender, EventArgs e)
{
if (MessageBox.Show($"Are you sure you want to update target {(_comparisonInfo.ConnectionInfoTarget.UseProject ? "project" : "database")}?", _appName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
if (MessageBox.Show($"Are you sure you want to update target {(_comparisonInfo.ConnectionInfoTarget.UseProject ? "project" : "database")}?", Utils.AssemblyProduct, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
{
return;
}
@ -625,7 +624,7 @@ namespace AlmToolkit
toolStripStatusLabel1.Text = "ALM Toolkit - finished committing changes";
SetNotComparedState();
if (update && MessageBox.Show($"Updated {(_comparisonInfo.ConnectionInfoTarget.UseProject ? "project " + _comparisonInfo.ConnectionInfoTarget.ProjectName : "database " + _comparisonInfo.ConnectionInfoTarget.DatabaseName)}.\n\nDo you want to refresh the comparison?", _appName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (update && MessageBox.Show($"Updated {(_comparisonInfo.ConnectionInfoTarget.UseProject ? "project " + _comparisonInfo.ConnectionInfoTarget.ProjectName : "database " + _comparisonInfo.ConnectionInfoTarget.DatabaseName)}.\n\nDo you want to refresh the comparison?", Utils.AssemblyProduct, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
this.CompareTabularModels();
}
@ -637,7 +636,7 @@ namespace AlmToolkit
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(exc.Message, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
SetNotComparedState();
}
finally
@ -707,11 +706,11 @@ namespace AlmToolkit
if (String.IsNullOrEmpty(_fileName))
{
this.Text = _appName;
this.Text = Utils.AssemblyProduct;
}
else
{
this.Text = _appName + " - " + Path.GetFileName(_fileName);
this.Text = Utils.AssemblyProduct + " - " + Path.GetFileName(_fileName);
if (unsaved)
{
this.Text += " *";
@ -728,14 +727,14 @@ namespace AlmToolkit
//Blank file not saved to yet
return;
}
_comparisonInfo = ComparisonInfo.DeserializeBsmnFile(fileName, _appName);
_comparisonInfo = ComparisonInfo.DeserializeBsmnFile(fileName, Utils.AssemblyProduct);
_fileName = fileName;
SetFileNameTitle(false);
PopulateSourceTargetTextBoxes();
}
catch (Exception exc)
{
MessageBox.Show($"Error loading file {fileName}\n{exc.Message}\n\nPlease save over this file with a new version.", _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show($"Error loading file {fileName}\n{exc.Message}\n\nPlease save over this file with a new version.", Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
@ -752,7 +751,7 @@ namespace AlmToolkit
}
catch (Exception exc)
{
MessageBox.Show($"Error saving file {fileName}\n{exc.Message}", _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show($"Error saving file {fileName}\n{exc.Message}", Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
@ -777,7 +776,7 @@ namespace AlmToolkit
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(exc.Message, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
SetNotComparedState();
}
}
@ -813,7 +812,7 @@ namespace AlmToolkit
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(exc.Message, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
SetNotComparedState();
}
@ -827,7 +826,7 @@ namespace AlmToolkit
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, _appName, MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show(exc.Message, Utils.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Error);
SetNotComparedState();
}
}
@ -872,7 +871,7 @@ namespace AlmToolkit
private DialogResult SaveChanges()
{
DialogResult result = MessageBox.Show("Do you want to save changes?", _appName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
DialogResult result = MessageBox.Show("Do you want to save changes?", Utils.AssemblyProduct, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
switch (result)
{
case DialogResult.Yes:
@ -897,7 +896,7 @@ namespace AlmToolkit
private float _dpiScaleFactor = 1;
private void Rescale()
{
float fudgedDpiScaleFactor = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
float fudgedDpiScaleFactor = _dpiScaleFactor * BismNormalizer.TabularCompare.UI.Utils.PrimaryFudgeFactor;
//pnlRibbon.Height = Convert.ToInt32(Convert.ToDouble(ribbonMain.Height) * HighDPIUtils.SecondaryFudgeFactor * 0.93);
ribbonMain.Height = pnlRibbon.Height;
@ -905,7 +904,7 @@ namespace AlmToolkit
txtSource.Width = Convert.ToInt32(Convert.ToDouble(Convert.ToDouble(spltSourceTarget.Width) * 0.5) * 0.9);
txtTarget.Width = Convert.ToInt32(Convert.ToDouble(Convert.ToDouble(spltSourceTarget.Width) * 0.5) * 0.9);
this._dpiScaleFactor = HighDPIUtils.GetDpiFactor();
this._dpiScaleFactor = BismNormalizer.TabularCompare.UI.Utils.GetDpiFactor();
if (this._dpiScaleFactor == 1) return;
this.Scale(new SizeF(fudgedDpiScaleFactor, fudgedDpiScaleFactor));

View File

@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AlmToolkit")]
[assembly: AssemblyProduct("ALM Toolkit")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace AlmToolkit
{
public static class Utils
{
public static string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
}
}

View File

@ -248,7 +248,7 @@
<Compile Include="TabularCompare\UI\Connections.Designer.cs">
<DependentUpon>Connections.cs</DependentUpon>
</Compile>
<Compile Include="TabularCompare\UI\HighDpiUtils.cs" />
<Compile Include="TabularCompare\UI\Utils.cs" />
<Compile Include="TabularCompare\UI\BlobCredentials.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -10,8 +10,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("BismNormalizer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("BismNormalizer")]
[assembly: AssemblyProduct("BismNormalizer")]
[assembly: AssemblyCompany("BISM Normalizer")]
[assembly: AssemblyProduct("BISM Normalizer")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@ -1,4 +1,5 @@
using EnvDTE;
using BismNormalizer.TabularCompare.UI;
using EnvDTE;
using System;
using System.Collections.Generic;
using System.IO;
@ -24,7 +25,7 @@ namespace BismNormalizer.TabularCompare
private bool _targetDirectQuery;
private bool _promptForDatabaseProcessing;
private bool _interactive = true;
private string _appName = "<AppName>";
private string _appName = Utils.AssemblyProduct;
private bool _credsProvided = false;
private string _sourceUsername;
private string _sourcePassword;

View File

@ -49,18 +49,18 @@ namespace BismNormalizer.TabularCompare.UI
if (_dpiScaleFactor > 1)
{
//DPI
float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
float dpiScaleFactorFudged = _dpiScaleFactor * Utils.PrimaryFudgeFactor;
if (Settings.Default.OptionHighDpiLocal)
{
this.Scale(new SizeF(dpiScaleFactorFudged * 0.44f, dpiScaleFactorFudged * 0.38f));
this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * 0.8f);
foreach (Control control in HighDPIUtils.GetChildInControl(this))
foreach (Control control in Utils.GetChildInControl(this))
{
if (control is Button)
{
control.Font = new Font(control.Font.FontFamily,
control.Font.Size * dpiScaleFactorFudged * 1.1f * HighDPIUtils.PrimaryFudgeFactor,
control.Font.Size * dpiScaleFactorFudged * 1.1f * Utils.PrimaryFudgeFactor,
control.Font.Style);
control.Left = control.Left - 90;
if (control.Name == "btnCancel")
@ -72,7 +72,7 @@ namespace BismNormalizer.TabularCompare.UI
{
control.Font = new Font(control.Font.FontFamily,
//cbw todo check * 1.4f works on remote desktop setting
control.Font.Size * dpiScaleFactorFudged * 1.4f * HighDPIUtils.PrimaryFudgeFactor,
control.Font.Size * dpiScaleFactorFudged * 1.4f * Utils.PrimaryFudgeFactor,
control.Font.Style);
}
@ -86,10 +86,10 @@ namespace BismNormalizer.TabularCompare.UI
{
this.Scale(new SizeF(dpiScaleFactorFudged * 0.44f, dpiScaleFactorFudged * 0.38f));
this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * 0.6f);
foreach (Control control in HighDPIUtils.GetChildInControl(this))
foreach (Control control in Utils.GetChildInControl(this))
{
control.Font = new Font(control.Font.FontFamily,
control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.PrimaryFudgeFactor,
control.Font.Size * dpiScaleFactorFudged * Utils.PrimaryFudgeFactor,
control.Font.Style);
}
}

View File

@ -65,9 +65,9 @@ namespace BismNormalizer.TabularCompare.UI
private float _dpiScaleFactor = 1;
private void Rescale()
{
this._dpiScaleFactor = HighDPIUtils.GetDpiFactor();
this._dpiScaleFactor = Utils.GetDpiFactor();
if (this._dpiScaleFactor == 1) return;
float fudgedDpiScaleFactor = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
float fudgedDpiScaleFactor = _dpiScaleFactor * Utils.PrimaryFudgeFactor;
this.Scale(new SizeF(fudgedDpiScaleFactor, fudgedDpiScaleFactor));
@ -106,7 +106,7 @@ namespace BismNormalizer.TabularCompare.UI
txtTargetObjectDefinition.Width = scObjectDefinitions.Panel2.Width;
txtTargetObjectDefinition.Height = Convert.ToInt32(Convert.ToDouble(scObjectDefinitions.Panel2.Height) * 0.86);
if (_dpiScaleFactor > 1) HighDPIUtils.ScaleStreamedImageListByDpi(TreeGridImageList);
if (_dpiScaleFactor > 1) Utils.ScaleStreamedImageListByDpi(TreeGridImageList);
treeGridComparisonResults.ResetColumnWidths(fudgedDpiScaleFactor);
if (_comparison != null && _bismNormalizerPackage.ValidationOutput != null)

View File

@ -26,17 +26,17 @@ namespace BismNormalizer.TabularCompare.UI
if (_dpiScaleFactor > 1)
{
//DPI
float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
float dpiScaleFactorFudged = _dpiScaleFactor * Utils.PrimaryFudgeFactor;
float fudgeFactorWidth = 0.95f;
this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : HighDPIUtils.SecondaryFudgeFactor), dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor));
this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : Utils.SecondaryFudgeFactor), dpiScaleFactorFudged * Utils.SecondaryFudgeFactor));
this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * fudgeFactorWidth);
foreach (Control control in HighDPIUtils.GetChildInControl(this)) //.OfType<Button>())
foreach (Control control in Utils.GetChildInControl(this)) //.OfType<Button>())
{
if (control is GroupBox || control is Button)
{
control.Font = new Font(control.Font.FontFamily,
control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor,
control.Font.Size * dpiScaleFactorFudged * Utils.SecondaryFudgeFactor,
control.Font.Style);
}
if (control is GroupBox || control.Name == "btnSwitch")

View File

@ -26,17 +26,17 @@ namespace BismNormalizer.TabularCompare.UI
if (_dpiScaleFactor > 1)
{
//DPI
float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
float dpiScaleFactorFudged = _dpiScaleFactor * Utils.PrimaryFudgeFactor;
float fudgeFactorWidth = 0.95f;
this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : HighDPIUtils.SecondaryFudgeFactor), dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor));
this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : Utils.SecondaryFudgeFactor), dpiScaleFactorFudged * Utils.SecondaryFudgeFactor));
this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * fudgeFactorWidth);
foreach (Control control in HighDPIUtils.GetChildInControl(this)) //.OfType<Button>())
foreach (Control control in Utils.GetChildInControl(this)) //.OfType<Button>())
{
if (control is GroupBox || control is Button)
{
control.Font = new Font(control.Font.FontFamily,
control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor,
control.Font.Size * dpiScaleFactorFudged * Utils.SecondaryFudgeFactor,
control.Font.Style);
}
if (control is GroupBox || control.Name == "btnSwitch")

View File

@ -27,15 +27,15 @@ namespace BismNormalizer.TabularCompare.UI
//DPI
if (_dpiScaleFactor > 1)
{
float fudgedDpiScaleFactor = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
float fudgedDpiScaleFactor = _dpiScaleFactor * Utils.PrimaryFudgeFactor;
this.Scale(new SizeF(fudgedDpiScaleFactor, fudgedDpiScaleFactor));
picStatus.Scale(new SizeF(fudgedDpiScaleFactor, fudgedDpiScaleFactor));
gridProcessing.Scale(new SizeF(fudgedDpiScaleFactor * HighDPIUtils.SecondaryFudgeFactor, fudgedDpiScaleFactor * HighDPIUtils.SecondaryFudgeFactor));
gridProcessing.Scale(new SizeF(fudgedDpiScaleFactor * Utils.SecondaryFudgeFactor, fudgedDpiScaleFactor * Utils.SecondaryFudgeFactor));
this.Font = new Font(this.Font.FontFamily,
this.Font.Size * fudgedDpiScaleFactor,
this.Font.Style);
foreach (Control control in HighDPIUtils.GetChildInControl(this)) //.OfType<Button>())
foreach (Control control in Utils.GetChildInControl(this)) //.OfType<Button>())
{
if (control is DataGridView || control is Button)
{
@ -48,7 +48,7 @@ namespace BismNormalizer.TabularCompare.UI
{
col.Width = Convert.ToInt32(col.Width * fudgedDpiScaleFactor * 1.5f);
}
HighDPIUtils.ScaleStreamedImageListByDpi(DeployImageList);
Utils.ScaleStreamedImageListByDpi(DeployImageList);
}
this.KeyPreview = true;
@ -101,13 +101,13 @@ namespace BismNormalizer.TabularCompare.UI
switch (e.DeploymentStatus)
{
case DeploymentStatus.Success:
picStatus.Image = (_dpiScaleFactor > 1 ? HighDPIUtils.ScaleByDpi(Resources.ProgressSuccess) : Resources.ProgressSuccess);
picStatus.Image = (_dpiScaleFactor > 1 ? Utils.ScaleByDpi(Resources.ProgressSuccess) : Resources.ProgressSuccess);
lblStatus.Text = "Success";
_deployStatus = DeploymentStatus.Success;
break;
case DeploymentStatus.Cancel:
picStatus.Image = (_dpiScaleFactor > 1 ? HighDPIUtils.ScaleByDpi(Resources.ProgressCancel) : Resources.ProgressCancel);
picStatus.Image = (_dpiScaleFactor > 1 ? Utils.ScaleByDpi(Resources.ProgressCancel) : Resources.ProgressCancel);
lblStatus.Text = "Cancelled";
_deployStatus = DeploymentStatus.Cancel;
break;
@ -136,7 +136,7 @@ namespace BismNormalizer.TabularCompare.UI
}
else
{
picStatus.Image = (_dpiScaleFactor > 1 ? HighDPIUtils.ScaleByDpi(Resources.ProgressError) : Resources.ProgressError);
picStatus.Image = (_dpiScaleFactor > 1 ? Utils.ScaleByDpi(Resources.ProgressError) : Resources.ProgressError);
lblStatus.Text = "Error";
_deployStatus = DeploymentStatus.Error;

View File

@ -55,26 +55,26 @@ namespace BismNormalizer.TabularCompare.UI
if (_dpiScaleFactor > 1)
{
//DPI
float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
float dpiScaleFactorFudged = _dpiScaleFactor * Utils.PrimaryFudgeFactor;
if (Settings.Default.OptionHighDpiLocal)
{
this.Scale(new SizeF(dpiScaleFactorFudged * 0.44f, dpiScaleFactorFudged * 0.35f));
this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * 0.6f);
foreach (Control control in HighDPIUtils.GetChildInControl(this))
foreach (Control control in Utils.GetChildInControl(this))
{
if (control is Button)
{
control.Font = new Font(control.Font.FontFamily,
control.Font.Size * dpiScaleFactorFudged * 1.1f * HighDPIUtils.PrimaryFudgeFactor,
control.Font.Size * dpiScaleFactorFudged * 1.1f * Utils.PrimaryFudgeFactor,
control.Font.Style);
}
else
{
control.Font = new Font(control.Font.FontFamily,
//cbw todo check * 1.4f works on remote desktop setting
control.Font.Size * dpiScaleFactorFudged * 1.4f * HighDPIUtils.PrimaryFudgeFactor,
control.Font.Size * dpiScaleFactorFudged * 1.4f * Utils.PrimaryFudgeFactor,
control.Font.Style);
}
}
@ -83,10 +83,10 @@ namespace BismNormalizer.TabularCompare.UI
{
this.Scale(new SizeF(dpiScaleFactorFudged * 0.44f, dpiScaleFactorFudged * 0.38f));
this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * 0.6f);
foreach (Control control in HighDPIUtils.GetChildInControl(this))
foreach (Control control in Utils.GetChildInControl(this))
{
control.Font = new Font(control.Font.FontFamily,
control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.PrimaryFudgeFactor,
control.Font.Size * dpiScaleFactorFudged * Utils.PrimaryFudgeFactor,
control.Font.Style);
}
}

View File

@ -24,16 +24,16 @@ namespace BismNormalizer.TabularCompare.UI
{
if (_dpiScaleFactor > 1)
{
float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
float dpiScaleFactorFudged = _dpiScaleFactor * Utils.PrimaryFudgeFactor;
//DPI
this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : HighDPIUtils.SecondaryFudgeFactor), dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor));
this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : Utils.SecondaryFudgeFactor), dpiScaleFactorFudged * Utils.SecondaryFudgeFactor));
this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged);
foreach (Control control in HighDPIUtils.GetChildInControl(this)) //.OfType<Button>())
foreach (Control control in Utils.GetChildInControl(this)) //.OfType<Button>())
{
if (control is GroupBox || control is Button)
{
control.Font = new Font(control.Font.FontFamily,
control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor,
control.Font.Size * dpiScaleFactorFudged * Utils.SecondaryFudgeFactor,
control.Font.Style);
}
}
@ -101,14 +101,14 @@ namespace BismNormalizer.TabularCompare.UI
{
if (e.Control && e.Shift && e.KeyCode == Keys.D)
{
if (MessageBox.Show($"Are you sure you want to toggle 192 Device DPI from optimized for {(Settings.Default.OptionHighDpiLocal ? "local" : "Remote Desktop")} to {(Settings.Default.OptionHighDpiLocal ? "Remote Desktop" : "local")}?", "ALM Toolkit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (MessageBox.Show($"Are you sure you want to toggle 192 Device DPI from optimized for {(Settings.Default.OptionHighDpiLocal ? "local" : "Remote Desktop")} to {(Settings.Default.OptionHighDpiLocal ? "Remote Desktop" : "local")}?", Utils.AssemblyProduct, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Settings.Default.OptionHighDpiLocal = !Settings.Default.OptionHighDpiLocal;
}
}
else if (e.Control && e.Shift && e.KeyCode == Keys.C)
{
if (MessageBox.Show($"Are you sure you want to {(Settings.Default.OptionCompositeModelsOverride ? "*disallow*" : "*allow*")} composite model comparisons on Analysis Services?", "ALM Toolkit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (MessageBox.Show($"Are you sure you want to {(Settings.Default.OptionCompositeModelsOverride ? "*disallow*" : "*allow*")} composite model comparisons on Analysis Services?", Utils.AssemblyProduct, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Settings.Default.OptionCompositeModelsOverride = !Settings.Default.OptionCompositeModelsOverride;
}

View File

@ -37,11 +37,11 @@ namespace BismNormalizer.TabularCompare.UI
if (_dpiScaleFactor > 1)
{
//DPI
_dpiScaleFactor = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
float fudgeFactor = HighDPIUtils.SecondaryFudgeFactor;
_dpiScaleFactor = _dpiScaleFactor * Utils.PrimaryFudgeFactor;
float fudgeFactor = Utils.SecondaryFudgeFactor;
this.Scale(new SizeF(_dpiScaleFactor, _dpiScaleFactor * fudgeFactor));
this.Width = Convert.ToInt32(this.Width * _dpiScaleFactor);
foreach (Control control in HighDPIUtils.GetChildInControl(this))
foreach (Control control in Utils.GetChildInControl(this))
{
control.Font = new Font(control.Font.FontFamily,
control.Font.Size * _dpiScaleFactor * fudgeFactor,

View File

@ -133,7 +133,7 @@ namespace BismNormalizer.TabularCompare.UI
// paint the cell normally
base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
float dpiFactor = HighDPIUtils.GetDpiFactor();
float dpiFactor = Utils.GetDpiFactor();
int scaleBack = (dpiFactor > 1 ? Convert.ToInt32(dpiFactor) : 0);
// TO_DO: Indent width needs to take image size into account

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
@ -9,8 +10,21 @@ namespace BismNormalizer.TabularCompare.UI
/// <summary>
/// Utilities class for handling high DPI scenarios
/// </summary>
public class HighDPIUtils
public class Utils
{
public static string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
// Since the move to .Net4.5.2 we should use this const to scale context menus or they will be scaled twice
public static Size ContextMenuDefaultImageScalingSize = new Size(16, 16);
@ -29,7 +43,7 @@ namespace BismNormalizer.TabularCompare.UI
public static Size ScaleByDpi(Size size)
{
float dpiFactorFudged = GetDpiFactor() * HighDPIUtils.PrimaryFudgeFactor;
float dpiFactorFudged = GetDpiFactor() * Utils.PrimaryFudgeFactor;
return new Size((int)(size.Width * dpiFactorFudged), (int)(size.Height * dpiFactorFudged));
}
@ -60,7 +74,7 @@ namespace BismNormalizer.TabularCompare.UI
}
// According to MSDN, setting a new size resets the Images collection
imageList.ImageSize = HighDPIUtils.ScaleByDpi(imageList.ImageSize);
imageList.ImageSize = Utils.ScaleByDpi(imageList.ImageSize);
foreach (KeyValuePair<string, Image> entry in originalImages)
{
imageList.Images.Add(entry.Key, entry.Value);
@ -103,20 +117,20 @@ namespace BismNormalizer.TabularCompare.UI
factor = (float)graphics.DpiX / 96F; //96 is the default windows DPI
if (factor > 1.3 && factor < 1.7)
{
HighDPIUtils.PrimaryFudgeFactor = 0.66f;
HighDPIUtils.SecondaryFudgeFactor = 1.1f;
Utils.PrimaryFudgeFactor = 0.66f;
Utils.SecondaryFudgeFactor = 1.1f;
}
else if (factor >= 1.7)
{
if (!Settings.Default.OptionHighDpiLocal)
{
HighDPIUtils.PrimaryFudgeFactor = 0.72f;
HighDPIUtils.SecondaryFudgeFactor = 1.6f;
Utils.PrimaryFudgeFactor = 0.72f;
Utils.SecondaryFudgeFactor = 1.6f;
}
else
{
HighDPIUtils.PrimaryFudgeFactor = 0.54f;
HighDPIUtils.SecondaryFudgeFactor = 1.2f;
Utils.PrimaryFudgeFactor = 0.54f;
Utils.SecondaryFudgeFactor = 1.2f;
}
}
}