private void CheckRefresh(TweakEntry entry)
        {
            RefreshRequiredAttribute attribute = entry.GetAttribute <RefreshRequiredAttribute>();

            if (attribute == null)
            {
                return;
            }

            if (attribute.Type == RestartType.ExplorerRestart)
            {
                DialogResult result = MessageBox.Show(Properties.Strings.Reload_ExplorerRestart, Properties.Strings.Application_Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    Program.RestartExplorer();
                }
            }
            else if (attribute.Type == RestartType.SystemRestart)
            {
                DialogResult result = MessageBox.Show(Properties.Strings.Reload_SystemRestart, Properties.Strings.Application_Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    NativeMethods.ExitWindowsEx(NativeMethods.ExitWindows.Reboot, NativeMethods.ShutdownReason.MinorReconfig);
                }
            }
            else if (attribute.Type == RestartType.ProcessRestart)
            {
                DialogResult result = MessageBox.Show(string.Format(Properties.Strings.Reload_ProcessRestart, attribute.Argument), Properties.Strings.Application_Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    var processes = Process.GetProcessesByName(attribute.Argument);
                    using (var indicator = new ProgressIndicator())
                    {
                        indicator.Initialize(processes.Length);

                        foreach (Process process in processes)
                        {
                            string fileName = process.MainModule.FileName;

                            indicator.SetProgress(-1, string.Format(Properties.Strings.Reload_ProcessRestart_WaitingFor, fileName));

                            if (!process.CloseMainWindow() && !process.HasExited && !process.WaitForExit(10000))
                            {
                                process.Kill();
                            }

                            Process.Start(fileName);
                        }

                        indicator.SetProgress(processes.Length, "");
                    }
                }
            }
            else if (attribute.Type == RestartType.ServiceRestart)
            {
                using (var controller = new ServiceController(attribute.Argument))
                {
                    var result = MessageBox.Show(string.Format(Properties.Strings.Reload_ServiceRestart, controller.DisplayName, controller.ServiceName), Properties.Strings.Application_Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (result == DialogResult.Yes)
                    {
                        using (var indicator = new ProgressIndicator())
                        {
                            indicator.Initialize(1);

                            indicator.SetProgress(-1, string.Format(Properties.Strings.Reload_ServiceRestart_Text, controller.DisplayName));

                            controller.Stop();
                            controller.WaitForStatus(ServiceControllerStatus.Stopped);
                            controller.Start();
                            controller.WaitForStatus(ServiceControllerStatus.Running);

                            indicator.SetProgress(1, "");
                        }
                    }
                }
            }
            else if (attribute.Type == RestartType.Logoff)
            {
                DialogResult result = MessageBox.Show(Properties.Strings.Reload_LogOff, Properties.Strings.Application_Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    NativeMethods.ExitWindowsEx(NativeMethods.ExitWindows.LogOff, NativeMethods.ShutdownReason.MinorReconfig);
                }
            }
            else if (attribute.Type == RestartType.TweakUtility)
            {
                DialogResult result = MessageBox.Show(Properties.Strings.Reload_TweakUtility, Properties.Strings.Application_Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    Application.Restart();
                }
            }
            else if (attribute.Type == RestartType.Unknown)
            {
                MessageBox.Show(Properties.Strings.Reload_Unknown, Properties.Strings.Application_Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void AddEntry(TweakEntry entry, Control panel)
        {
            if (!entry.Visible)
            {
                return;
            }

            try
            {
                if (entry.GetAttribute <NoticeAttribute>() is NoticeAttribute noticeAttribute)
                {
                    var control = new NoticeControl(noticeAttribute);
                    panel.Controls.Add(control);
                }

                if (entry is TweakAction action)
                {
                    this.AddAction(action, panel);
                    return;
                }

                if (entry is TweakOption option)
                {
                    if (option.Type == typeof(bool))
                    {
                        this.AddBooleanEntry(option, panel);
                    }
                    else if (option.Type == typeof(int))
                    {
                        this.AddIntegerEntry(option, panel);
                    }
                    else if (option.Type == typeof(string))
                    {
                        this.AddStringEntry(option, panel);
                    }
                    else if (option.Type.BaseType == typeof(Enum))
                    {
                        this.AddEnumEntry(option, panel);
                    }
                    else if (option.Type == typeof(Color))
                    {
                        this.AddColorEntry(option, panel);
                    }
                    else
                    {
                        //Display a fallback message to let the user know
                        panel.Controls.Add(new Label()
                        {
                            AutoSize  = true,
                            Text      = $"Unsupported property type {option.Type.ToString()} on property {option.Name}",
                            ForeColor = Color.Red
                        });
                    }
                }

                if (entry.GetAttribute <DescriptionAttribute>() is DescriptionAttribute descriptionAttribute)
                {
                    var control = new Label()
                    {
                        Text      = descriptionAttribute.Description,
                        ForeColor = SystemColors.GrayText,
                        AutoSize  = true,
                        Padding   = new Padding(0, 0, 0, Constants.Design_Description_Padding_Bottom)
                    };

                    panel.Controls.Add(control);
                }
            }
            catch
            {
                panel.Controls.Add(new Label()
                {
                    AutoSize  = true,
                    Text      = $"Error displaying entry {entry.Name}",
                    ForeColor = Color.Red
                });
            }
        }