ShowErrorDialog() public static method

public static ShowErrorDialog ( string text ) : int
text string
return int
コード例 #1
0
        private void manager_FileTransferRemoved(object sender, FileTransferEventArgs e)
        {
            try {
                // Remove transfer from list
                Gtk.TreeIter iter;
                transferListStore.GetIterFirst(out iter);
                if (transferListStore.IterIsValid(iter))
                {
                    do
                    {
                        IFileTransfer currentItem = (IFileTransfer)transferListStore.GetValue(iter, 0);
                        if (currentItem == e.Transfer)
                        {
                            transferListStore.Remove(ref iter);
                            return;
                        }
                    }  while (transferListStore.IterNext(ref iter));
                }

                Gui.MainWindow.RefreshCounts();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
            }
        }
コード例 #2
0
ファイル: ConnectDialog.cs プロジェクト: tabrath/meshwork
        private void Connect(Network network, string address, IPAddress ip, int port)
        {
            try {
                if (!base.Dialog.Visible)
                {
                    return;
                }

                if (ip == null)
                {
                    Gui.ShowErrorDialog("Unable to resolve hostname.", Dialog);
                    return;
                }

                ITransport transport = new TcpTransport(ip, port, ConnectionType.NodeConnection);
                network.ConnectTo(transport);

                if (Gui.Settings.RecentConnections.IndexOf(address) != -1)
                {
                    Gui.Settings.RecentConnections.Remove(address);
                }

                Gui.Settings.RecentConnections.Insert(0, address);
                Gui.Settings.SaveSettings();

                Dialog.Respond((int)ResponseType.Ok);
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.Message, base.Dialog);
            }
        }
コード例 #3
0
        public void NavigateTo(string path)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            try {
                if (selectedRows.ContainsKey(navigatingTo))
                {
                    selectedRows.Remove(navigatingTo);
                }

                navigatingTo = path;
                navigating   = true;

                waitLabel.Text           = "Loading Directory...";
                filesList.Parent.Visible = false;
                waitingBoxAlignment.ShowAll();
                GLib.Timeout.Add(50, new GLib.TimeoutHandler(PulseProgressBar));

                Core.FileSystem.BeginGetDirectory(path, delegate(IDirectory directory) {
                    Application.Invoke(delegate {
                        GotDirectory(path, directory);
                    });
                });
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex.ToString());
                Gui.ShowErrorDialog(ex.Message);
            }
        }
コード例 #4
0
        private void on_filesList_row_activated(object o, RowActivatedArgs e)
        {
            try {
                TreeIter iter;
                if (filesListStore.GetIter(out iter, e.Path) == true)
                {
                    IDirectoryItem thisItem = (IDirectoryItem)filesListStore.GetValue(iter, 0);

                    if (thisItem is IDirectory)
                    {
                        /*
                         * if (selectedRows [currentPath] == null)
                         *      selectedRows.Add (currentPath, e.Path.ToString ());
                         * else
                         *      selectedRows [currentPath] = e.Path.ToString ();
                         */

                        NavigateTo(PathUtil.Join(currentPath, thisItem.Name));
                    }
                    else
                    {
                        DownloadItem(thisItem);
                    }
                }
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.Message);
            }
        }
コード例 #5
0
        private void addTrustedNodeButton_Clicked(object sender, EventArgs args)
        {
            AddTrustedNodeDialog w = new AddTrustedNodeDialog(Dialog);

            int result = w.Run();

            if (result == (int)ResponseType.Ok)
            {
                TrustedNodeInfo tni = w.TrustedNodeInfo;
                if (tni != null)
                {
                    foreach (object[] row in trustedNodesListStore)
                    {
                        var thisInfo = (TrustedNodeInfo)row[0];
                        if (thisInfo.NodeID == tni.NodeID)
                        {
                            Gui.ShowErrorDialog("This node already exists!", base.Dialog);
                            return;
                        }
                    }

                    trustedNodesListStore.AppendValues(tni);
                }
            }
        }
コード例 #6
0
 public void on_mnuPauseTransfer_activate(object o, EventArgs args)
 {
     try {
         transfer.Pause();
     } catch (Exception ex) {
         Gui.ShowErrorDialog(ex.ToString());
     }
 }
コード例 #7
0
 private void network_ConnectionDown(INodeConnection c)
 {
     try {
         UpdateConnectionList();
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
     }
 }
