62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using AllBase.Model.Config;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using WPFCommon.Models;
|
|
|
|
namespace _29WxOrderWpf.ViewModels;
|
|
|
|
public class SettingViewModel : BindableBaseEx
|
|
{
|
|
public const string SettingFileName = "setting";
|
|
public SettingViewModel()
|
|
{
|
|
}
|
|
/// <summary>版本号</summary>
|
|
public string Version
|
|
{
|
|
get => GetValue<string>();
|
|
private set => SetValue(value);
|
|
}
|
|
|
|
public bool AutoSwitchGiftType
|
|
{
|
|
get => GetValue<bool>();
|
|
set => SetValue(value);
|
|
}
|
|
public bool SwitchEnableDirectBuy
|
|
{
|
|
get => GetValue<bool>();
|
|
set => SetValue(value);
|
|
}
|
|
public bool SwitchEnablePddTransitTraditionalAddress
|
|
{
|
|
get => GetValue<bool>();
|
|
set => SetValue(value);
|
|
}
|
|
public Visibility ShowEnablePddTransitTraditionalAddress
|
|
{
|
|
get => GetValue<Visibility>();
|
|
set => SetValue(value);
|
|
}
|
|
public void Assign(SettingConfig config)
|
|
{
|
|
AutoSwitchGiftType = config.AutoSwitchGiftType;
|
|
SwitchEnableDirectBuy = config.SwitchEnableDirectBuy;
|
|
SwitchEnablePddTransitTraditionalAddress = config.SwitchEnablePddTransitTraditionalAddress;
|
|
ShowEnablePddTransitTraditionalAddress = config.ShowEnablePddTransitTraditionalAddress ? Visibility.Visible : Visibility.Collapsed;
|
|
}
|
|
public SettingConfig ToConfig()
|
|
{
|
|
return new SettingConfig
|
|
{
|
|
AutoSwitchGiftType = AutoSwitchGiftType,
|
|
SwitchEnableDirectBuy = SwitchEnableDirectBuy,
|
|
SwitchEnablePddTransitTraditionalAddress = SwitchEnablePddTransitTraditionalAddress,
|
|
};
|
|
}
|
|
}
|