mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-29 17:02:05 +13:00
On WindowsStore build only check startup when integration tab selected and status on label instead of message box
This commit is contained in:
parent
d94a4fad1d
commit
a15acf8b42
6 changed files with 999 additions and 2110 deletions
9
ShareX/Forms/ApplicationSettingsForm.Designer.cs
generated
9
ShareX/Forms/ApplicationSettingsForm.Designer.cs
generated
|
@ -144,6 +144,7 @@ private void InitializeComponent()
|
|||
this.tpAdvanced = new System.Windows.Forms.TabPage();
|
||||
this.pgSettings = new System.Windows.Forms.PropertyGrid();
|
||||
this.tttvMain = new ShareX.HelpersLib.TabToTreeView();
|
||||
this.lblWindowsStoreStartupStatus = new System.Windows.Forms.Label();
|
||||
this.tcSettings.SuspendLayout();
|
||||
this.tpGeneral.SuspendLayout();
|
||||
this.tpIntegration.SuspendLayout();
|
||||
|
@ -394,6 +395,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// gbWindows
|
||||
//
|
||||
this.gbWindows.Controls.Add(this.lblWindowsStoreStartupStatus);
|
||||
this.gbWindows.Controls.Add(this.cbStartWithWindows);
|
||||
this.gbWindows.Controls.Add(this.cbSendToMenu);
|
||||
this.gbWindows.Controls.Add(this.cbShellContextMenu);
|
||||
|
@ -1043,6 +1045,12 @@ private void InitializeComponent()
|
|||
this.tttvMain.Name = "tttvMain";
|
||||
this.tttvMain.TreeViewFont = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
|
||||
this.tttvMain.TreeViewSize = 175;
|
||||
this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged);
|
||||
//
|
||||
// lblWindowsStoreStartupStatus
|
||||
//
|
||||
resources.ApplyResources(this.lblWindowsStoreStartupStatus, "lblWindowsStoreStartupStatus");
|
||||
this.lblWindowsStoreStartupStatus.Name = "lblWindowsStoreStartupStatus";
|
||||
//
|
||||
// ApplicationSettingsForm
|
||||
//
|
||||
|
@ -1219,5 +1227,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.CheckBox cbChromeExtensionSupport;
|
||||
private System.Windows.Forms.CheckBox cbFirefoxAddonSupport;
|
||||
private System.Windows.Forms.Button btnResetSettings;
|
||||
private System.Windows.Forms.Label lblWindowsStoreStartupStatus;
|
||||
}
|
||||
}
|
|
@ -68,6 +68,16 @@ private void SettingsForm_FormClosed(object sender, FormClosedEventArgs e)
|
|||
}
|
||||
}
|
||||
|
||||
private void tttvMain_TabChanged(TabPage tabPage)
|
||||
{
|
||||
#if WindowsStore
|
||||
if (tabPage == tpIntegration)
|
||||
{
|
||||
CheckWindowsStoreStartup();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void InitializeControls()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -122,21 +132,6 @@ private void UpdateControls()
|
|||
// Integration
|
||||
#if WindowsStore
|
||||
cbStartWithWindows.Enabled = false;
|
||||
StartupTaskState state = StartupTaskState.Error;
|
||||
|
||||
TaskEx.Run(() =>
|
||||
{
|
||||
state = IntegrationHelpers.CheckStartupWindowsStore();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
if (!IsDisposed && state != StartupTaskState.Error && state != StartupTaskState.DisabledByUser)
|
||||
{
|
||||
cbStartWithWindows.Checked = state == StartupTaskState.Enabled;
|
||||
cbStartWithWindows.Enabled = true;
|
||||
}
|
||||
});
|
||||
|
||||
cbShellContextMenu.Visible = false;
|
||||
cbSendToMenu.Visible = false;
|
||||
gbChrome.Visible = false;
|
||||
|
@ -306,6 +301,41 @@ private void UpdateExportButton()
|
|||
btnExport.Enabled = Program.Settings.ExportSettings || Program.Settings.ExportHistory || Program.Settings.ExportLogs;
|
||||
}
|
||||
|
||||
private void CheckWindowsStoreStartup()
|
||||
{
|
||||
if (cbStartWithWindows.Enabled) return;
|
||||
|
||||
lblWindowsStoreStartupStatus.Text = "Checking startup state...";
|
||||
lblWindowsStoreStartupStatus.Visible = true;
|
||||
|
||||
StartupTaskState state = StartupTaskState.Error;
|
||||
|
||||
TaskEx.Run(() =>
|
||||
{
|
||||
state = IntegrationHelpers.CheckStartupWindowsStore();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
if (!IsDisposed)
|
||||
{
|
||||
if (state == StartupTaskState.Error)
|
||||
{
|
||||
lblWindowsStoreStartupStatus.Text = "Startup state check failed. Check debug log for more info.";
|
||||
}
|
||||
else if (state == StartupTaskState.DisabledByUser)
|
||||
{
|
||||
lblWindowsStoreStartupStatus.Text = "The startup has been disabled by the user.";
|
||||
}
|
||||
else
|
||||
{
|
||||
lblWindowsStoreStartupStatus.Visible = false;
|
||||
cbStartWithWindows.Checked = state == StartupTaskState.Enabled;
|
||||
cbStartWithWindows.Enabled = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#region General
|
||||
|
||||
private void cbShowTray_CheckedChanged(object sender, EventArgs e)
|
||||
|
|
File diff suppressed because it is too large
Load diff
12
ShareX/Forms/MainForm.Designer.cs
generated
12
ShareX/Forms/MainForm.Designer.cs
generated
|
@ -239,7 +239,7 @@ private void InitializeComponent()
|
|||
this.tsmiTrayExit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.timerTraySingleClick = new System.Windows.Forms.Timer(this.components);
|
||||
this.ttMain = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.newsListControl1 = new ShareX.NewsListControl();
|
||||
this.ucNews = new ShareX.NewsListControl();
|
||||
((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit();
|
||||
this.scMain.Panel1.SuspendLayout();
|
||||
this.scMain.Panel2.SuspendLayout();
|
||||
|
@ -1859,10 +1859,10 @@ private void InitializeComponent()
|
|||
this.ttMain.InitialDelay = 200;
|
||||
this.ttMain.ReshowDelay = 100;
|
||||
//
|
||||
// newsListControl1
|
||||
// ucNews
|
||||
//
|
||||
resources.ApplyResources(this.newsListControl1, "newsListControl1");
|
||||
this.newsListControl1.Name = "newsListControl1";
|
||||
resources.ApplyResources(this.ucNews, "ucNews");
|
||||
this.ucNews.Name = "ucNews";
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
|
@ -1870,7 +1870,7 @@ private void InitializeComponent()
|
|||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.Controls.Add(this.newsListControl1);
|
||||
this.Controls.Add(this.ucNews);
|
||||
this.Controls.Add(this.flpPatreon);
|
||||
this.Controls.Add(this.scMain);
|
||||
this.Controls.Add(this.tsMain);
|
||||
|
@ -2113,6 +2113,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ToolStripMenuItem tsmiDeleteSelectedItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiSearchImage;
|
||||
private ShareX.HelpersLib.ToolStripButtonExtraImage tsbNews;
|
||||
private NewsListControl newsListControl1;
|
||||
private NewsListControl ucNews;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -88,6 +88,8 @@ public static StartupTaskState CheckStartupWindowsStore()
|
|||
{
|
||||
try
|
||||
{
|
||||
DebugHelper.WriteLine($"Start: {filepath} -StartupState");
|
||||
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = filepath,
|
||||
|
@ -102,7 +104,7 @@ public static StartupTaskState CheckStartupWindowsStore()
|
|||
{
|
||||
int code = process.ExitCode;
|
||||
|
||||
DebugHelper.WriteLine($"CheckStartupWindowsStore: {code}");
|
||||
DebugHelper.WriteLine($"Startup check result: {code}");
|
||||
|
||||
if (code > -1)
|
||||
{
|
||||
|
@ -112,7 +114,7 @@ public static StartupTaskState CheckStartupWindowsStore()
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Startup state check failed:\r\n" + e.ToString(), "ShareX");
|
||||
DebugHelper.WriteException(e, "Startup state check failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue