ReSharper: remove redundant code

This commit is contained in:
bao-qian
2016-01-06 21:34:42 +00:00
parent ae42c4df16
commit 0daa3a8f57
65 changed files with 279 additions and 250 deletions

View File

@@ -25,7 +25,7 @@ namespace Wox.Helper
{
if (!DropShadow(window))
{
window.SourceInitialized += new EventHandler(window_SourceInitialized);
window.SourceInitialized += window_SourceInitialized;
}
}
@@ -35,7 +35,7 @@ namespace Wox.Helper
DropShadow(window);
window.SourceInitialized -= new EventHandler(window_SourceInitialized);
window.SourceInitialized -= window_SourceInitialized;
}
/// <summary>

View File

@@ -16,14 +16,14 @@ namespace Wox.Helper
public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
{
//handle non-ui thread exceptions
App.Window.Dispatcher.Invoke(new Action(() =>
App.Window.Dispatcher.Invoke(() =>
{
Report((Exception)e.ExceptionObject);
if (!(e.ExceptionObject is WoxException))
{
Environment.Exit(0);
}
}));
});
}
public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)

View File

@@ -9,6 +9,7 @@ using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;
using System.Runtime.Serialization.Formatters;
using System.Security;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Threading;
@@ -131,7 +132,7 @@ namespace Wox.Helper
// This is the hard-coded message value used by WinForms for Shell_NotifyIcon.
// It's relatively safe to reuse.
TRAYMOUSEMESSAGE = 0x800, //WM_USER + 1024
APP = 0x8000,
APP = 0x8000
}
[SuppressUnmanagedCodeSecurity]
@@ -342,7 +343,7 @@ namespace Wox.Helper
{
try
{
using (TextReader reader = new StreamReader(cmdLinePath, System.Text.Encoding.Unicode))
using (TextReader reader = new StreamReader(cmdLinePath, Encoding.Unicode))
{
args = NativeMethods.CommandLineToArgvW(reader.ReadToEnd());
}
@@ -465,7 +466,7 @@ namespace Wox.Helper
{
// Do an asynchronous call to ActivateFirstInstance function
Application.Current.Dispatcher.BeginInvoke(
DispatcherPriority.Normal, new DispatcherOperationCallback(SingleInstance<TApplication>.ActivateFirstInstanceCallback), args);
DispatcherPriority.Normal, new DispatcherOperationCallback(ActivateFirstInstanceCallback), args);
}
}

View File

@@ -35,7 +35,7 @@ namespace Wox.Helper
{
try
{
var parts = result.ToString().Trim().Split(new char[] {' '}, 3).Select(byte.Parse).ToList();
var parts = result.ToString().Trim().Split(new[] {' '}, 3).Select(byte.Parse).ToList();
return Color.FromRgb(parts[0], parts[1], parts[2]);
}
catch