You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using Prism.Commands;
|
|
using Prism.Ioc;
|
|
using Prism.Mvvm;
|
|
using StartServerWPF.Assets;
|
|
using StartServerWPF.Models;
|
|
using StartServerWPF.Modules.Main.Models;
|
|
using StartServerWPF.Modules.Main.ViewModels;
|
|
using System;
|
|
using System.Windows;
|
|
|
|
namespace StartServerWPF.ViewModels
|
|
{
|
|
public class MainWindowViewModel : BindableBase
|
|
{
|
|
private string _title = "StartServerWPF";
|
|
private readonly IContainerProvider _containerProvider;
|
|
|
|
public string Title
|
|
{
|
|
get { return _title; }
|
|
set { SetProperty(ref _title, value); }
|
|
}
|
|
public DelegateCommand ExitCommand => new DelegateCommand(() =>
|
|
{
|
|
this.Title = "close";
|
|
//关闭主窗口;
|
|
Application.Current.MainWindow.Close();
|
|
});
|
|
public void Exit()
|
|
{
|
|
var main = _containerProvider.Resolve<MainViewModel>();
|
|
var log = new LogMessageModel
|
|
{
|
|
LogType = "系统",
|
|
AppName = "系统",
|
|
State = "程序退出",
|
|
OriginTime = DateTime.Now,
|
|
};
|
|
LogHelper.WriteSerLog(_containerProvider.Resolve<SystemConfigModel>().vpnInfo.SystemLogPath, log.ToString());
|
|
|
|
main.OneKeyStop();
|
|
Environment.Exit(0);
|
|
}
|
|
|
|
|
|
public MainWindowViewModel(IContainerProvider containerProvider)
|
|
{
|
|
this._containerProvider = containerProvider;
|
|
}
|
|
}
|
|
}
|