mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-25 08:01:49 +01:00
Add UAC icon for Run At Startup Task option. Fix option access.
This commit is contained in:
parent
5dca9d5dbb
commit
633b0d224f
11
DS4Windows/DS4Forms/DS4Form.Designer.cs
generated
11
DS4Windows/DS4Forms/DS4Form.Designer.cs
generated
@ -119,6 +119,7 @@
|
|||||||
this.cBSwipeProfiles = new System.Windows.Forms.CheckBox();
|
this.cBSwipeProfiles = new System.Windows.Forms.CheckBox();
|
||||||
this.StartWindowsCheckBox = new System.Windows.Forms.CheckBox();
|
this.StartWindowsCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.runStartupPanel = new System.Windows.Forms.Panel();
|
this.runStartupPanel = new System.Windows.Forms.Panel();
|
||||||
|
this.uacPictureBox = new System.Windows.Forms.PictureBox();
|
||||||
this.runStartTaskRadio = new System.Windows.Forms.RadioButton();
|
this.runStartTaskRadio = new System.Windows.Forms.RadioButton();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.runStartProgRadio = new System.Windows.Forms.RadioButton();
|
this.runStartProgRadio = new System.Windows.Forms.RadioButton();
|
||||||
@ -173,6 +174,7 @@
|
|||||||
this.tabSettings.SuspendLayout();
|
this.tabSettings.SuspendLayout();
|
||||||
this.fLPSettings.SuspendLayout();
|
this.fLPSettings.SuspendLayout();
|
||||||
this.runStartupPanel.SuspendLayout();
|
this.runStartupPanel.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.uacPictureBox)).BeginInit();
|
||||||
this.panel1.SuspendLayout();
|
this.panel1.SuspendLayout();
|
||||||
this.panel2.SuspendLayout();
|
this.panel2.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nUDLatency)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nUDLatency)).BeginInit();
|
||||||
@ -893,12 +895,19 @@
|
|||||||
// runStartupPanel
|
// runStartupPanel
|
||||||
//
|
//
|
||||||
this.runStartupPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.runStartupPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.runStartupPanel.Controls.Add(this.uacPictureBox);
|
||||||
this.runStartupPanel.Controls.Add(this.runStartTaskRadio);
|
this.runStartupPanel.Controls.Add(this.runStartTaskRadio);
|
||||||
this.runStartupPanel.Controls.Add(this.label1);
|
this.runStartupPanel.Controls.Add(this.label1);
|
||||||
this.runStartupPanel.Controls.Add(this.runStartProgRadio);
|
this.runStartupPanel.Controls.Add(this.runStartProgRadio);
|
||||||
resources.ApplyResources(this.runStartupPanel, "runStartupPanel");
|
resources.ApplyResources(this.runStartupPanel, "runStartupPanel");
|
||||||
this.runStartupPanel.Name = "runStartupPanel";
|
this.runStartupPanel.Name = "runStartupPanel";
|
||||||
//
|
//
|
||||||
|
// uacPictureBox
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.uacPictureBox, "uacPictureBox");
|
||||||
|
this.uacPictureBox.Name = "uacPictureBox";
|
||||||
|
this.uacPictureBox.TabStop = false;
|
||||||
|
//
|
||||||
// runStartTaskRadio
|
// runStartTaskRadio
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.runStartTaskRadio, "runStartTaskRadio");
|
resources.ApplyResources(this.runStartTaskRadio, "runStartTaskRadio");
|
||||||
@ -1231,6 +1240,7 @@
|
|||||||
this.fLPSettings.PerformLayout();
|
this.fLPSettings.PerformLayout();
|
||||||
this.runStartupPanel.ResumeLayout(false);
|
this.runStartupPanel.ResumeLayout(false);
|
||||||
this.runStartupPanel.PerformLayout();
|
this.runStartupPanel.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.uacPictureBox)).EndInit();
|
||||||
this.panel1.ResumeLayout(false);
|
this.panel1.ResumeLayout(false);
|
||||||
this.panel1.PerformLayout();
|
this.panel1.PerformLayout();
|
||||||
this.panel2.ResumeLayout(false);
|
this.panel2.ResumeLayout(false);
|
||||||
@ -1379,6 +1389,7 @@
|
|||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.RadioButton runStartProgRadio;
|
private System.Windows.Forms.RadioButton runStartProgRadio;
|
||||||
private System.Windows.Forms.RadioButton runStartTaskRadio;
|
private System.Windows.Forms.RadioButton runStartTaskRadio;
|
||||||
|
private System.Windows.Forms.PictureBox uacPictureBox;
|
||||||
//private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
|
//private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,20 +371,25 @@ namespace DS4Windows
|
|||||||
if (!Directory.Exists(appdatapath + "\\Virtual Bus Driver"))
|
if (!Directory.Exists(appdatapath + "\\Virtual Bus Driver"))
|
||||||
linkUninstall.Visible = false;
|
linkUninstall.Visible = false;
|
||||||
|
|
||||||
|
bool isElevated = Global.IsAdministrator();
|
||||||
|
if (!isElevated)
|
||||||
|
{
|
||||||
|
Image tempImg = new Bitmap(uacPictureBox.Width, uacPictureBox.Height);
|
||||||
|
AddUACShieldToImage(tempImg);
|
||||||
|
uacPictureBox.BackgroundImage = tempImg;
|
||||||
|
uacPictureBox.Visible = true;
|
||||||
|
runStartTaskRadio.Enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
runStartTaskRadio.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk"))
|
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk"))
|
||||||
{
|
{
|
||||||
StartWindowsCheckBox.Checked = true;
|
StartWindowsCheckBox.Checked = true;
|
||||||
runStartupPanel.Visible = true;
|
runStartupPanel.Visible = true;
|
||||||
|
|
||||||
if (Global.IsAdministrator())
|
|
||||||
{
|
|
||||||
runStartTaskRadio.Enabled = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
runStartTaskRadio.Enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
string lnkpath = WinProgs.ResolveShortcutAndArgument(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
|
string lnkpath = WinProgs.ResolveShortcutAndArgument(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
|
||||||
string onlylnkpath = WinProgs.ResolveShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
|
string onlylnkpath = WinProgs.ResolveShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
|
||||||
if (!lnkpath.EndsWith("-runtask"))
|
if (!lnkpath.EndsWith("-runtask"))
|
||||||
@ -409,6 +414,21 @@ namespace DS4Windows
|
|||||||
this.StartWindowsCheckBox.CheckedChanged += new System.EventHandler(this.StartWindowsCheckBox_CheckedChanged);
|
this.StartWindowsCheckBox.CheckedChanged += new System.EventHandler(this.StartWindowsCheckBox_CheckedChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Image AddUACShieldToImage(Image image)
|
||||||
|
{
|
||||||
|
Bitmap shield = SystemIcons.Shield.ToBitmap();
|
||||||
|
shield.MakeTransparent();
|
||||||
|
|
||||||
|
Graphics g = Graphics.FromImage(image);
|
||||||
|
g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
|
||||||
|
double aspectRatio = shield.Width / (double)shield.Height;
|
||||||
|
int finalWidth = Convert.ToInt32(image.Height * aspectRatio);
|
||||||
|
int finalHeight = Convert.ToInt32(image.Width / aspectRatio);
|
||||||
|
g.DrawImage(shield, new Rectangle(0, 0, finalWidth, finalHeight));
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
private void blankControllerTab()
|
private void blankControllerTab()
|
||||||
{
|
{
|
||||||
bool nocontrollers = true;
|
bool nocontrollers = true;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user