示例#1
0
        private void LaunchInternal(bool elevated)
        {
            var newFilename = Path.Combine(Path.GetTempPath(), DateTime.Now.ToString("yyyy-MM-dd_HHmmss")) + ".sln";

            new SaveSolutionCommand(_settings, newFilename, _settings.VisualStudioVersion, this).Execute();
            var exePath = VisualStudioHelper.GetVisualStudioExecutable(_settings.VisualStudioVersion);
            var psi     = new ProcessStartInfo(exePath, newFilename);

            if (elevated)
            {
                psi.Verb = "runas";
            }
            Process.Start(psi);
            Application.Current.MainWindow.WindowState = WindowState.Minimized;
        }
示例#2
0
        private void Launch(bool elevated)
        {
            InternalSave(null);
            var exePath = VisualStudioHelper.GetVisualStudioExecutable(_settings.VisualStudioVersion);
            var psi     = new ProcessStartInfo(exePath, "\"" + FileName + "\"");

            if (elevated)
            {
                psi.Verb = "runas";
            }
            try {
                Process.Start(psi);
                Application.Current.MainWindow.WindowState = WindowState.Minimized;
            } catch (Win32Exception ex) {
                // if NativeErrorCode = 1223, the user cancelled the UAC dialog
                if (ex.NativeErrorCode != 1223)
                {
                    throw;
                }
            }
        }