mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
Fix Wox restart
1. refactoring restart 2. delte some windows forms methods 3. using string inteperlation and delete hard coeded new line char should fix #322
This commit is contained in:
@@ -205,22 +205,19 @@ namespace Wox.Plugin.PluginManagement
|
||||
|
||||
private void UnInstallPlugin(PluginMetadata plugin)
|
||||
{
|
||||
string content = string.Format("Do you want to uninstall following plugin?\r\n\r\nName: {0}\r\nVersion: {1}\r\nAuthor: {2}", plugin.Name, plugin.Version, plugin.Author);
|
||||
string content = $"Do you want to uninstall following plugin?{Environment.NewLine}{Environment.NewLine}" +
|
||||
$"Name: {plugin.Name}{Environment.NewLine}" +
|
||||
$"Version: {plugin.Version}{Environment.NewLine}" +
|
||||
$"Author: {plugin.Author}";
|
||||
if (MessageBox.Show(content, "Wox", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
File.Create(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt")).Close();
|
||||
if (MessageBox.Show(
|
||||
"You have uninstalled plugin " + plugin.Name + " successfully.\r\n Restart Wox to take effect?",
|
||||
"Install plugin",
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||
var result = MessageBox.Show($"You have uninstalled plugin {plugin.Name} successfully.{Environment.NewLine}" +
|
||||
"Restart Wox to take effect?",
|
||||
"Install plugin", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
ProcessStartInfo Info = new ProcessStartInfo();
|
||||
Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Assembly.GetExecutingAssembly().Location + "\"";
|
||||
Info.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
Info.CreateNoWindow = true;
|
||||
Info.FileName = "cmd.exe";
|
||||
Process.Start(Info);
|
||||
context.API.CloseApp();
|
||||
context.API.RestarApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Presentation" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="HttpRequest.cs" />
|
||||
|
||||
@@ -171,14 +171,8 @@ namespace Wox.Plugin.Sys
|
||||
IcoPath = "Images\\restart.png",
|
||||
Action = (c) =>
|
||||
{
|
||||
ProcessStartInfo Info = new ProcessStartInfo();
|
||||
Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + FormsApplication.ExecutablePath + "\"";
|
||||
Info.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
Info.CreateNoWindow = true;
|
||||
Info.FileName = "cmd.exe";
|
||||
Process.Start(Info);
|
||||
context.API.CloseApp();
|
||||
return true;
|
||||
context.API.RestarApp();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
new Result
|
||||
|
||||
Reference in New Issue
Block a user