12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using OpenSEMI.ClientBase;
- namespace VirgoUI.Client
- {
- public class LogoffViewModel : DialogViewModel<UserMode>
- {
- public override string DisplayName { get; set; } = "Virgo";
- public LogoffViewModel()
- {
- this.DialogResult = UserMode.None;
- this.LoginName = BaseApp.Instance.UserContext.LoginName;
- this.RoleName = BaseApp.Instance.UserContext.RoleName;
- this.LoginTime = BaseApp.Instance.UserContext.LoginTime;
- }
- protected override void OnInitialize()
- {
- //check some condition to set property AllowShowDown, system manual and PM busy
- this.Token = BaseApp.Instance.UserContext.Token;
- }
- public void Exit()
- {
- //this message can keep in resource file
- if (DialogBox.Confirm(string.Format("Are you sure that you want to {0}?", "exit")))
- {
- this.DialogResult = UserMode.Exit;
- this.TryClose();
- }
- }
- public void ShutDown()
- {
- if (DialogBox.Confirm(string.Format("Are you sure that you want to {0}?", "shutdown")))
- {
- this.DialogResult = UserMode.Shutdown;
- this.TryClose();
- }
- }
- public void Logoff()
- {
- this.DialogResult = UserMode.Logoff;
- this.TryClose();
- }
- public void Cancel()
- {
- this.DialogResult = UserMode.None;
- this.TryClose();
- }
- private bool _AllowShowDown = false;
- public bool AllowShowDown
- {
- get { return _AllowShowDown; }
- set
- {
- _AllowShowDown = value;
- NotifyOfPropertyChange("AllowShowDown");
- }
- }
- public string LoginName { get; private set; }
- public string RoleName { get; private set; }
- public DateTime LoginTime { get; private set; }
- }
- }
|