mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-28 23:19:53 +08:00
fix tipsmsg
This commit is contained in:
@@ -316,7 +316,7 @@ namespace System.Application.Services
|
||||
var jspath = await DI.Get<IScriptManagerService>().DownloadScript(basicsInfo.Content.UpdateLink);
|
||||
if (jspath.state)
|
||||
{
|
||||
var build = await DI.Get<IScriptManagerService>().AddScriptAsync(jspath.path, build: false, order: 1, deleteFile: true, pid: basicsInfo.Content.Id,ignoreCache:true);
|
||||
var build = await DI.Get<IScriptManagerService>().AddScriptAsync(jspath.path, build: false, order: 1, deleteFile: true, pid: basicsInfo.Content.Id, ignoreCache: true);
|
||||
if (build.state)
|
||||
{
|
||||
if (build.model != null)
|
||||
@@ -389,7 +389,15 @@ namespace System.Application.Services
|
||||
public async Task AddNewScript(FileInfo fileInfo, ScriptDTO? info, ScriptDTO? oldInfo = null)
|
||||
{
|
||||
IsLoading = true;
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(fileInfo, info, oldInfo);
|
||||
bool isbuild = true;
|
||||
int order = 10;
|
||||
if (oldInfo != null)
|
||||
{
|
||||
isbuild = oldInfo.IsBuild;
|
||||
order = oldInfo.Order;
|
||||
|
||||
}
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(fileInfo, info, oldInfo, build: isbuild, order: order);
|
||||
if (item.state)
|
||||
{
|
||||
if (item.model != null)
|
||||
@@ -404,11 +412,11 @@ namespace System.Application.Services
|
||||
public async void RefreshScript()
|
||||
{
|
||||
var scriptList = await DI.Get<IScriptManagerService>().GetAllScript();
|
||||
ProxyScripts.Clear();
|
||||
ProxyScripts.Clear();
|
||||
if (ProxySettings.ScriptsStatus.Value.Any_Nullable() && scriptList.Any())
|
||||
{
|
||||
foreach (var item in scriptList)
|
||||
{
|
||||
{
|
||||
if (ProxySettings.ScriptsStatus.Value.Contains(item.LocalId))
|
||||
{
|
||||
item.Enable = true;
|
||||
|
||||
@@ -142,42 +142,51 @@ namespace System.Application.UI.ViewModels
|
||||
public void DeleteNoFileScriptItemButton(ScriptDTO script)
|
||||
{
|
||||
|
||||
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_NoFileDeleteItem , ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
|
||||
{
|
||||
if (s.Result == MessageBoxResultCompat.OK)
|
||||
{
|
||||
var item = await DI.Get<IScriptManagerService>().DeleteScriptAsync(script);
|
||||
if (item.state)
|
||||
{
|
||||
if (ProxyService.Current.ProxyScripts != null)
|
||||
ProxyService.Current.ProxyScripts.Remove(script);
|
||||
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_NoFileDeleteItem, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
|
||||
{
|
||||
if (s.Result == MessageBoxResultCompat.OK)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
var url = Path.Combine(IOPath.AppDataDirectory, script.FilePath);
|
||||
DI.Get<IDesktopPlatformService>().OpenFileByTextReader(url);
|
||||
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_EditTxt, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
|
||||
var fileInfo = new FileInfo(url);
|
||||
if (fileInfo.Exists)
|
||||
{
|
||||
if (s.Result == MessageBoxResultCompat.OK)
|
||||
DI.Get<IDesktopPlatformService>().OpenFileByTextReader(url);
|
||||
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_EditTxt, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
|
||||
{
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(url, script,build: script.IsBuild,order:script.Order);
|
||||
if (item.state)
|
||||
if (s.Result == MessageBoxResultCompat.OK)
|
||||
{
|
||||
if (ProxyService.Current.ProxyScripts.Items.Any() && item.model != null)
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(url, script, build: script.IsBuild, order: script.Order, ignoreCache: true);
|
||||
if (item.state)
|
||||
{
|
||||
ProxyService.Current.ProxyScripts.Replace(script, item.model);
|
||||
Toast.Show(AppResources.Success_.Format(AppResources.Script_Edit));
|
||||
if (ProxyService.Current.ProxyScripts.Items.Any() && item.model != null)
|
||||
{
|
||||
ProxyService.Current.ProxyScripts.Replace(script, item.model);
|
||||
Toast.Show(AppResources.Success_.Format(AppResources.Script_Edit));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
DeleteNoFileScriptItemButton(script);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void OpenHomeScriptItemButton(ScriptDTO script)
|
||||
@@ -189,11 +198,11 @@ namespace System.Application.UI.ViewModels
|
||||
{
|
||||
if (script?.FilePath != null)
|
||||
{
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(Path.Combine(IOPath.AppDataDirectory, script.FilePath),script,order:script.Order, build: script.IsBuild, ignoreCache:true);
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(Path.Combine(IOPath.AppDataDirectory, script.FilePath), script, order: script.Order, build: script.IsBuild, ignoreCache: true);
|
||||
if (item.state)
|
||||
{
|
||||
if (item.model != null)
|
||||
{
|
||||
{
|
||||
ProxyService.Current.ProxyScripts.Replace(script, item.model);
|
||||
Toast.Show(AppResources.RefreshOK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user