mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 01:59:33 +08:00
feat: 更新类别使用下拉框,找不到OTA时弹出消息而不是错误框
This commit is contained in:
@@ -122,6 +122,7 @@
|
||||
|
||||
<system:String x:Key="UpdateAutoCheck">Auto check update</system:String>
|
||||
<system:String x:Key="UpdateAutoDownload">Auto download update</system:String>
|
||||
<system:String x:Key="UpdateCheckStable">Stable release</system:String>
|
||||
<system:String x:Key="UpdateCheckBeta">Beta release</system:String>
|
||||
<system:String x:Key="UpdateCheckNightly">Nightly release</system:String>
|
||||
<system:String x:Key="DownloadWithAria2">Download via aria2</system:String>
|
||||
|
||||
@@ -122,8 +122,9 @@
|
||||
|
||||
<system:String x:Key="UpdateAutoCheck">自动检查更新</system:String>
|
||||
<system:String x:Key="UpdateAutoDownload">自动下载更新包</system:String>
|
||||
<system:String x:Key="UpdateCheckBeta">检查测试版本更新</system:String>
|
||||
<system:String x:Key="UpdateCheckNightly">检查内测版本更新</system:String>
|
||||
<system:String x:Key="UpdateCheckStable">稳定版</system:String>
|
||||
<system:String x:Key="UpdateCheckBeta">测试版</system:String>
|
||||
<system:String x:Key="UpdateCheckNightly">内测版</system:String>
|
||||
<system:String x:Key="DownloadWithAria2">使用 aria2 进行下载</system:String>
|
||||
<system:String x:Key="UpdateCheckNow">检查更新</system:String>
|
||||
|
||||
|
||||
@@ -36,20 +36,23 @@
|
||||
Content="{DynamicResource UpdateAutoDownload}"
|
||||
IsChecked="{Binding AutoDownloadUpdatePackage}"
|
||||
IsEnabled="{Binding UpdateCheck}" />
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
<StackPanel
|
||||
VerticalAlignment="Center"
|
||||
Content="{DynamicResource UpdateCheckBeta}"
|
||||
IsChecked="{Binding UpdateBeta}"
|
||||
IsEnabled="{Binding UpdateCheck}" />
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Content="{DynamicResource UpdateCheckNightly}"
|
||||
IsChecked="{Binding UpdateNightly}"
|
||||
IsEnabled="{Binding UpdateCheck}" />
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="10"
|
||||
Block.TextAlignment="Center"
|
||||
Style="{StaticResource TextBlockDefault}"
|
||||
Text="{DynamicResource UpdateCheckNow}" />
|
||||
<ComboBox
|
||||
Width="85"
|
||||
Margin="10"
|
||||
DisplayMemberPath="Display"
|
||||
IsEnabled="{Binding UpdateCheck}"
|
||||
ItemsSource="{Binding VersionTypeList}"
|
||||
SelectedValue="{Binding VersionType}"
|
||||
SelectedValuePath="Value" />
|
||||
</StackPanel>
|
||||
<CheckBox
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
|
||||
@@ -230,6 +230,13 @@ namespace MeoAsstGui
|
||||
new CombData { Display = Localization.GetString("Switchable"), Value = "ClearInverse" },
|
||||
};
|
||||
|
||||
VersionTypeList = new List<CombData>
|
||||
{
|
||||
new CombData { Display = Localization.GetString("UpdateCheckStable"), Value = "Stable" },
|
||||
new CombData { Display = Localization.GetString("UpdateCheckBeta"), Value = "Beta" },
|
||||
new CombData { Display = Localization.GetString("UpdateCheckNightly"), Value = "Nightly" },
|
||||
};
|
||||
|
||||
LanguageList = new List<CombData>();
|
||||
foreach (var pair in Localization.SupportedLanguages)
|
||||
{
|
||||
@@ -494,6 +501,11 @@ namespace MeoAsstGui
|
||||
/// </summary>
|
||||
public List<CombData> InverseClearModeList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of the version type.
|
||||
/// </summary>
|
||||
public List<CombData> VersionTypeList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language list.
|
||||
/// </summary>
|
||||
@@ -1379,34 +1391,35 @@ namespace MeoAsstGui
|
||||
}
|
||||
|
||||
/* 软件更新设置 */
|
||||
private bool _updateNightly = Convert.ToBoolean(ViewStatusStorage.Get("VersionUpdate.UpdateNightly", bool.FalseString));
|
||||
private string _versionType = ViewStatusStorage.Get("VersionUpdate.VersionType", "Stable");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to update nightly.
|
||||
/// Gets or sets the type of version to update.
|
||||
/// </summary>
|
||||
public bool UpdateNightly
|
||||
public string VersionType
|
||||
{
|
||||
get => _updateNightly;
|
||||
get => _versionType;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _updateNightly, value);
|
||||
ViewStatusStorage.Set("VersionUpdate.UpdateNightly", value.ToString());
|
||||
SetAndNotify(ref _versionType, value);
|
||||
ViewStatusStorage.Set("VersionUpdate.VersionType", value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _updateBeta = Convert.ToBoolean(ViewStatusStorage.Get("VersionUpdate.UpdateBeta", bool.FalseString));
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether to update nightly.
|
||||
/// </summary>
|
||||
public bool UpdateNightly
|
||||
{
|
||||
get => _versionType == "Nightly";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to update beta version.
|
||||
/// Gets a value indicating whether to update beta version.
|
||||
/// </summary>
|
||||
public bool UpdateBeta
|
||||
{
|
||||
get => _updateBeta;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _updateBeta, value);
|
||||
ViewStatusStorage.Set("VersionUpdate.UpdateBeta", value.ToString());
|
||||
}
|
||||
get => _versionType == "Beta";
|
||||
}
|
||||
|
||||
private bool _updateCheck = Convert.ToBoolean(ViewStatusStorage.Get("VersionUpdate.UpdateCheck", bool.TrueString));
|
||||
|
||||
@@ -530,8 +530,15 @@ namespace MeoAsstGui
|
||||
return true;
|
||||
}
|
||||
|
||||
var errorView = new ErrorView("Download Failed", "It was not possible to find a suitable OTA file to download.", false);
|
||||
errorView.ShowDialog();
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
using (var toast = new ToastNotification("找不到合适的更新文件"))
|
||||
{
|
||||
toast.AppendContentText("新版本:" + _latestVersion)
|
||||
.AppendContentText("请自行下载完整包更新!")
|
||||
.ShowUpdateVersion();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user