public Form1() { InitializeComponent(); if (VistaSecurity.IsAdmin()) { return; } VistaSecurity.AddShieldToButton(buttonAdminRun); VistaSecurity.AddShieldToButton(buttonOtherUserRun); }
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); }