Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            if (VistaSecurity.IsAdmin())
            {
                return;
            }
            VistaSecurity.AddShieldToButton(buttonAdminRun);
            VistaSecurity.AddShieldToButton(buttonOtherUserRun);
        }
Exemplo n.º 2
0
        private void buttonAdminRun_Click(object sender, EventArgs e)
        {
            if (_busy)
            {
                return;
            }
            if (!ValidateResource(_currentFile))
            {
                MessageBox.Show(
                    "It appears that the selected item doesn't actually exist... Try pick something else?",
                    "Non-Existent item",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            _busy = true;
            SaveLastPath();
            SaveStartRun(true);
            VistaSecurity.RestartElevated();
            Environment.Exit(0);
        }