ScriptShop_NoDelete_Basics

This commit is contained in:
Mossimo
2021-04-29 16:05:53 +08:00
parent 4766e6abbc
commit c9cdef47ef
6 changed files with 42 additions and 13 deletions
@@ -101,7 +101,7 @@
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Home,Mode=OneWay,Source={x:Static resx:R.Current}}">
<PathIcon Width="16" Data="{StaticResource HomeDrawing}" />
</Button>
<Button IsVisible="{Binding !DownloadLoading}" Background="Transparent" Cursor="Hand"
<Button IsVisible="{Binding DownloadButtonLoading}" Background="Transparent" Cursor="Hand"
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
CommandParameter="{Binding}"
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Install,Mode=OneWay,Source={x:Static resx:R.Current}}">
@@ -379,6 +379,7 @@ namespace System.Application.Services
Current.ProxyScripts.Add(build.model);
}
model.IsUpdate = false;
model.IsExist = true;
model.UpdateLink = build.model.UpdateLink;
model.Version = build.model.Version;
model.Name = build.model.Name;
+9
View File
@@ -1890,6 +1890,15 @@ namespace System.Application.UI.Resx {
}
}
/// <summary>
/// 查找类似 GM是基础框架不允许删除 的本地化字符串。
/// </summary>
public static string ScriptShop_NoDelete_Basics {
get {
return ResourceManager.GetString("ScriptShop_NoDelete_Basics", resourceCulture);
}
}
/// <summary>
/// 查找类似 使用脚本工坊需要先登录。 的本地化字符串。
/// </summary>
@@ -696,6 +696,9 @@
<data name="ScriptShop_GetTableError" xml:space="preserve">
<value>获取脚本工坊列表失败。</value>
</data>
<data name="ScriptShop_NoDelete_Basics" xml:space="preserve">
<value>GM是基础框架不允许删除</value>
</data>
<data name="ScriptShop_NoLogin" xml:space="preserve">
<value>使用脚本工坊需要先登录。</value>
</data>
@@ -1023,4 +1026,4 @@
<data name="Welcome" xml:space="preserve">
<value>起始页</value>
</data>
</root>
</root>
@@ -123,20 +123,26 @@ namespace System.Application.UI.ViewModels
public void DeleteScriptItemButton(ScriptDTO script)
{
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_DeleteItem, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
if (script.Id == Guid.Parse("00000000-0000-0000-0000-000000000001"))
{
if (s.Result == MessageBoxResultCompat.OK)
var result = MessageBoxCompat.ShowAsync(@AppResources.ScriptShop_NoDelete_Basics, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OK);
}
else {
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_DeleteItem, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
{
var item = await DI.Get<IScriptManagerService>().DeleteScriptAsync(script);
if (item.state)
if (s.Result == MessageBoxResultCompat.OK)
{
if (ProxyService.Current.ProxyScripts != null)
ProxyService.Current.ProxyScripts.Remove(script);
var item = await DI.Get<IScriptManagerService>().DeleteScriptAsync(script);
if (item.state)
{
if (ProxyService.Current.ProxyScripts != null)
ProxyService.Current.ProxyScripts.Remove(script);
}
Toast.Show(item.msg);
}
Toast.Show(item.msg);
}
});
});
}
}
public void EditScriptItemButton(ScriptDTO script)
@@ -39,7 +39,12 @@ namespace System.Application.Models
public ScriptDTO()
{
this.WhenAnyValue(x => x.IsUpdate, c => c.IsLoading, v => v.IsExist)
.Subscribe(_ => this.RaisePropertyChanged(nameof(DownloadLoading)));
.Subscribe(_ =>
{
this.RaisePropertyChanged(nameof(DownloadLoading));
this.RaisePropertyChanged(nameof(DownloadButtonLoading));
});
}
public static bool TryParse(string path, [NotNullWhen(true)] out ScriptDTO? proxyScript)
@@ -134,7 +139,12 @@ namespace System.Application.Models
[MPIgnore]
[N_JsonIgnore]
[S_JsonIgnore]
public bool DownloadLoading => !IsUpdate && IsLoading && !IsExist;
public bool DownloadLoading => !IsUpdate && IsLoading;
[MPIgnore]
[N_JsonIgnore]
[S_JsonIgnore]
public bool DownloadButtonLoading => !IsExist && !DownloadLoading;
private bool _IsLoading = false;
[MPIgnore]