Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        public static PrivateChatSubpage StartPrivateChat(Network network, Node node, bool focus)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            if (Runtime.Core.IsLocalNode(node))
            {
                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);
            }
        }