Windows/RemoveSecurityWindow.xaml.cs

(完整代码) 1KB

using System.Windows;
using XStart.Const;
using XStart2._0.ViewModels;

namespace XStart2._0.Windows {
    /// <summary>
    /// AddSecurityWindow.xaml 的交互逻辑
    /// </summary>
    public partial class RemoveSecurityWindow : Window {
        public SecurityVM VM { get; set; }
        public RemoveSecurityWindow() {
            InitializeComponent();
            Loaded += WindowLoaded;
        }

        private void WindowLoaded(object sender, RoutedEventArgs e) {
            DataContext = VM;
        }

        private void SaveSecurity(object sender, RoutedEventArgs e) {
            if (Constants.OPERATE_UPDATE.Equals(VM.Operate) || Constants.OPERATE_REMOVE.Equals(VM.Operate)) {
                if (string.IsNullOrEmpty(VM.PriSecurity)) {
                    MessageBox.Show("原口令不能为空!", "错误");
                    return;
                } else if (!VM.CurSecurity.Equals(VM.PriSecurity)) {
                    MessageBox.Show("原口令不一致!", "错误");
                    return;
                }
            }
            if (Constants.OPERATE_CREATE.Equals(VM.Operate) || Constants.OPERATE_UPDATE.Equals(VM.Operate)) {
                if (string.IsNullOrEmpty(VM.Security)) {
                    MessageBox.Show("口令不能为空!", "错误");
                    return;
                } else if (string.IsNullOrEmpty(VM.ConfirmSecurity)) {
                    MessageBox.Show("确认口令不能为空!", "错误");
                    return;
                } else if (!VM.Security.Equals(VM.ConfirmSecurity)) {
                    MessageBox.Show("确认口令不一致!", "错误");
                    return;
                }
            }
            DialogResult = true;
        }

        private void CancelSecurity(object sender, RoutedEventArgs e) {
            DialogResult = false;
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。