コード例 #1
0
ファイル: CSCore.cs プロジェクト: LiquidAmmonia/Miless
 //单例模式"懒汉式"
 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();
 }