コード例 #1
0
        private void on_btnAdd_clicked(object sender, EventArgs e)
        {
            try {
                PublicKey result = PublicKey.Parse(txtPublicKey.Buffer.Text);
                if (Common.SHA512Str(result.Key) == Core.MyNodeID)
                    throw new Exception("Cannot add your own key!");

                tni = new TrustedNodeInfo(result);

                EditFriendDialog w = new EditFriendDialog (base.Dialog, ref tni);
                int editResult = w.Run ();

                if (editResult == (int)ResponseType.Ok)  {
                    base.Dialog.Respond(ResponseType.Ok);
                } else {
                    base.Dialog.Respond(ResponseType.Cancel);
                }
                base.Dialog.Destroy();
            }
            catch (Exception ex) {
                Gui.ShowMessageDialog(String.Format("Invalid public key: {0}", ex.Message),
                                      base.Dialog, Gtk.MessageType.Error, ButtonsType.Ok);
                base.Dialog.Respond(ResponseType.None);
                return;
            }
        }
コード例 #2
0
        private void on_btnAdd_clicked(object sender, EventArgs e)
        {
            try {
                PublicKey result = PublicKey.Parse(txtPublicKey.Buffer.Text);
                if (Common.SHA512Str(result.Key) == Core.MyNodeID)
                {
                    throw new Exception("Cannot add your own key!");
                }

                tni = new TrustedNodeInfo(result);

                EditFriendDialog w = new EditFriendDialog(base.Dialog, ref tni);
                int editResult     = w.Run();

                if (editResult == (int)ResponseType.Ok)
                {
                    base.Dialog.Respond(ResponseType.Ok);
                }
                else
                {
                    base.Dialog.Respond(ResponseType.Cancel);
                }
                base.Dialog.Destroy();
            }
            catch (Exception ex) {
                Gui.ShowMessageDialog(String.Format("Invalid public key: {0}", ex.Message),
                                      base.Dialog, Gtk.MessageType.Error, ButtonsType.Ok);
                base.Dialog.Respond(ResponseType.None);
                return;
            }
        }
コード例 #3
0
        private void trustedNodesList_RowActivated(object sender, RowActivatedArgs args)
        {
            TreeIter iter;

            if (trustedNodesList.Selection.GetSelected(out iter))
            {
                TrustedNodeInfo  trustedNode = (TrustedNodeInfo)trustedNodesListStore.GetValue(iter, 0);
                EditFriendDialog editDialog  = new EditFriendDialog(Dialog, ref trustedNode);
                editDialog.Run();
            }
        }
コード例 #4
0
 private void trustedNodesList_RowActivated(object sender, RowActivatedArgs args)
 {
     TreeIter iter;
     if (trustedNodesList.Selection.GetSelected (out iter)) {
         TrustedNodeInfo trustedNode = (TrustedNodeInfo) trustedNodesListStore.GetValue (iter, 0);
         EditFriendDialog editDialog = new EditFriendDialog (Dialog, ref trustedNode);
         editDialog.Run ();
     }
 }