1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using Avalonia.Input;
- using Shaker.Models;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ShakerApp.ViewModels
- {
- internal class InputPassWordViewModel:DisplayViewModelBase<IModel>
- {
- private string passWord = string.Empty;
- private InputPassWordViewModel()
- {
- Content = typeof(Views.InputPassWordView);
- Title = "InputPassWord";
- }
- static InputPassWordViewModel()
- {
- }
- public override double Width => 420;
- public override double Height => 220;
- public override bool CanResize => false;
- public static InputPassWordViewModel Instance { get; } = new InputPassWordViewModel();
- public override string OKContent => "Confirm";
- public string PassWord { get => passWord; set =>SetProperty(ref passWord ,value); }
- public override void InitData()
- {
- base.InitData();
- PassWord = string.Empty;
- }
- protected override void Save()
- {
- base.Save();
- InputAction?.Invoke(PassWord);
- }
- protected override void OnPropertyChanged(PropertyChangedEventArgs e)
- {
- base.OnPropertyChanged(e);
- if(e.PropertyName == nameof(PassWord))
- {
- SaveIsEnabled = !string.IsNullOrEmpty(PassWord);
- }
- }
- [AllowNull]
- public Action<string> InputAction { get; set; }
- }
- }
|