Inheritance: ChatSubpageBase
Exemplo n.º 1
0
        public void AddPrivateChatSubpage(PrivateChatSubpage page)
        {
            Widget labelWidget = CreateTabLabel(page.Node.NickName);

            tabLabelPages[labelWidget] = page;
            AppendPage(page, labelWidget);
        }
Exemplo n.º 2
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);
     }
 }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        public static PrivateChatSubpage StartPrivateChat(Network network, Node node, bool focus)
        {
            if (node == null)  {
                throw new ArgumentNullException("node");
            }

            if (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;
            }
        }
Exemplo n.º 5
0
 public void AddPrivateChatSubpage(PrivateChatSubpage page)
 {
     Widget labelWidget = CreateTabLabel(page.Node.NickName);
     tabLabelPages[labelWidget] = page;
     AppendPage(page, labelWidget);
 }