ShowMessageDialog() публичный статический Метод

public static ShowMessageDialog ( string text ) : int
text string
Результат int
Пример #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_btnOK_clicked(object o, EventArgs e)
 {
     if (Gui.ShowMessageDialog("Are you absolutley sure you want to add this node to your trusted nodes list using this key?", base.Dialog, Gtk.MessageType.Question, ButtonsType.YesNo) == (int)ResponseType.Yes)
     {
         base.Dialog.Respond((int)Gtk.ResponseType.Ok);
     }
     else
     {
         Gui.ShowMessageDialog("No key was added.", base.Dialog);
         base.Dialog.Respond((int)Gtk.ResponseType.Cancel);
     }
 }
Пример #3
0
        /* private methods */
        private void on_postButton_clicked(object sender, EventArgs e)
        {
            Network network = GetSelectedNetwork();

            if (network == null)
            {
                Gui.ShowMessageDialog("You must select a network.", Dialog);
                return;
            }

            /*theMemo.FileLinks.Clear();
             *
             * foreach (object[] row in fileListStore) {
             *      theMemo.FileLinks.Add(row[0].ToString());
             * }*/

            bool isNew = false;

            if (theMemo == null)
            {
                foreach (Memo m in network.Memos)
                {
                    if (m.Subject == subjectEntry.Text && m.Node.IsLocal)
                    {
                        Gui.ShowMessageDialog("You have already posted a memo with the specified subject, please select another.", Dialog);
                        return;
                    }
                }
                theMemo = new Memo(network);
                isNew   = true;
            }

            theMemo.Subject = subjectEntry.Text;
            theMemo.Text    = memoTextView.Buffer.Text;
            theMemo.Sign();

            network.PostMemo(theMemo);

            if (isNew)
            {
                Gui.ShowMessageDialog("Your memo has been posted.", base.Dialog);
            }
            else
            {
                Gui.ShowMessageDialog("Your memo has been updated.", base.Dialog);
            }

            Dialog.Respond(ResponseType.Ok);
            Dialog.Hide();
        }
Пример #4
0
        private void on_btnImportPublicKey_clicked(object sender, EventArgs e)
        {
            FileSelector f = new FileSelector("Select Public Key");

            try {
                if (f.Run() == (int)ResponseType.Ok)
                {
                    txtPublicKey.Buffer.Text = File.ReadAllText(f.Filename);
                }
                f.Destroy();
            }
            catch (Exception) {
                f.Destroy();
                Gui.ShowMessageDialog("The selected file is not valid.", base.Dialog, Gtk.MessageType.Error, ButtonsType.Ok);
            }
        }
Пример #5
0
 private void avatarIconView_DragDataReceived(object sender, DragDataReceivedArgs args)
 {
     if (args.SelectionData.Length >= 0 && args.SelectionData.Format == 8)
     {
         try {
             string fileName = new Uri(args.SelectionData.Text.Trim()).LocalPath;
             if (File.Exists(fileName))
             {
                 AddFile(fileName);
             }
         } catch (Exception ex) {
             Gui.ShowMessageDialog(ex.Message);
         }
     }
     Gtk.Drag.Finish(args.Context, false, false, args.Time);
 }
Пример #6
0
 private void downloadButton_Clicked(object sender, EventArgs e)
 {
     if (txtUrl.Text.Trim() != "")
     {
         try {
             using (WebClient web = new WebClient()) {
                 byte[] b = web.DownloadData(txtUrl.Text);
                 result = System.Text.Encoding.Default.GetString(b);
                 base.Dialog.Respond(ResponseType.Ok);
             }
         }
         catch {
             Gui.ShowMessageDialog("Invalid URL.", base.Dialog, Gtk.MessageType.Error, Gtk.ButtonsType.Ok);
             base.Dialog.Respond(ResponseType.None);
         }
     }
 }
Пример #7
0
 public void on_mnuFileDownload_activate(object o, EventArgs e)
 {
     try {
         TreeIter iter;
         if (filesList.Selection.GetSelected(out iter) == true)
         {
             IDirectoryItem thisItem = (IDirectoryItem)filesListStore.GetValue(iter, 0);
             DownloadItem(thisItem);
         }
         else
         {
             Gui.ShowMessageDialog("Nothing selected");
         }
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.Message);
     }
 }
Пример #8
0
        private void browseButton_clicked(object o, EventArgs args)
        {
            FileSelector selector = new FileSelector("Select Image");

            selector.Show();
            int result = selector.Run();

            if (result == (int)Gtk.ResponseType.Ok)
            {
                try {
                    AddFile(selector.Filename);
                } catch (Exception ex) {
                    selector.Hide();
                    Gui.ShowMessageDialog(ex.Message);
                    return;
                }
            }
            selector.Hide();
        }
Пример #9
0
        private void joinButton_Clicked(object sender, EventArgs e)
        {
            Network selectedNetwork = GetSelectedNetwork();

            if (selectedNetwork == null)
            {
                Gui.ShowMessageDialog("No network selected.", Dialog, Gtk.MessageType.Error, Gtk.ButtonsType.Ok);
                return;
            }

            try {
                string roomName = roomNameCombo.Entry.Text.Trim();
                string password = passwordEntry.Text;

                string roomId = (passwordCheck.Active) ? Common.SHA512Str(roomName + password) : Common.SHA512Str(roomName);

                ChatRoom room = selectedNetwork.GetChatRoom(roomId);
                if (room != null && room.InRoom)
                {
                    // Already in here!
                    ChatRoomSubpage window = (ChatRoomSubpage)room.Properties["Window"];
                    window.GrabFocus();
                }
                else
                {
                    if (passwordCheck.Active == true)
                    {
                        selectedNetwork.JoinOrCreateChat(roomName, passwordEntry.Text);
                    }
                    else
                    {
                        selectedNetwork.JoinOrCreateChat(roomName, null);
                    }
                }
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowMessageDialog(ex.Message, Dialog);
                Dialog.Respond(ResponseType.None);
                return;
            }
            Dialog.Respond(ResponseType.Ok);
        }
Пример #10
0
 public static bool QuitMeshwork()
 {
     try {
         int result = Gui.ShowMessageDialog("Are you sure you want to quit Meshwork?", Gui.MainWindow.Window, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo);
         if (result == (int)ResponseType.Yes)
         {
             Gui.Settings.SaveSettings();
             Core.Stop();
             Gtk.Application.Quit();
             Environment.Exit(0);
             return(true);
         }
         else
         {
             return(false);
         }
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         throw ex;
     }
 }