diff --git a/Plugins/HelloWorldCSharp/App.config b/Plugins/HelloWorldCSharp/App.config
index 88fa4027b..ecdcf8a54 100644
--- a/Plugins/HelloWorldCSharp/App.config
+++ b/Plugins/HelloWorldCSharp/App.config
@@ -1,6 +1,6 @@
-
+
-
+
-
\ No newline at end of file
+
diff --git a/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj b/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj
index 46006f098..684662df5 100644
--- a/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj
+++ b/Plugins/HelloWorldCSharp/HelloWorldCSharp.csproj
@@ -9,9 +9,10 @@
Properties
HelloWorldCSharp
HelloWorldCSharp
- v4.5.2
+ v4.7.2
512
true
+
AnyCPU
diff --git a/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj b/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj
index 413b0aec7..96dc790a0 100644
--- a/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj
+++ b/Plugins/Wox.Plugin.BrowserBookmark/Wox.Plugin.BrowserBookmark.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.BrowserBookmark
Wox.Plugin.BrowserBookmark
- v4.5.2
+ v4.7.2
512
..\..\
true
diff --git a/Plugins/Wox.Plugin.BrowserBookmark/app.config b/Plugins/Wox.Plugin.BrowserBookmark/app.config
index 376ff2d53..09d35ec8f 100644
--- a/Plugins/Wox.Plugin.BrowserBookmark/app.config
+++ b/Plugins/Wox.Plugin.BrowserBookmark/app.config
@@ -1,22 +1,22 @@
-
+
-
+
-
+
-
+
-
-
+
+
-
\ No newline at end of file
+
diff --git a/Plugins/Wox.Plugin.Calculator/Wox.Plugin.Calculator.csproj b/Plugins/Wox.Plugin.Calculator/Wox.Plugin.Calculator.csproj
index b0a091934..82230aa52 100644
--- a/Plugins/Wox.Plugin.Calculator/Wox.Plugin.Calculator.csproj
+++ b/Plugins/Wox.Plugin.Calculator/Wox.Plugin.Calculator.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.Caculator
Wox.Plugin.Caculator
- v4.5.2
+ v4.7.2
512
..\..\
diff --git a/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj b/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj
index ca75ed8f3..d61dceca1 100644
--- a/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj
+++ b/Plugins/Wox.Plugin.Color/Wox.Plugin.Color.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.Color
Wox.Plugin.Color
- v4.5.2
+ v4.7.2
512
diff --git a/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj b/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj
index 711cb8e29..dbc0e01ea 100644
--- a/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj
+++ b/Plugins/Wox.Plugin.ControlPanel/Wox.Plugin.ControlPanel.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.ControlPanel
Wox.Plugin.ControlPanel
- v4.5.2
+ v4.7.2
512
diff --git a/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj
index 2ec791bf8..ba45a5de7 100644
--- a/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj
+++ b/Plugins/Wox.Plugin.Everything/Wox.Plugin.Everything.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.Everything
Wox.Plugin.Everything
- v4.5.2
+ v4.7.2
512
..\Wox\
diff --git a/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj b/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj
index a75fa0ba9..d87e5d3aa 100644
--- a/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj
+++ b/Plugins/Wox.Plugin.Folder/Wox.Plugin.Folder.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.Folder
Wox.Plugin.Folder
- v4.5.2
+ v4.7.2
512
..\..\
diff --git a/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj b/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj
index 709016b06..9d202276b 100644
--- a/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj
+++ b/Plugins/Wox.Plugin.PluginIndicator/Wox.Plugin.PluginIndicator.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.PluginIndicator
Wox.Plugin.PluginIndicator
- v4.5.2
+ v4.7.2
512
diff --git a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj
index d963ea367..13081457f 100644
--- a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj
+++ b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.PluginManagement
Wox.Plugin.PluginManagement
- v4.5.2
+ v4.7.2
512
..\..\
diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj
index 17ccffaba..2bb84e641 100644
--- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj
+++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.Program
Wox.Plugin.Program
- v4.5.2
+ v4.7.2
512
..\..\
diff --git a/Plugins/Wox.Plugin.Shell/Wox.Plugin.Shell.csproj b/Plugins/Wox.Plugin.Shell/Wox.Plugin.Shell.csproj
index 7508783aa..998eb7ac6 100644
--- a/Plugins/Wox.Plugin.Shell/Wox.Plugin.Shell.csproj
+++ b/Plugins/Wox.Plugin.Shell/Wox.Plugin.Shell.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.Shell
Wox.Plugin.Shell
- v4.5.2
+ v4.7.2
512
..\..\
diff --git a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj
index 09a1e761f..aa6d15233 100644
--- a/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj
+++ b/Plugins/Wox.Plugin.Sys/Wox.Plugin.Sys.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.Sys
Wox.Plugin.Sys
- v4.5.2
+ v4.7.2
512
..\..\
diff --git a/Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj b/Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj
index bfdae9200..9c10da5ab 100644
--- a/Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj
+++ b/Plugins/Wox.Plugin.Url/Wox.Plugin.Url.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.Url
Wox.Plugin.Url
- v4.5.2
+ v4.7.2
512
diff --git a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj
index 7073487b7..64415af15 100644
--- a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj
+++ b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin.WebSearch
Wox.Plugin.WebSearch
- v4.5.2
+ v4.7.2
512
..\..\
diff --git a/Wox.Core/Wox.Core.csproj b/Wox.Core/Wox.Core.csproj
index c1758fdb3..f50cd42f4 100644
--- a/Wox.Core/Wox.Core.csproj
+++ b/Wox.Core/Wox.Core.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Core
Wox.Core
- v4.5.2
+ v4.7.2
512
..\
diff --git a/Wox.Infrastructure/Wox.Infrastructure.csproj b/Wox.Infrastructure/Wox.Infrastructure.csproj
index 16194a35a..3351f1841 100644
--- a/Wox.Infrastructure/Wox.Infrastructure.csproj
+++ b/Wox.Infrastructure/Wox.Infrastructure.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Infrastructure
Wox.Infrastructure
- v4.5.2
+ v4.7.2
512
..\
diff --git a/Wox.Plugin/Wox.Plugin.csproj b/Wox.Plugin/Wox.Plugin.csproj
index ceba2bbf0..ac66231f5 100644
--- a/Wox.Plugin/Wox.Plugin.csproj
+++ b/Wox.Plugin/Wox.Plugin.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Plugin
Wox.Plugin
- v4.5.2
+ v4.7.2
512
diff --git a/Wox.Test/Wox.Test.csproj b/Wox.Test/Wox.Test.csproj
index 7a3ef1f0c..480375b21 100644
--- a/Wox.Test/Wox.Test.csproj
+++ b/Wox.Test/Wox.Test.csproj
@@ -9,7 +9,7 @@
Properties
Wox.Test
Wox.Test
- v4.5.2
+ v4.7.2
512
..\
diff --git a/Wox/App.config b/Wox/App.config
index aef034f76..414689788 100644
--- a/Wox/App.config
+++ b/Wox/App.config
@@ -1,9 +1,9 @@
-
+
-
-
+
+
@@ -16,4 +16,4 @@
-
\ No newline at end of file
+
diff --git a/Wox/Helper/SingleInstance.cs b/Wox/Helper/SingleInstance.cs
index 2ea597a9a..951e49091 100644
--- a/Wox/Helper/SingleInstance.cs
+++ b/Wox/Helper/SingleInstance.cs
@@ -4,9 +4,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Channels.Ipc;
+using System.IO.Pipes;
using System.Runtime.Serialization.Formatters;
using System.Security;
using System.Text;
@@ -216,26 +214,11 @@ namespace Wox.Helper
///
private const string ChannelNameSuffix = "SingeInstanceIPCChannel";
- ///
- /// Remote service name.
- ///
- private const string RemoteServiceName = "SingleInstanceApplicationService";
-
- ///
- /// IPC protocol used (string).
- ///
- private const string IpcProtocol = "ipc://";
-
///
/// Application mutex.
///
internal static Mutex singleInstanceMutex;
- ///
- /// IPC channel for communications.
- ///
- private static IpcServerChannel channel;
-
#endregion
#region Public Properties
@@ -277,12 +260,6 @@ namespace Wox.Helper
public static void Cleanup()
{
singleInstanceMutex?.ReleaseMutex();
-
- if (channel != null)
- {
- ChannelServices.UnregisterChannel(channel);
- channel = null;
- }
}
#endregion
@@ -338,56 +315,43 @@ namespace Wox.Helper
}
///
- /// Creates a remote service for communication.
+ /// Creates a remote server pipe for communication.
+ /// Once receives signal from client, will activate first instance.
///
/// Application's IPC channel name.
- private static void CreateRemoteService(string channelName)
+ private static async void CreateRemoteService(string channelName)
{
- BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
- serverProvider.TypeFilterLevel = TypeFilterLevel.Full;
- IDictionary props = new Dictionary();
-
- props["name"] = channelName;
- props["portName"] = channelName;
- props["exclusiveAddressUse"] = "false";
-
- // Create the IPC Server channel with the channel properties
- channel = new IpcServerChannel(props, serverProvider);
-
- // Register the channel with the channel services
- ChannelServices.RegisterChannel(channel, true);
-
- // Expose the remote service with the REMOTE_SERVICE_NAME
- IPCRemoteService remoteService = new IPCRemoteService();
- RemotingServices.Marshal(remoteService, RemoteServiceName);
+ using (NamedPipeServerStream pipeServer = new NamedPipeServerStream(channelName, PipeDirection.In))
+ {
+ while(true)
+ {
+ // Wait for connection to the pipe
+ await pipeServer.WaitForConnectionAsync();
+ if (Application.Current != null)
+ {
+ // Do an asynchronous call to ActivateFirstInstance function
+ Application.Current.Dispatcher.Invoke(ActivateFirstInstance);
+ }
+ // Disconect client
+ pipeServer.Disconnect();
+ }
+ }
}
///
- /// Creates a client channel and obtains a reference to the remoting service exposed by the server -
- /// in this case, the remoting service exposed by the first instance. Calls a function of the remoting service
- /// class to pass on command line arguments from the second instance to the first and cause it to activate itself.
+ /// Creates a client pipe and sends a signal to server to launch first instance
///
/// Application's IPC channel name.
///
/// Command line arguments for the second instance, passed to the first instance to take appropriate action.
///
- private static void SignalFirstInstance(string channelName)
+ private static async void SignalFirstInstance(string channelName)
{
- IpcClientChannel secondInstanceChannel = new IpcClientChannel();
- ChannelServices.RegisterChannel(secondInstanceChannel, true);
-
- string remotingServiceUrl = IpcProtocol + channelName + "/" + RemoteServiceName;
-
- // Obtain a reference to the remoting service exposed by the server i.e the first instance of the application
- IPCRemoteService firstInstanceRemoteServiceReference = (IPCRemoteService)RemotingServices.Connect(typeof(IPCRemoteService), remotingServiceUrl);
-
- // Check that the remote service exists, in some cases the first instance may not yet have created one, in which case
- // the second instance should just exit
- if (firstInstanceRemoteServiceReference != null)
+ // Create a client pipe connected to server
+ using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", channelName, PipeDirection.Out))
{
- // Invoke a method of the remote service exposed by the first instance passing on the command line
- // arguments and causing the first instance to activate itself
- firstInstanceRemoteServiceReference.InvokeFirstInstance();
+ // Connect to the available pipe
+ await pipeClient.ConnectAsync(0);
}
}
@@ -427,17 +391,6 @@ namespace Wox.Helper
///
private class IPCRemoteService : MarshalByRefObject
{
- ///
- /// Activates the first instance of the application.
- ///
- public void InvokeFirstInstance()
- {
- if (Application.Current != null)
- {
- // Do an asynchronous call to ActivateFirstInstance function
- Application.Current.Dispatcher.Invoke(ActivateFirstInstance);
- }
- }
///
/// Remoting Object's ease expires after every 5 minutes by default. We need to override the InitializeLifetimeService class
diff --git a/Wox/Properties/Resources.Designer.cs b/Wox/Properties/Resources.Designer.cs
index 20e0fb225..26a9ddff9 100644
--- a/Wox/Properties/Resources.Designer.cs
+++ b/Wox/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace Wox.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
diff --git a/Wox/Properties/Settings.Designer.cs b/Wox/Properties/Settings.Designer.cs
index a61339f5e..be9020f6e 100644
--- a/Wox/Properties/Settings.Designer.cs
+++ b/Wox/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace Wox.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/Wox/ResultListBox.xaml.cs b/Wox/ResultListBox.xaml.cs
index d448d02ca..6b4664490 100644
--- a/Wox/ResultListBox.xaml.cs
+++ b/Wox/ResultListBox.xaml.cs
@@ -1,13 +1,12 @@
-using System.Runtime.Remoting.Contexts;
-using System.Windows;
+using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Wox
{
- [Synchronization]
public partial class ResultListBox
{
+ protected object _lock = new object();
private Point _lastpos;
private ListBoxItem curItem = null;
public ResultListBox()
@@ -25,25 +24,34 @@ namespace Wox
private void OnMouseEnter(object sender, MouseEventArgs e)
{
- curItem = (ListBoxItem)sender;
- var p = e.GetPosition((IInputElement)sender);
- _lastpos = p;
+ lock(_lock)
+ {
+ curItem = (ListBoxItem)sender;
+ var p = e.GetPosition((IInputElement)sender);
+ _lastpos = p;
+ }
}
private void OnMouseMove(object sender, MouseEventArgs e)
{
- var p = e.GetPosition((IInputElement)sender);
- if (_lastpos != p)
+ lock(_lock)
{
- ((ListBoxItem) sender).IsSelected = true;
+ var p = e.GetPosition((IInputElement)sender);
+ if (_lastpos != p)
+ {
+ ((ListBoxItem)sender).IsSelected = true;
+ }
}
}
private void ListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
- if (curItem != null)
+ lock(_lock)
{
- curItem.IsSelected = true;
+ if (curItem != null)
+ {
+ curItem.IsSelected = true;
+ }
}
}
}
diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj
index 3b942ca65..04f5eea1e 100644
--- a/Wox/Wox.csproj
+++ b/Wox/Wox.csproj
@@ -9,7 +9,7 @@
Properties
Wox
Wox
- v4.5.2
+ v4.7.2
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
4