コード例 #8
0
 private void Connection_PongReceived(LocalNodeConnection c)
 {
     try {
         UpdateConnectionList();
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
     }
 }
コード例 #9
0
 private void network_NewIncomingConnection(Network network, LocalNodeConnection c)
 {
     try {
         AddConnectionEventHandlers(c);
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
     }
 }
コード例 #10
0
 private void network_ReceivedCriticalError(INodeConnection ErrorFrom, MeshworkError error)
 {
     try {
         UpdateConnectionList();
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
     }
 }
コード例 #11
0
        /*
         * private void network_FileOffered (Network network, FileOfferedEventArgs args)
         * {
         *      try {
         *              LogManager.Current.WriteToLog (args.From.NickName + " offers to send you " + args.File.FileName);
         *
         *              MessageDialog dialog = new MessageDialog (null,
         *                              DialogFlags.Modal,
         *                              Gtk.MessageType.Question,
         *                              ButtonsType.YesNo,
         *                              "{0} would like to send you the following file:\n\n{1}\n\nDo you want to accept it?",
         *                              args.From.ToString(),
         *                              args.File.FileName);
         *
         *              dialog.Show ();
         *
         *              if (dialog.Run() == (int)Gtk.ResponseType.Yes) {
         *                      //network.DownloadFile (args.From, args.File.FileFullPath, args.File.File.Size);
         *              }
         *
         *              dialog.Destroy ();
         *      } catch (Exception ex) {
         *              LoggingService.LogError(ex);
         *              Gui.ShowErrorDialog (ex.ToString(), Gui.MainWindow.Window);
         *      }
         * }
         */

        private void network_ReceivedChatInvite(Network network, Node inviteFrom, ChatRoom room, ChatInviteInfo invitation)
        {
            try {
                ChatRoomInvitationDialog dialog = new ChatRoomInvitationDialog(network, inviteFrom, room, invitation);
                dialog.Show();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
            }
        }
コード例 #12
0
ファイル: ConnectionsPage.cs プロジェクト: tabrath/meshwork
 private void OnNewTransportAdded(object sender, TransportEventArgs args)
 {
     try {
         connectionListStore.AppendValues(args.Transport);
         Gui.MainWindow.RefreshCounts();
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
     }
 }
コード例 #13
0
 private void network_ChatMessage(ChatRoom room, Node node, string text)
 {
     try {
         if (room.InRoom == true)
         {
             (room.Properties["Window"] as ChatRoomSubpage).AddToChat(node, text);
         }
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
     }
 }
コード例 #14
0
        private void LocalConnectionError(LocalNodeConnection c, Exception error)
        {
            try {
                // TODO: !!!!
                //(c.Properties ["ListItem"] as ConnectionListItem).ErrorText = ex.Message;

                UpdateConnectionList();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
            }
        }
コード例 #15
0
ファイル: Runtime.cs プロジェクト: tabrath/meshwork
        private static void UnhandledGLibExceptionHandler(GLib.UnhandledExceptionArgs args)
        {
            string exceptionText = args.ExceptionObject.ToString();

            Console.Error.WriteLine("UNHANDLED EXCEPTION!! " + exceptionText);
            string crashFileName = Path.Combine(Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop), String.Format("meshwork-crash-{0}.log", DateTime.Now.ToFileTime()));
            string crashLog      = exceptionText;

            File.WriteAllText(crashFileName, crashLog);

            Gui.ShowErrorDialog("Meshwork has encountered an unhandled error and must be closed.\n\nAn error report has been created on your desktop, please file a bug.\n\n" + exceptionText);

            args.ExitApplication = true;
        }
コード例 #16
0
 private void network_PrivateMessage(Network network, Node messageFrom, string messageText)
 {
     try {
         PrivateChatSubpage page = Gui.GetPrivateMessageWindow(messageFrom);
         if (page == null)
         {
             page = Gui.StartPrivateChat(network, messageFrom, false);
         }
         page.AddToChat(messageFrom, messageText);
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
     }
 }
コード例 #17
0
        private void AskAcceptKey(Network network, ReceivedKeyEventArgs args,
                                  AutoResetEvent receiveKeyWait,
                                  ref bool acceptKey)
        {
            try {
                AcceptKeyDialog dialog   = new AcceptKeyDialog(network, args);
                int             response = dialog.Run();

                acceptKey = (response == (int)ResponseType.Ok);

                receiveKeyWait.Set();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
            }
        }
