예제 #1
0
        private void AddListItem(AgentPrivateKey key)
        {
            ListViewItem li = new ListViewItem(key.FileName);

            li.SubItems.Add(ToStatusString(key));
            li.SubItems.Add(key.Key == null ? "" : key.Key.Comment);
            li.Tag = key;
            _list.Items.Add(li);
        }
예제 #2
0
        private void OnAddButton(object sender, System.EventArgs e)
        {
            string fn = TerminalUtil.SelectPrivateKeyFileByDialog(this);

            if (fn != null)
            {
                AgentPrivateKey key = new AgentPrivateKey(fn);
                if (key.GuessValidKeyFileOrWarn(this))
                {
                    InputPassphraseDialog dlg = new InputPassphraseDialog(key);
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        AddListItem(key);
                    }
                }
            }
        }
예제 #3
0
        private void OnListDoubleClick(object sender, System.EventArgs e)
        {
            ListViewItem    li  = GetSelectedItem();
            AgentPrivateKey key = li.Tag as AgentPrivateKey;

            Debug.Assert(key != null);

            if (key.Status == PrivateKeyStatus.OK)
            {
                return; //既に確認済み
            }
            if (key.GuessValidKeyFileOrWarn(this))
            {
                InputPassphraseDialog dlg = new InputPassphraseDialog(key);
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    li.SubItems[1].Text = ToStatusString(key);
                    li.SubItems[2].Text = key.Key.Comment;
                    Debug.Assert(key.Status == PrivateKeyStatus.OK);
                }
            }
        }
예제 #4
0
 private string ToStatusString(AgentPrivateKey key)
 {
     return(key.Status == PrivateKeyStatus.OK ? "OK" : "");
 }
예제 #5
0
 public InputPassphraseDialog(AgentPrivateKey key)
 {
     _key = key;
     InitializeComponent();
     InitText();
 }