예제 #1
0
        private void ConfigureWindowsStoreStartup()
        {
            if (cbStartWithWindows.Enabled)
            {
                cbStartWithWindows.Enabled           = false;
                lblWindowsStoreStartupStatus.Text    = "Configuring startup...";
                lblWindowsStoreStartupStatus.Visible = true;

                bool             enable = cbStartWithWindows.Checked;
                StartupTaskState state  = StartupTaskState.Error;

                TaskEx.Run(() =>
                {
                    state = IntegrationHelpers.ConfigureStartupWindowsStore(enable);
                },
                           () =>
                {
                    if (!IsDisposed)
                    {
                        if (state == StartupTaskState.Error)
                        {
                            lblWindowsStoreStartupStatus.Text = "Startup configuration 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.Enabled           = true;
                        }
                    }
                });
            }
        }