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;
            }
        }
Beispiel #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;
            }
        }
Beispiel #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();
            }
        }
 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 ();
     }
 }