コード例 #18
0
ファイル: SearchResultsPage.cs プロジェクト: tabrath/meshwork
 private void resultsTree_RowActivated(object sender, RowActivatedArgs args)
 {
     try {
         TreeIter iter;
         if (resultsTree.Model.GetIter(out iter, args.Path))
         {
             SearchResult selectedResult = (SearchResult)resultsTree.Model.GetValue(iter, 0);
             if (selectedResult.Type == SearchResultType.File)
             {
                 selectedResult.Download();
             }
         }
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.Message);
     }
 }
コード例 #19
0
ファイル: SearchResultsPage.cs プロジェクト: tabrath/meshwork
 void DownloadToolButtonClicked(object sender, EventArgs e)
 {
     try {
         TreeIter iter;
         if (resultsTree.Selection.GetSelected(out iter))
         {
             SearchResult selectedResult = resultsTree.Model.GetValue(iter, 0) as SearchResult;
             if (selectedResult != null && selectedResult.Type == SearchResultType.File)
             {
                 selectedResult.Download();
             }
         }
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.Message);
     }
 }
コード例 #20
0
        public void on_mnuClearFinishedFailedTransfers_activate(object o, EventArgs args)
        {
            try {
                List <IFileTransfer> toRemove = new List <IFileTransfer>();
                foreach (IFileTransfer transfer in Core.FileTransferManager.Transfers)
                {
                    if (transfer.Status == FileTransferStatus.Canceled || transfer.Status == FileTransferStatus.Completed)
                    {
                        toRemove.Add(transfer);
                    }
                }

                toRemove.ForEach(delegate(IFileTransfer transfer) { Core.FileTransferManager.RemoveTransfer(transfer); });
            } catch (Exception ex) {
                Gui.ShowErrorDialog(ex.ToString());
            }
        }
コード例 #21
0
ファイル: FileSearchEntry.cs プロジェクト: tabrath/meshwork
        private void searchEntry_Activated(object sender, EventArgs args)
        {
            try {
                if (base.ActiveFilterID > 0)
                {
                    Core.FileSearchManager.NewFileSearch(base.Query, networkIDs[base.ActiveFilterID]);
                }
                else
                {
                    Core.FileSearchManager.NewFileSearch(base.Query, null);
                }
            } catch (Exception ex) {
                Gui.ShowErrorDialog(ex.Message);
            }

            base.Query = String.Empty;
        }
コード例 #22
0
        void GotDirectory(string path, IDirectory directory)
        {
            try {
                if (directory != null)
                {
                    currentDirectory = directory;
                    currentPath      = directory.FullPath;

                    navigationBar.SetLocation(currentPath);

                    filesListStore.Clear();

                    foreach (IDirectory currentSubDirectory in directory.Directories)
                    {
                        filesListStore.AppendValues(currentSubDirectory);
                    }

                    foreach (IFile currentFile in directory.Files)
                    {
                        filesListStore.AppendValues(currentFile);
                    }

                    if (selectedRows.ContainsKey(path))
                    {
                        filesList.Selection.Changed -= filesList_Selection_Changed;

                        TreePath treePath = new TreePath(selectedRows[path].ToString());
                        filesList.Selection.SelectPath(treePath);
                        filesList.ScrollToCell(treePath, null, true, 0.5f, 0);
                        filesList.Selection.Changed += filesList_Selection_Changed;
                    }
                }
                else
                {
                    Gui.ShowErrorDialog(String.Format("Directory not found: {0}.", path));
                }

                StopNavigating();
                filesList.QueueDraw();
                filesList.GrabFocus();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex.ToString());
                Gui.ShowErrorDialog(ex.Message);
            }
        }
コード例 #23
0
 void on_mnuUsersConnectTo_activate(object o, EventArgs e)
 {
     try {
         IDestination destination = selectedNode.FirstConnectableDestination;
         if (destination != null)
         {
             ITransport transport = destination.CreateTransport(ConnectionType.NodeConnection);
             network.ConnectTo(transport);
         }
         else
         {
             Gui.ShowErrorDialog("You cannot connect to this user.");
         }
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.Message);
     }
 }
コード例 #24
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);
     }
 }
コード例 #25
0
        private void network_UpdateNodeInfo(Network network, string oldNick, Node node)
        {
            try {
                if (oldNick != node.NickName)
                {
                    if (Gui.GetPrivateMessageWindow(node) != null)
                    {
                        Gui.GetPrivateMessageWindow(node).UserInfoChanged(oldNick);
                    }
                }

                RefreshUserList();
                Gui.MainWindow.UpdateStatusText();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
            }
        }
