Пример #1
0
        public MainWindow()
        {
            checker = new PathChecker(reg.ExecutableExtensions);

            InitializeComponent();
            ShieldIcon = UAC.GetShieldIcon();
            searchBox.SetCompleteProvider(checker.Search);

            var args = Environment.GetCommandLineArgs();

            if (args.Count() > 1)
            {
                WriteChangesFromCommandLine(args.Skip(1));
                Close();
            }
            else
            {
                Read();
            }
        }
Пример #2
0
        private void Write()
        {
            string args = "";

            if (SystemPathChanged)
            {
                args += "/system " + PathAsCommandLineArgument(SystemPath);
            }
            if (UserPathChanged)
            {
                args += " /user " + PathAsCommandLineArgument(UserPath);
            }

            if (!UAC.Relaunch(args, NeedsElevation))
            {
                MessageBox.Show("The changes were NOT saved!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                Read();
            }
        }