mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
Merge pull request #46 from microsoft/dev/crutkas/removeUpdater
Removing Squirrel dll. unsure on updating so i kept that logic in
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user