Removing Squirrel dll. unsure on updating so i kept that logic in

This commit is contained in:
Clint Rutkas
2020-04-03 17:30:33 -07:00
parent 5b02501038
commit 35e9091863
6 changed files with 71 additions and 243 deletions

View File

@@ -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();
@@ -95,50 +88,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
@@ -254,11 +203,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");
@@ -365,9 +309,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