예제 #1
0
 //单例模式"懒汉式"
 public static CSCore GetInstance()
 {
     if (instance == null)
     {
         instance = new CSCore();
     }
     return(instance);
 }
예제 #2
0
        public ChatWindow()
        {
            InitializeComponent();
            CSCore_instance  = CSCore.GetInstance();
            P2PCore_instance = P2PCore.GetInstance();
            //P2PCore_instance.BeginListen();

            FileBuffer = new byte[FileMaxSize];

            inter = InterThreads.GetInstance();
            ChattingMessageList = new ObservableCollection <ChattingMessage>();
        }
예제 #3
0
        private P2PCore()
        {
            receiveBuffer = new byte[bufferSize];
            //内部通信线程
            inter = InterThreads.GetInstance();
            //本机IP
            IP       = GetMyIPv4();
            endpoint = new IPEndPoint(IP, Port);
            //tcp和udp监听线程
            tcplistener = new TcpListener(IP, Port);
            Udplistener = new UdpClient(endpoint);
            //初始化已发送的Udp的消息的List
            UdpMessageList = new List <UdpData>();

            //用于发送Udp ack信号的CSCore
            CSCore_instance = CSCore.GetInstance();
        }
예제 #4
0
        //private List<string> ChattingGroupList

        public MainWindow()
        {
            InitializeComponent();
            //LoginProcess();
            CSCore_instance  = CSCore.GetInstance();
            P2PCore_instance = P2PCore.GetInstance();
            P2PCore_instance.BeginListen();
            inter = InterThreads.GetInstance();


            //MessageBox.Show("Listen Start!");
            lock (inter) inter.processing = true;
            MsgPump = new Thread(ReceiveListener)
            {
                Name = "MessagePump"
            };
        }
예제 #5
0
 private void Login_Loaded(object sender, RoutedEventArgs e)
 {
     CSCore_instance = CSCore.GetInstance();
 }
예제 #6
0
 public AddFriend()
 {
     InitializeComponent();
     CSCore_instance = CSCore.GetInstance();
 }