mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Added DisplayProfile images
This commit is contained in:
parent
f66c841431
commit
067f639901
@ -134,12 +134,6 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ShortcutItem.cs" />
|
<Compile Include="ShortcutItem.cs" />
|
||||||
<Compile Include="ShortcutRepository.cs" />
|
<Compile Include="ShortcutRepository.cs" />
|
||||||
<Compile Include="UIForms\ApplyingProfileForm.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="UIForms\ApplyingProfileForm.Designer.cs">
|
|
||||||
<DependentUpon>ApplyingProfileForm.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="UIForms\GameAdaptor.cs" />
|
<Compile Include="UIForms\GameAdaptor.cs" />
|
||||||
<Compile Include="UIForms\HotkeyForm.cs">
|
<Compile Include="UIForms\HotkeyForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
@ -205,9 +199,6 @@
|
|||||||
<LastGenOutput>Language.Designer.cs</LastGenOutput>
|
<LastGenOutput>Language.Designer.cs</LastGenOutput>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="UIForms\ApplyingProfileForm.resx">
|
|
||||||
<DependentUpon>ApplyingProfileForm.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="UIForms\HotkeyForm.resx">
|
<EmbeddedResource Include="UIForms\HotkeyForm.resx">
|
||||||
<DependentUpon>HotkeyForm.cs</DependentUpon>
|
<DependentUpon>HotkeyForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
@ -325,6 +316,8 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="Resources\winwhite.png" />
|
||||||
|
<None Include="Resources\winblack.png" />
|
||||||
<None Include="Resources\Steam.png" />
|
<None Include="Resources\Steam.png" />
|
||||||
<None Include="Resources\Uplay.png" />
|
<None Include="Resources\Uplay.png" />
|
||||||
<None Include="Resources\whitearrowsup.png" />
|
<None Include="Resources\whitearrowsup.png" />
|
||||||
@ -338,6 +331,9 @@
|
|||||||
<None Include="Resources\GOG.png" />
|
<None Include="Resources\GOG.png" />
|
||||||
<None Include="Resources\amdblack.png" />
|
<None Include="Resources\amdblack.png" />
|
||||||
<None Include="Resources\amdwhite.png" />
|
<None Include="Resources\amdwhite.png" />
|
||||||
|
<None Include="Resources\nvidiablack.png" />
|
||||||
|
<None Include="Resources\nvidiawhitee.png" />
|
||||||
|
<None Include="Resources\nvidiawhite.png" />
|
||||||
<Content Include="Resources\redarrows.png" />
|
<Content Include="Resources\redarrows.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
40
DisplayMagician/Properties/Resources.Designer.cs
generated
40
DisplayMagician/Properties/Resources.Designer.cs
generated
@ -120,6 +120,26 @@ namespace DisplayMagician.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap nvidiablack {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("nvidiablack", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap nvidiawhite {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("nvidiawhite", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -199,5 +219,25 @@ namespace DisplayMagician.Properties {
|
|||||||
return ((System.Drawing.Bitmap)(obj));
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap winblack {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("winblack", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap winwhite {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("winwhite", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,4 +160,16 @@
|
|||||||
<data name="amdwhite" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="amdwhite" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\amdwhite.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\amdwhite.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="nvidiablack" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\nvidiablack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="nvidiawhite" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\nvidiawhite.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="winblack" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\winblack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="winwhite" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\winwhite.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 13 KiB |
BIN
DisplayMagician/Resources/nvidiawhite.png
Normal file
BIN
DisplayMagician/Resources/nvidiawhite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
BIN
DisplayMagician/Resources/winblack.png
Normal file
BIN
DisplayMagician/Resources/winblack.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
DisplayMagician/Resources/winwhite.png
Normal file
BIN
DisplayMagician/Resources/winwhite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
163
DisplayMagician/UIForms/ApplyingProfileForm.Designer.cs
generated
163
DisplayMagician/UIForms/ApplyingProfileForm.Designer.cs
generated
@ -1,163 +0,0 @@
|
|||||||
namespace DisplayMagician.UIForms
|
|
||||||
{
|
|
||||||
partial class ApplyingProfileForm
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ApplyingProfileForm));
|
|
||||||
this.progressPanel = new System.Windows.Forms.Panel();
|
|
||||||
this.lbl_sub_message = new System.Windows.Forms.Label();
|
|
||||||
this.progressBar = new CircularProgressBar.CircularProgressBar();
|
|
||||||
this.lbl_message = new System.Windows.Forms.Label();
|
|
||||||
this.t_countdown = new System.Windows.Forms.Timer(this.components);
|
|
||||||
this.btn_close = new System.Windows.Forms.Button();
|
|
||||||
this.progressPanel.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// progressPanel
|
|
||||||
//
|
|
||||||
this.progressPanel.Anchor = System.Windows.Forms.AnchorStyles.None;
|
|
||||||
this.progressPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(50)))));
|
|
||||||
this.progressPanel.Controls.Add(this.lbl_sub_message);
|
|
||||||
this.progressPanel.Controls.Add(this.progressBar);
|
|
||||||
this.progressPanel.Controls.Add(this.lbl_message);
|
|
||||||
this.progressPanel.Location = new System.Drawing.Point(40, 154);
|
|
||||||
this.progressPanel.Name = "progressPanel";
|
|
||||||
this.progressPanel.Size = new System.Drawing.Size(720, 270);
|
|
||||||
this.progressPanel.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// lbl_sub_message
|
|
||||||
//
|
|
||||||
this.lbl_sub_message.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.lbl_sub_message.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.lbl_sub_message.Location = new System.Drawing.Point(110, 67);
|
|
||||||
this.lbl_sub_message.Name = "lbl_sub_message";
|
|
||||||
this.lbl_sub_message.Size = new System.Drawing.Size(501, 30);
|
|
||||||
this.lbl_sub_message.TabIndex = 2;
|
|
||||||
this.lbl_sub_message.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// progressBar
|
|
||||||
//
|
|
||||||
this.progressBar.AnimationFunction = WinFormAnimation.KnownAnimationFunctions.Liner;
|
|
||||||
this.progressBar.AnimationSpeed = 1000;
|
|
||||||
this.progressBar.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.progressBar.Font = new System.Drawing.Font("Microsoft Sans Serif", 39.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.progressBar.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
|
||||||
this.progressBar.InnerColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(50)))));
|
|
||||||
this.progressBar.InnerMargin = 0;
|
|
||||||
this.progressBar.InnerWidth = 1;
|
|
||||||
this.progressBar.Location = new System.Drawing.Point(293, 115);
|
|
||||||
this.progressBar.MarqueeAnimationSpeed = 2000;
|
|
||||||
this.progressBar.Name = "progressBar";
|
|
||||||
this.progressBar.OuterColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
|
||||||
this.progressBar.OuterMargin = 0;
|
|
||||||
this.progressBar.OuterWidth = 0;
|
|
||||||
this.progressBar.ProgressColor = System.Drawing.Color.DodgerBlue;
|
|
||||||
this.progressBar.ProgressWidth = 23;
|
|
||||||
this.progressBar.SecondaryFont = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.progressBar.Size = new System.Drawing.Size(135, 135);
|
|
||||||
this.progressBar.StartAngle = 270;
|
|
||||||
this.progressBar.SubscriptColor = System.Drawing.Color.FromArgb(((int)(((byte)(166)))), ((int)(((byte)(166)))), ((int)(((byte)(166)))));
|
|
||||||
this.progressBar.SubscriptMargin = new System.Windows.Forms.Padding(10, -35, 0, 0);
|
|
||||||
this.progressBar.SubscriptText = "";
|
|
||||||
this.progressBar.SuperscriptColor = System.Drawing.Color.Gray;
|
|
||||||
this.progressBar.SuperscriptMargin = new System.Windows.Forms.Padding(0, 30, 0, 0);
|
|
||||||
this.progressBar.SuperscriptText = "";
|
|
||||||
this.progressBar.TabIndex = 0;
|
|
||||||
this.progressBar.TextMargin = new System.Windows.Forms.Padding(0, 4, 1, 0);
|
|
||||||
this.progressBar.Value = 68;
|
|
||||||
//
|
|
||||||
// lbl_message
|
|
||||||
//
|
|
||||||
this.lbl_message.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(178)));
|
|
||||||
this.lbl_message.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
|
||||||
this.lbl_message.Location = new System.Drawing.Point(3, 0);
|
|
||||||
this.lbl_message.Name = "lbl_message";
|
|
||||||
this.lbl_message.Size = new System.Drawing.Size(714, 61);
|
|
||||||
this.lbl_message.TabIndex = 1;
|
|
||||||
this.lbl_message.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// t_countdown
|
|
||||||
//
|
|
||||||
this.t_countdown.Interval = 1000;
|
|
||||||
this.t_countdown.Tick += new System.EventHandler(this.t_countdown_Tick);
|
|
||||||
//
|
|
||||||
// btn_close
|
|
||||||
//
|
|
||||||
this.btn_close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.btn_close.FlatAppearance.BorderSize = 0;
|
|
||||||
this.btn_close.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
||||||
this.btn_close.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.btn_close.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.btn_close.Location = new System.Drawing.Point(759, 12);
|
|
||||||
this.btn_close.Name = "btn_close";
|
|
||||||
this.btn_close.Size = new System.Drawing.Size(29, 32);
|
|
||||||
this.btn_close.TabIndex = 2;
|
|
||||||
this.btn_close.Text = "X";
|
|
||||||
this.btn_close.UseVisualStyleBackColor = true;
|
|
||||||
this.btn_close.Click += new System.EventHandler(this.btn_close_Click);
|
|
||||||
//
|
|
||||||
// ApplyingProfileForm
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(50)))));
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Controls.Add(this.btn_close);
|
|
||||||
this.Controls.Add(this.progressPanel);
|
|
||||||
this.DoubleBuffered = true;
|
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
|
||||||
this.KeyPreview = true;
|
|
||||||
this.Name = "ApplyingProfileForm";
|
|
||||||
this.Opacity = 0D;
|
|
||||||
this.ShowIcon = false;
|
|
||||||
this.ShowInTaskbar = false;
|
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
|
||||||
this.Text = "DisplayMagician - Please Wait";
|
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ApplyingProfileForm_FormClosing);
|
|
||||||
this.Load += new System.EventHandler(this.ApplyingProfileForm_Reposition);
|
|
||||||
this.Shown += new System.EventHandler(this.ApplyingProfileForm_Shown);
|
|
||||||
this.LocationChanged += new System.EventHandler(this.ApplyingProfileForm_Reposition);
|
|
||||||
this.Leave += new System.EventHandler(this.ApplyingProfileForm_Reposition);
|
|
||||||
this.Move += new System.EventHandler(this.ApplyingProfileForm_Reposition);
|
|
||||||
this.progressPanel.ResumeLayout(false);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.Panel progressPanel;
|
|
||||||
private CircularProgressBar.CircularProgressBar progressBar;
|
|
||||||
private System.Windows.Forms.Label lbl_sub_message;
|
|
||||||
private System.Windows.Forms.Label lbl_message;
|
|
||||||
private System.Windows.Forms.Timer t_countdown;
|
|
||||||
private System.Windows.Forms.Button btn_close;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,283 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using WinFormAnimation;
|
|
||||||
|
|
||||||
namespace DisplayMagician.UIForms
|
|
||||||
{
|
|
||||||
public partial class ApplyingProfileForm : Form
|
|
||||||
{
|
|
||||||
private readonly Bitmap _progressImage;
|
|
||||||
private readonly List<Point> _progressPositions = new List<Point>();
|
|
||||||
private int _countdownCounter;
|
|
||||||
private readonly int _displayChangeMaxDelta = -1;
|
|
||||||
private int _displayChangeDelta;
|
|
||||||
private int _lastCount;
|
|
||||||
private bool _isClosing;
|
|
||||||
|
|
||||||
public ApplyingProfileForm()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_progressImage = new Bitmap(progressPanel.Width, progressPanel.Height);
|
|
||||||
Controls.Remove(progressPanel);
|
|
||||||
progressPanel.BackColor = BackColor;
|
|
||||||
progressBar.Invalidated += (sender, args) => Invalidate();
|
|
||||||
progressPanel.Invalidated += (sender, args) => Invalidate();
|
|
||||||
Reposition();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ApplyingProfileForm(Task taskToRun = null, int countdown = 0, string title = null, string message = null, Color progressColor = default(Color), bool cancellable = false, int displayChangeMaxDelta = 5) : this()
|
|
||||||
{
|
|
||||||
_countdownCounter = countdown;
|
|
||||||
_lastCount = _countdownCounter;
|
|
||||||
_displayChangeMaxDelta = displayChangeMaxDelta;
|
|
||||||
Cancellable = cancellable;
|
|
||||||
TaskToRun = taskToRun;
|
|
||||||
if (progressColor.Equals(default(Color)))
|
|
||||||
progressColor = Color.OrangeRed;
|
|
||||||
ProgressColor = progressColor;
|
|
||||||
if (!string.IsNullOrEmpty(title)) Title = title;
|
|
||||||
if (!string.IsNullOrEmpty(message)) Message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Title { get; set; } = "Please wait...";
|
|
||||||
public string Message { get; set; } = "It won't be long now!";
|
|
||||||
public Color ProgressColor { get; set; } = Color.OrangeRed;
|
|
||||||
public bool Cancellable{ get; set; } = false;
|
|
||||||
public Task TaskToRun { get; set; } = null;
|
|
||||||
|
|
||||||
protected override void OnKeyDown(KeyEventArgs e)
|
|
||||||
{
|
|
||||||
e.Handled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnPaint(PaintEventArgs e)
|
|
||||||
{
|
|
||||||
lock (_progressPositions)
|
|
||||||
{
|
|
||||||
progressPanel.DrawToBitmap(_progressImage, new Rectangle(Point.Empty, progressPanel.Size));
|
|
||||||
|
|
||||||
foreach (var position in _progressPositions)
|
|
||||||
{
|
|
||||||
e.Graphics.DrawImage(_progressImage, new Rectangle(position, progressPanel.Size));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
base.OnPaint(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
|
||||||
{
|
|
||||||
if (keyData != Keys.Escape)
|
|
||||||
{
|
|
||||||
return base.ProcessCmdKey(ref msg, keyData);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Cancellable)
|
|
||||||
{
|
|
||||||
t_countdown.Stop();
|
|
||||||
DialogResult = DialogResult.Cancel;
|
|
||||||
Close();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandleDisplayChangeDelta()
|
|
||||||
{
|
|
||||||
if (_displayChangeMaxDelta <= -1) return;
|
|
||||||
_displayChangeDelta = _lastCount - _countdownCounter;
|
|
||||||
if (_displayChangeDelta > _displayChangeMaxDelta)
|
|
||||||
{
|
|
||||||
Debug.Print("_displayChangeDelta > _displayChangeMaxDelta! " + _displayChangeDelta + " > " + _displayChangeMaxDelta);
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DoCountdown()
|
|
||||||
{
|
|
||||||
if (_countdownCounter > 0)
|
|
||||||
{
|
|
||||||
lbl_message.Text = Title;
|
|
||||||
lbl_sub_message.Text = Message;
|
|
||||||
progressBar.ProgressColor = ProgressColor;
|
|
||||||
progressBar.Maximum = _countdownCounter;
|
|
||||||
progressBar.Value = _countdownCounter;
|
|
||||||
progressBar.Text = _countdownCounter.ToString();
|
|
||||||
t_countdown.Start();
|
|
||||||
if (TaskToRun is Task)
|
|
||||||
TaskToRun.Start();
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
progressBar.Style = ProgressBarStyle.Marquee;
|
|
||||||
progressBar.Text = "";
|
|
||||||
progressBar.Maximum = 100;
|
|
||||||
progressBar.Value = 50;
|
|
||||||
progressBar.Style = ProgressBarStyle.Marquee;
|
|
||||||
if (TaskToRun is Task)
|
|
||||||
TaskToRun.Start();
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
HandleDisplayChangeDelta();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Reposition()
|
|
||||||
{
|
|
||||||
lock (_progressPositions)
|
|
||||||
{
|
|
||||||
// Screen.Allscreens is a static variable and won't be updated while the program is running.
|
|
||||||
// SO we use reflection to wipe the value and force it to be updated afresh.
|
|
||||||
typeof(Screen).GetField("screens", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, null);
|
|
||||||
Screen[] screens = Screen.AllScreens;
|
|
||||||
Size = screens.Select(screen => screen.Bounds)
|
|
||||||
.Aggregate(Rectangle.Union)
|
|
||||||
.Size;
|
|
||||||
|
|
||||||
_progressPositions.Clear();
|
|
||||||
_progressPositions.AddRange(
|
|
||||||
screens.Select(
|
|
||||||
screen =>
|
|
||||||
new Point(screen.Bounds.X + ((screen.Bounds.Width - progressPanel.Width) / 2),
|
|
||||||
screen.Bounds.Y + ((screen.Bounds.Height - progressPanel.Height) / 2))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyingProfileForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
||||||
{
|
|
||||||
if (_isClosing)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_isClosing = true;
|
|
||||||
e.Cancel = true;
|
|
||||||
var dialogResult = DialogResult;
|
|
||||||
new Animator(new Path((float)Opacity, 0, 200))
|
|
||||||
.Play(new SafeInvoker<float>(f =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Opacity = f;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"ApplyingProfileForm/ApplyingProfileForm_FormClosing exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
}, this), new SafeInvoker(() =>
|
|
||||||
{
|
|
||||||
DialogResult = dialogResult;
|
|
||||||
Close();
|
|
||||||
}, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyingProfileForm_Reposition(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Reposition();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyingProfileForm_Shown(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Reposition();
|
|
||||||
new Animator(new Path((float)Opacity, 0.97f, 200))
|
|
||||||
.Play(new SafeInvoker<float>(f =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Opacity = f;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"ApplyingProfileForm/ApplyingProfileForm_Shown exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
}, this), new SafeInvoker(DoCountdown, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void t_countdown_Tick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
HandleDisplayChangeDelta();
|
|
||||||
progressBar.Value = _countdownCounter;
|
|
||||||
progressBar.Text = progressBar.Value.ToString();
|
|
||||||
|
|
||||||
if (_countdownCounter <= 0)
|
|
||||||
{
|
|
||||||
_countdownCounter = 0;
|
|
||||||
t_countdown.Stop();
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
Close();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Reposition();
|
|
||||||
_countdownCounter--;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void WndProc(ref Message m)
|
|
||||||
{
|
|
||||||
const int WM_SETTINGCHANGE = 0x001A;
|
|
||||||
const int SPI_SETWORKAREA = 0x02F;
|
|
||||||
const int WM_DISPLAYCHANGE = 0x007E;
|
|
||||||
|
|
||||||
const int x_bitshift = 0;
|
|
||||||
const int y_bitshift = 16;
|
|
||||||
const int xy_mask = 0xFFFF;
|
|
||||||
|
|
||||||
bool displayChange = false;
|
|
||||||
|
|
||||||
switch (m.Msg)
|
|
||||||
{
|
|
||||||
case WM_SETTINGCHANGE:
|
|
||||||
Debug.Print("Message: " + m.ToString());
|
|
||||||
Debug.Print("WM_SETTINGCHANGE");
|
|
||||||
switch ((int)m.WParam)
|
|
||||||
{
|
|
||||||
case SPI_SETWORKAREA:
|
|
||||||
Debug.Print("SPI_SETWORKAREA");
|
|
||||||
displayChange = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_DISPLAYCHANGE:
|
|
||||||
int cxScreen = (xy_mask & ((int)m.LParam) >> x_bitshift);
|
|
||||||
int cyScreen = (xy_mask & ((int)m.LParam) >> y_bitshift);
|
|
||||||
Debug.Print("Message: " + m.ToString());
|
|
||||||
Debug.Print("WM_DISPLAYCHANGE");
|
|
||||||
Debug.Print("cxScreen: " + cxScreen + " cyScreen: " + cyScreen);
|
|
||||||
displayChange = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (displayChange)
|
|
||||||
{
|
|
||||||
_displayChangeDelta = _lastCount - _countdownCounter;
|
|
||||||
_lastCount = _countdownCounter;
|
|
||||||
Debug.Print("Display Change Detected at t " + _lastCount + " difference between changes is " + _displayChangeDelta);
|
|
||||||
}
|
|
||||||
|
|
||||||
base.WndProc(ref m);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btn_close_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
this.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -262,7 +262,7 @@ namespace DisplayMagician.UIForms
|
|||||||
// And show the logo for the driver
|
// And show the logo for the driver
|
||||||
if (_selectedProfile.VideoMode == VIDEO_MODE.NVIDIA)
|
if (_selectedProfile.VideoMode == VIDEO_MODE.NVIDIA)
|
||||||
{
|
{
|
||||||
pbLogo.Image = PickBitmapBasedOnBgColour(BackColor, Properties.Resources.amdblack, Properties.Resources.amdwhite);
|
pbLogo.Image = PickBitmapBasedOnBgColour(BackColor, Properties.Resources.nvidiablack, Properties.Resources.nvidiawhite);
|
||||||
}
|
}
|
||||||
else if (_selectedProfile.VideoMode == VIDEO_MODE.AMD)
|
else if (_selectedProfile.VideoMode == VIDEO_MODE.AMD)
|
||||||
{
|
{
|
||||||
@ -270,7 +270,7 @@ namespace DisplayMagician.UIForms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pbLogo.Image = PickBitmapBasedOnBgColour(BackColor, Properties.Resources.amdblack, Properties.Resources.amdwhite);
|
pbLogo.Image = PickBitmapBasedOnBgColour(BackColor, Properties.Resources.winblack, Properties.Resources.winwhite);
|
||||||
}
|
}
|
||||||
|
|
||||||
// And update the save/rename textbox
|
// And update the save/rename textbox
|
||||||
|
Loading…
Reference in New Issue
Block a user