mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
feat.增加一个是否检查更新的选项
This commit is contained in:
@@ -17,9 +17,10 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="3">
|
||||
<CheckBox IsChecked="{Binding AutoDownloadUpdatePackage}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10" Content="自动下载更新包 " />
|
||||
<CheckBox IsChecked="{Binding UpdateBeta}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10" Content="检查测试版本更新 " />
|
||||
<CheckBox IsChecked="{Binding UseAria2}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10" Content="使用aria2进行下载" />
|
||||
<CheckBox IsChecked="{Binding UpdateCheck}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="150" Margin="10" Content="检查更新" />
|
||||
<CheckBox IsChecked="{Binding AutoDownloadUpdatePackage}" IsEnabled="{Binding UpdateCheck}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="150" Margin="10" Content="自动下载更新包" />
|
||||
<CheckBox IsChecked="{Binding UpdateBeta}" IsEnabled="{Binding UpdateCheck}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="150" Margin="10" Content="检查测试版本更新" />
|
||||
<CheckBox IsChecked="{Binding UseAria2}" IsEnabled="{Binding UpdateCheck}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="150" Margin="10" Content="使用 aria2 进行下载" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Margin="3">
|
||||
<Grid>
|
||||
|
||||
@@ -712,6 +712,18 @@ namespace MeoAsstGui
|
||||
}
|
||||
}
|
||||
|
||||
private bool _updateCheck = Convert.ToBoolean(ViewStatusStorage.Get("VersionUpdate.UpdateCheck", bool.TrueString));
|
||||
|
||||
public bool UpdateCheck
|
||||
{
|
||||
get { return _updateCheck; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _updateCheck, value);
|
||||
ViewStatusStorage.Set("VersionUpdate.UpdateCheck", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private string _proxy = ViewStatusStorage.Get("VersionUpdate.Proxy", string.Empty);
|
||||
|
||||
public string Proxy
|
||||
|
||||
@@ -307,6 +307,10 @@ namespace MeoAsstGui
|
||||
public bool CheckUpdate()
|
||||
{
|
||||
var settings = _container.Get<SettingsViewModel>();
|
||||
if (!settings.UpdateCheck)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
const int requestRetryMaxTimes = 5;
|
||||
var response = RequestApi(RequestUrl);
|
||||
for (int i = 0; response.Length == 0 && i >= requestRetryMaxTimes; i++)
|
||||
|
||||
Reference in New Issue
Block a user