Exemplo n.º 1
0
 private void LaunchElevated(string id, string profile)
 {
     try
     {
         string path = "shell:AppsFolder\\" + id;
         Helper.OpenInShell(path, TerminalHelper.GetArguments(profile, _openNewTab), runAs: Helper.ShellRunAsType.Administrator);
     }
     catch (Exception ex)
     {
         var name    = "Plugin: " + Resources.plugin_name;
         var message = Resources.run_terminal_failed;
         Log.Exception("Failed to open Windows Terminal", ex, GetType());
         _context.API.ShowMsg(name, message, string.Empty);
     }
 }
Exemplo n.º 2
0
        private void LaunchElevated(string id, string profile)
        {
            try
            {
                string path = "shell:AppsFolder\\" + id;
                Helper.OpenInShell(path, TerminalHelper.GetArguments(profile, _openNewTab), runAsAdmin: true);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                var name    = "Plugin: " + Resources.plugin_name;
                var message = Resources.run_terminal_failed;
                Log.Exception("Failed to open Windows Terminal", ex, GetType());
                _context.API.ShowMsg(name, message, string.Empty);
            }
        }
Exemplo n.º 3
0
        private void Launch(string id, string profile)
        {
            var appManager = new ApplicationActivationManager();
            const ActivateOptions noFlags = ActivateOptions.None;
            var queryArguments            = TerminalHelper.GetArguments(profile, _openNewTab);

            try
            {
                appManager.ActivateApplication(id, queryArguments, noFlags, out var unusedPid);
            }
            catch (Exception ex)
            {
                var name    = "Plugin: " + Resources.plugin_name;
                var message = Resources.run_terminal_failed;
                Log.Exception("Failed to open Windows Terminal", ex, GetType());
                _context.API.ShowMsg(name, message, string.Empty);
            }
        }
Exemplo n.º 4
0
        public void ArgumentsTest(string profile, bool openNewTab, string expectedArguments)
        {
            var arguments = TerminalHelper.GetArguments(profile, openNewTab);

            Assert.AreEqual(arguments, expectedArguments);
        }