using RichCreator.Models;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using ZTImage.Configuration;
|
|
namespace RichCreator.ViewModels
|
{
|
public class ConfigViewModel:NotificationObject
|
{
|
public ConfigViewModel()
|
{
|
this.config=ConfigHelper.GetInstance<RichCreatorConfig>();
|
this.runModel = ConfigHelper.GetInstance<RunningModel>();
|
}
|
private RichCreatorConfig config;
|
private RunningModel runModel;
|
|
|
|
public bool IsGroup
|
{
|
get
|
{
|
return config.IsGroup;
|
}
|
set
|
{
|
if (config.IsGroup != value)
|
{
|
config.IsGroup = value;
|
this.RaisePropertyChanged("IsGroup");
|
}
|
|
}
|
}
|
|
public string TGPDaemonPath
|
{
|
get
|
{
|
return config.TGPDaemonPath;
|
}
|
set
|
{
|
if (config.TGPDaemonPath != value)
|
{
|
config.TGPDaemonPath = value;
|
this.RaisePropertyChanged("TGPDaemonPath");
|
}
|
|
}
|
}
|
|
public Int32 StartWaitSecond
|
{
|
get
|
{
|
return config.StartWaitSecond;
|
}
|
set
|
{
|
if (config.StartWaitSecond != value)
|
{
|
config.StartWaitSecond = value;
|
this.RaisePropertyChanged("StartWaitSecond");
|
}
|
|
}
|
}
|
|
public Int32 RoleCount
|
{
|
get
|
{
|
return config.RoleCount;
|
}
|
set
|
{
|
if (config.RoleCount != value)
|
{
|
config.RoleCount = value;
|
this.RaisePropertyChanged("RoleCount");
|
}
|
|
}
|
}
|
|
|
|
public bool NotificationWechat
|
{
|
get
|
{
|
return config.NotificationWechat;
|
}
|
set
|
{
|
if (config.NotificationWechat != value)
|
{
|
config.NotificationWechat = value;
|
this.RaisePropertyChanged("NotificationWechat");
|
}
|
|
}
|
}
|
|
|
|
public string UserName1
|
{
|
get
|
{
|
return config.UserName1;
|
}
|
set
|
{
|
if (config.UserName1 != value)
|
{
|
config.UserName1 = value;
|
this.RaisePropertyChanged("UserName1");
|
}
|
|
}
|
}
|
|
|
|
public string Password1
|
{
|
get
|
{
|
return config.Password1;
|
}
|
set
|
{
|
if (config.Password1 != value)
|
{
|
config.Password1 = value;
|
this.RaisePropertyChanged("Password1");
|
}
|
|
}
|
}
|
|
|
public string UserName2
|
{
|
get
|
{
|
return config.UserName2;
|
}
|
set
|
{
|
if (config.UserName2 != value)
|
{
|
config.UserName2 = value;
|
this.RaisePropertyChanged("UserName2");
|
}
|
|
}
|
}
|
|
|
public string Password2
|
{
|
get
|
{
|
return config.Password2;
|
}
|
set
|
{
|
if (config.Password2 != value)
|
{
|
config.Password2 = value;
|
this.RaisePropertyChanged("Password2");
|
}
|
|
}
|
}
|
|
|
public string UserName3
|
{
|
get
|
{
|
return config.UserName3;
|
}
|
set
|
{
|
if (config.UserName3 != value)
|
{
|
config.UserName3 = value;
|
this.RaisePropertyChanged("UserName3");
|
}
|
|
}
|
}
|
|
|
public string Password3
|
{
|
get
|
{
|
return config.Password3;
|
}
|
set
|
{
|
if (config.Password3 != value)
|
{
|
config.Password3 = value;
|
this.RaisePropertyChanged("Password3");
|
}
|
|
}
|
}
|
|
|
|
public Int32 AccountIndex
|
{
|
get
|
{
|
return runModel.AccountIndex;
|
}
|
set
|
{
|
if (runModel.AccountIndex != value)
|
{
|
runModel.AccountIndex = value;
|
this.RaisePropertyChanged("AccountIndex");
|
}
|
|
}
|
}
|
|
|
|
public Int32 RoleIndex
|
{
|
get
|
{
|
return runModel.RoleIndex;
|
}
|
set
|
{
|
if (runModel.RoleIndex != value)
|
{
|
runModel.RoleIndex = value;
|
this.RaisePropertyChanged("RoleIndex");
|
}
|
|
}
|
}
|
|
|
|
/// <summary>
|
/// 保存配置
|
/// </summary>
|
/// <returns></returns>
|
public bool SaveConfig()
|
{
|
ConfigHelper.SetInstance<RichCreatorConfig>(config);
|
ConfigHelper.SetInstance<RunningModel>(runModel);
|
return true;
|
}
|
}
|
}
|