예제 #1
0
        internal void JointToMainConfig(IMainConfig config)
        {
            config.PasswordConfirmed += setLogged;
            config.PasswordLocked += setLocked;
            LogonAction = () =>
            {
                using (var signIn = new SignIn())
                {
                    signIn.Config = config;
                    var result = signIn.ShowDialog();
                    return result == DialogResult.OK;
                }
            };
            LockOutAction = () =>
            {
                config.Password = null;

                return true;
            };
        }
예제 #2
0
 internal static void ChangePassword(IMainConfig config)
 {
     if (!config.IsPasswordConfirmed)
     {
         using (var signIn = new SignIn())
         {
             signIn.Config = config;
             signIn.ShowDialog();
             if (signIn.DialogResult != DialogResult.OK)
             {
                 // 認証不通過。
                 return;
             }
         }
     }
     using (var changePassword = new InitForm()
     {
         IsAsAddNew = false,
         ConfName = config.ConfName,
     })
     {
         changePassword.ShowDialog();
         if (changePassword.DialogResult == DialogResult.OK)
         {
             string newPassword = changePassword.Password;
             string oldPassword = config.Password;
             foreach (ItemPolicy item in config.Items)
             {
                 item.ResavePassword(oldPassword, newPassword, config.DatFolder);
             }
             config.Password = newPassword;
             config.DatFolder = config.DatFolder;
             config.SaveToFile();
         }
     }
 }
예제 #3
0
 private void SignIn_Click(object sender, EventArgs e)
 {
     using (var signIn = new SignIn())
     {
         signIn.Config = this.Config;
         signIn.ShowDialog();
     }
 }
예제 #4
0
 private void ListView_DoubleClick(object sender, EventArgs e)
 {
     ItemPolicy item = (ItemPolicy)ListView.SelectedRows[0].DataBoundItem;
     if (item.HasPasswordFile(config.DatFolder))
     {
         if (!Config.IsPasswordConfirmed)
         {
             using (var signIn = new SignIn() { Config = config })
             {
                 var result = signIn.ShowDialog();
                 if (result != DialogResult.OK)
                 {
                     return;
                 }
             }
         }
         item.ReadPassword(config.Password, config.DatFolder);
     }
     OpenWindow(item);
 }