You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5 KiB

using log4net;
using SparkClient.Model.Helper;
using SparkClient.ViewModel.BaseWindow;
using SparkClient.ViewModel.Configuration.SettingsPages;
using System.Windows.Input;
using MessageBox = SparkClient.Views.Dialog.MessageBox;
using SparkClient.Model.Attributes;
namespace SparkClient.ViewModel.Configuration;
public class SettingBaseVM : BaseViewModel
{
private static readonly ILog Logger = LogManager.GetLogger(typeof(SettingBaseVM));
public SettingsVM CustomSetContent { get; }
public ModelColorSetPageVM ModelColorSetContent { get; }
public ICommand SaveCommand { get; }
public SettingBaseVM()
{
try
{
CustomSetContent = new SettingsVM();
ModelColorSetContent = new ModelColorSetPageVM();
SaveCommand = new RelayCommand(Save);
}
catch (Exception ex)
{
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}");
Logger.Error($"全局异常捕获:{ex.Message}", ex);
}
}
[Log]
public void Save(object param)
{
try
{
if (CustomSetContent.SaveUpdate(param)&&
ModelColorSetContent.SaveUpdate(param))
{
WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
}
}
catch (Exception ex)
{
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}");
Logger.Error($"全局异常捕获:{ex.Message}", ex);
}
}
}