コード例 #26
0
        private void network_ReceivedNonCriticalError(Network network, Node from, MeshworkError error)
        {
            if (error is DirectoryNotFoundError)
            {
                string errorPath = ((DirectoryNotFoundError)error).DirPath;
                errorPath = errorPath.Substring(1);

                // FIXME: errorPath doesn't have network part, navigatingTo does!!
                if (true)
                //if (errorPath == navigatingTo)
                {
                    Gui.ShowErrorDialog("Directory not found");

                    StopNavigating();

                    // FIXME: Maybe something should reset the state on the directory object
                }
            }
        }
コード例 #27
0
        private void manager_NewFileTransfer(object sender, FileTransferEventArgs e)
        {
            try {
                // Add transfer to list
                transferListStore.AppendValues(e.Transfer);

                // Watch a few other events
                e.Transfer.PeerAdded += (EventHandler <FileTransferPeerEventArgs>)DispatchService.GuiDispatch(
                    new EventHandler <FileTransferPeerEventArgs>(transfer_PeerAdded)
                    );

                e.Transfer.Error += (EventHandler <ErrorEventArgs>)DispatchService.GuiDispatch(
                    new EventHandler <ErrorEventArgs>(transfer_Error)
                    );

                Gui.MainWindow.RefreshCounts();
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
            }
        }
コード例 #28
0
ファイル: SearchResultsPage.cs プロジェクト: tabrath/meshwork
        void BrowseToolButtonClicked(object sender, EventArgs e)
        {
            try {
                TreeIter iter;
                if (resultsTree.Selection.GetSelected(out iter))
                {
                    SearchResult selectedResult = resultsTree.Model.GetValue(iter, 0) as SearchResult;
                    if (selectedResult != null)
                    {
                        string path = PathUtil.Join(selectedResult.Node.Directory.FullPath,
                                                    String.Join("/", selectedResult.FullPath.Split('/').Slice(0, -2)));

                        UserBrowserPage.Instance.NavigateTo(path);
                        Gui.MainWindow.SelectedPage = UserBrowserPage.Instance;
                    }
                }
            } catch (Exception ex) {
                Core.LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.Message);
            }
        }
コード例 #29
0
        public static PrivateChatSubpage StartPrivateChat(Network network, Node node, bool focus)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            if (node.IsLocal)
            {
                Gui.ShowErrorDialog("You cannot send messages to yourself!");
                return(null);
            }
            else if (node.FinishedKeyExchange == true)
            {
                PrivateChatSubpage page;
                if (privateMessageWindows.ContainsKey(network.NetworkID + node.NodeID) == false)
                {
                    page = new PrivateChatSubpage(network, node);
                    privateMessageWindows[network.NetworkID + node.NodeID] = page;
                    ChatsPage.Instance.AddPrivateChatSubpage(page);
                }
                else
                {
                    page = (PrivateChatSubpage)privateMessageWindows[network.NetworkID + node.NodeID];
                }

                if (focus)
                {
                    Gui.MainWindow.SelectedPage = ChatsPage.Instance;
                    page.GrabFocus();
                }

                return(page);
            }
            else
            {
                Gui.ShowErrorDialog("You cannot send messages to untrusted nodes.");
                return(null);
            }
        }
コード例 #30
0
ファイル: SearchResultsPage.cs プロジェクト: tabrath/meshwork
 void FilePropertiesButtonClicked(object sender, EventArgs args)
 {
     try {
         TreeIter iter;
         if (resultsTree.Selection.GetSelected(out iter))
         {
             SearchResult selectedResult = resultsTree.Model.GetValue(iter, 0) as SearchResult;
             if (selectedResult != null && selectedResult.Type == SearchResultType.File)
             {
                 var path = PathUtil.Join(selectedResult.Node.Directory.FullPath, selectedResult.FileListing.FullPath);
                 Core.FileSystem.BeginGetFileDetails(path, delegate(IFile file) {
                     Application.Invoke(delegate {
                         var win = new FilePropertiesWindow(file);
                         win.Show();
                     });
                 });
             }
         }
     } catch (Exception ex) {
         Core.LoggingService.LogError(ex);
         Gui.ShowErrorDialog(ex.Message);
     }
 }