Merging master into changes from launcherUI. Wox.Infrastructure assembly info I took the changes from both branches as they will be needed. This currently doesn't build I will make the changes to get it building atomically.
@@ -25,7 +25,6 @@ namespace Wox
|
||||
private Settings _settings;
|
||||
private MainViewModel _mainVM;
|
||||
private SettingWindowViewModel _settingsVM;
|
||||
private readonly Updater _updater = new Updater(Wox.Properties.Settings.Default.GithubRepo);
|
||||
private readonly Alphabet _alphabet = new Alphabet();
|
||||
private StringMatcher _stringMatcher;
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace Wox
|
||||
|
||||
ImageLoader.Initialize();
|
||||
|
||||
_settingsVM = new SettingWindowViewModel(_updater);
|
||||
_settingsVM = new SettingWindowViewModel();
|
||||
_settings = _settingsVM.Settings;
|
||||
|
||||
_alphabet.Initialize(_settings);
|
||||
@@ -83,40 +82,11 @@ namespace Wox
|
||||
|
||||
RegisterExitEvents();
|
||||
|
||||
AutoStartup();
|
||||
AutoUpdates();
|
||||
|
||||
_mainVM.MainWindowVisibility = _settings.HideOnStartup ? Visibility.Hidden : Visibility.Visible;
|
||||
Log.Info("|App.OnStartup|End Wox startup ---------------------------------------------------- ");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void AutoStartup()
|
||||
{
|
||||
}
|
||||
|
||||
//[Conditional("RELEASE")]
|
||||
private void AutoUpdates()
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
if (_settings.AutoUpdates)
|
||||
{
|
||||
// check udpate every 5 hours
|
||||
var timer = new Timer(1000 * 60 * 60 * 5);
|
||||
timer.Elapsed += async (s, e) =>
|
||||
{
|
||||
await _updater.UpdateApp();
|
||||
};
|
||||
timer.Start();
|
||||
|
||||
// check updates on startup
|
||||
await _updater.UpdateApp();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void RegisterExitEvents()
|
||||
{
|
||||
AppDomain.CurrentDomain.ProcessExit += (s, e) => Dispose();
|
||||
|
||||
@@ -31,6 +31,16 @@
|
||||
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="SuppressWarnings" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@@ -63,9 +63,10 @@ namespace Wox.Properties {
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon app {
|
||||
internal static System.Drawing.Icon placeholderLauncher
|
||||
{
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("app", resourceCulture);
|
||||
object obj = ResourceManager.GetObject("placeholderLauncher", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,13 +112,13 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="app" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="placeholderLauncher" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\placeholderLauncher.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -25,7 +25,7 @@ namespace Wox.Properties {
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://github.com/Wox-launcher/Wox")]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("https://github.com/Microsoft/PowerToys")]
|
||||
public string GithubRepo {
|
||||
get {
|
||||
return ((string)(this["GithubRepo"]));
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Wox.Properties" GeneratedClassName="Settings">
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Launcher.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="GithubRepo" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">https://github.com/Wox-launcher/Wox</Value>
|
||||
<Value Profile="(Default)">https://github.com/Microsoft/PowerToys</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -4,8 +4,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Squirrel;
|
||||
using Wox.Core;
|
||||
|
||||
using Wox.Core.Plugin;
|
||||
using Wox.Core.Resource;
|
||||
using Wox.Helper;
|
||||
@@ -63,12 +62,12 @@ namespace Wox
|
||||
// which will cause ungraceful exit
|
||||
SaveAppAllSettings();
|
||||
|
||||
UpdateManager.RestartApp();
|
||||
Squirrel.UpdateManager.RestartApp();
|
||||
}
|
||||
|
||||
public void CheckForNewUpdate()
|
||||
{
|
||||
_settingsVM.UpdateApp();
|
||||
//_settingsVM.UpdateApp();
|
||||
}
|
||||
|
||||
public void SaveAppAllSettings()
|
||||
@@ -101,7 +100,7 @@ namespace Wox
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
var msg = useMainWindowAsOwner ? new Msg {Owner = Application.Current.MainWindow} : new Msg();
|
||||
var msg = useMainWindowAsOwner ? new Msg { Owner = Application.Current.MainWindow } : new Msg();
|
||||
msg.Show(title, subTitle, iconPath);
|
||||
});
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 32 KiB |
BIN
src/modules/launcher/Wox/Resources/placeholderLauncher.ico
Normal file
|
After Width: | Height: | Size: 44 KiB |
@@ -6,7 +6,6 @@ namespace Wox
|
||||
{
|
||||
public partial class ResultListBox
|
||||
{
|
||||
protected object _lock = new object();
|
||||
private Point _lastpos;
|
||||
private ListBoxItem curItem = null;
|
||||
public ResultListBox()
|
||||
@@ -24,34 +23,25 @@ namespace Wox
|
||||
|
||||
private void OnMouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
lock(_lock)
|
||||
{
|
||||
curItem = (ListBoxItem)sender;
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
_lastpos = p;
|
||||
}
|
||||
curItem = (ListBoxItem)sender;
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
_lastpos = p;
|
||||
}
|
||||
|
||||
private void OnMouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
lock(_lock)
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
if (_lastpos != p)
|
||||
{
|
||||
var p = e.GetPosition((IInputElement)sender);
|
||||
if (_lastpos != p)
|
||||
{
|
||||
((ListBoxItem)sender).IsSelected = true;
|
||||
}
|
||||
((ListBoxItem)sender).IsSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
lock(_lock)
|
||||
if (curItem != null)
|
||||
{
|
||||
if (curItem != null)
|
||||
{
|
||||
curItem.IsSelected = true;
|
||||
}
|
||||
curItem.IsSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
65
src/modules/launcher/Wox/UpdateManager.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
// code block is from
|
||||
// unblocking https://github.com/Squirrel/Squirrel.Windows/blob/master/src/Squirrel/UpdateManager.cs
|
||||
// https://github.com/Squirrel/Squirrel.Windows/blob/develop/COPYING
|
||||
// license is MIT
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
namespace Squirrel
|
||||
{
|
||||
public sealed partial class UpdateManager
|
||||
{
|
||||
public static void RestartApp(string exeToStart = null, string arguments = null)
|
||||
{
|
||||
// NB: Here's how this method works:
|
||||
//
|
||||
// 1. We're going to pass the *name* of our EXE and the params to
|
||||
// Update.exe
|
||||
// 2. Update.exe is going to grab our PID (via getting its parent),
|
||||
// then wait for us to exit.
|
||||
// 3. We exit cleanly, dropping any single-instance mutexes or
|
||||
// whatever.
|
||||
// 4. Update.exe unblocks, then we launch the app again, possibly
|
||||
// launching a different version than we started with (this is why
|
||||
// we take the app's *name* rather than a full path)
|
||||
|
||||
exeToStart = exeToStart ?? Path.GetFileName(Assembly.GetEntryAssembly().Location);
|
||||
var argsArg = arguments != null ?
|
||||
string.Format("-a \"{0}\"", arguments) : "";
|
||||
|
||||
Process.Start(getUpdateExe(), string.Format("--processStartAndWait {0} {1}", exeToStart, argsArg));
|
||||
|
||||
// NB: We have to give update.exe some time to grab our PID, but
|
||||
// we can't use WaitForInputIdle because we probably don't have
|
||||
// whatever WaitForInputIdle considers a message loop.
|
||||
Thread.Sleep(500);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
static string getUpdateExe()
|
||||
{
|
||||
var assembly = Assembly.GetEntryAssembly();
|
||||
|
||||
// Are we update.exe?
|
||||
if (assembly != null &&
|
||||
Path.GetFileName(assembly.Location).Equals("update.exe", StringComparison.OrdinalIgnoreCase) &&
|
||||
assembly.Location.IndexOf("app-", StringComparison.OrdinalIgnoreCase) == -1 &&
|
||||
assembly.Location.IndexOf("SquirrelTemp", StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
return Path.GetFullPath(assembly.Location);
|
||||
}
|
||||
|
||||
assembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
|
||||
|
||||
var updateDotExe = Path.Combine(Path.GetDirectoryName(assembly.Location), "..\\Update.exe");
|
||||
var target = new FileInfo(updateDotExe);
|
||||
|
||||
if (!target.Exists) throw new Exception("Update.exe not found, not a Squirrel-installed app?");
|
||||
return target.FullName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,10 @@ namespace Wox.ViewModel
|
||||
{
|
||||
public class SettingWindowViewModel : BaseModel
|
||||
{
|
||||
private readonly Updater _updater;
|
||||
private readonly WoxJsonStorage<Settings> _storage;
|
||||
|
||||
public SettingWindowViewModel(Updater updater)
|
||||
public SettingWindowViewModel()
|
||||
{
|
||||
_updater = updater;
|
||||
_storage = new WoxJsonStorage<Settings>();
|
||||
Settings = _storage.Load();
|
||||
Settings.PropertyChanged += (s, e) =>
|
||||
@@ -42,11 +40,6 @@ namespace Wox.ViewModel
|
||||
|
||||
public Settings Settings { get; set; }
|
||||
|
||||
public async void UpdateApp()
|
||||
{
|
||||
await _updater.UpdateApp(false);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_storage.Save();
|
||||
@@ -122,50 +115,6 @@ namespace Wox.ViewModel
|
||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
||||
|
||||
public string TestProxy()
|
||||
{
|
||||
var proxyServer = Settings.Proxy.Server;
|
||||
var proxyUserName = Settings.Proxy.UserName;
|
||||
if (string.IsNullOrEmpty(proxyServer))
|
||||
{
|
||||
return InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty");
|
||||
}
|
||||
if (Settings.Proxy.Port <= 0)
|
||||
{
|
||||
return InternationalizationManager.Instance.GetTranslation("portCantBeEmpty");
|
||||
}
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_updater.GitHubRepository);
|
||||
|
||||
if (string.IsNullOrEmpty(proxyUserName) || string.IsNullOrEmpty(Settings.Proxy.Password))
|
||||
{
|
||||
request.Proxy = new WebProxy(proxyServer, Settings.Proxy.Port);
|
||||
}
|
||||
else
|
||||
{
|
||||
request.Proxy = new WebProxy(proxyServer, Settings.Proxy.Port)
|
||||
{
|
||||
Credentials = new NetworkCredential(proxyUserName, Settings.Proxy.Password)
|
||||
};
|
||||
}
|
||||
try
|
||||
{
|
||||
var response = (HttpWebResponse)request.GetResponse();
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
return InternationalizationManager.Instance.GetTranslation("proxyIsCorrect");
|
||||
}
|
||||
else
|
||||
{
|
||||
return InternationalizationManager.Instance.GetTranslation("proxyConnectFailed");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return InternationalizationManager.Instance.GetTranslation("proxyConnectFailed");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region plugin
|
||||
@@ -281,11 +230,6 @@ namespace Wox.ViewModel
|
||||
Title = "Install plugins from: ",
|
||||
SubTitle = Plugin
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = $"Open Source: {_updater.GitHubRepository}",
|
||||
SubTitle = "Please star it!"
|
||||
}
|
||||
};
|
||||
var vm = new ResultsViewModel();
|
||||
vm.AddResults(results, "PREVIEW");
|
||||
@@ -392,9 +336,6 @@ namespace Wox.ViewModel
|
||||
#endregion
|
||||
|
||||
#region about
|
||||
|
||||
public string Github => _updater.GitHubRepository;
|
||||
public string ReleaseNotes => _updater.GitHubRepository + @"/releases/latest";
|
||||
public static string Version => Constant.Version;
|
||||
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
|
||||
#endregion
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<StartupObject>Wox.App</StartupObject>
|
||||
<ApplicationIcon>Resources\app.ico</ApplicationIcon>
|
||||
<ApplicationIcon>Resources\placeholderLauncher.ico</ApplicationIcon>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<AssemblyName>PowerLauncher</AssemblyName>
|
||||
<Platforms>x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -60,17 +61,18 @@
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
|
||||
<PackageReference Include="Mages" Version="1.6.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NHotkey.Wpf" Version="1.2.1" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.0" />
|
||||
<PackageReference Include="NHotkey.Wpf" Version="2.0.0" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.1" />
|
||||
<PackageReference Include="NuGet.CommandLine" Version="5.4.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.2.6" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.2.7" />
|
||||
<PackageReference Include="System.Data.SQLite" Version="1.0.112" />
|
||||
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.112" />
|
||||
<PackageReference Include="System.Runtime" Version="4.3.1" />
|
||||
<PackageReference Include="UnidecodeSharp" Version="1.0.0" />
|
||||
<PackageReference Include="System.Data.OleDb" Version="5.0.0-preview.2.20160.6" />
|
||||
<PackageReference Include="tlbimp-Microsoft.Search.Interop" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -181,11 +183,8 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -NoProfile -ExecutionPolicy Bypass -File $(SolutionDir)src\modules\launcher\Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir)src\modules\launcher" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="taskkill /f /fi "IMAGENAME eq Wox.exe"" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |