private void BT_ServerItem_Click(object sender, RoutedEventArgs e)
        {
            Button bt = sender as Button;

            //if (MessageBox.Show($"连接服务器->{bt.DataContext}", "连接确认", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            //{
            //    SelectServerThread.Abort();
            //    SocketUDP.Dispose();
            //    Hide();
            //    StaticResource.ServerIpAddress = (bt.DataContext as EndPoint);
            //    StaticResource.UserName = TEXT_Name.Text;
            //    new MainWindow().Show();
            //    Close();
            //    LBCMessageBox.Show($"加入服务器{StaticResource.ServerIpAddress}");
            //}

            if (LBCMessageBox.ShowDialog($"连接确认:连接服务器->{bt.DataContext}\t用户名:{TEXT_Name.Text}") ?? false)
            {
                SelectServerThread.Abort();
                SocketUDP.Dispose();
                Hide();
                StaticResource.ServerIpAddress = (bt.DataContext as EndPoint);
                StaticResource.UserName        = TEXT_Name.Text;
                new MainWindow().Show();
                Close();
                LBCMessageBox.Show($"加入服务器{StaticResource.ServerIpAddress}");
            }
        }
Пример #2
0
 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     CopyContent = new ActionCommand(() =>
     {
         Clipboard.SetText(BulletSource.Message);
         LBCMessageBox.Show(new TextBlock()
         {
             TextWrapping = TextWrapping.Wrap,
             Text         = "复制成功\n" + Clipboard.GetText()
         });
     });
 }
        private void SocketUDP_GetNewMessage(byte[] Content, MessageBase Message, EndPoint FromIP)
        {
            bool IsIt = false;

            Dispatcher.Invoke(() =>
            {
                foreach (var item in LIST_Servers.Items)
                {
                    if ((item as EndPoint).ToString() == FromIP.ToString())
                    {
                        IsIt = true;
                        break;
                    }
                }
                if (!IsIt)
                {
                    LIST_Servers.Items.Add(FromIP);
                    GRID_Loading.Visibility = Visibility.Collapsed;
                    LBCMessageBox.Show($"查找到服务器{FromIP}");
                }
            });
        }