Ejemplo n.º 1
0
 public RoomPainter(TTClient parent)
 {
     client = parent;
     paintingQueue = new LockFreeQueue<Action>();
     chatLines = new string[0];
     threadTicker = new Timer(Tick, null, 300, 300); /// 4 fps :D
     Instance = this;
 }
Ejemplo n.º 2
0
        public SyncDate()
        {
            OnPropertyChanged("Value");

            var service = new TTClient();

            timer.Interval = TimeSpan.FromSeconds(1);

            timer.Tick += (s, e) =>
            {
                OnPropertyChanged("Value");
            };

            timer.Start();

            service.RemoteDatetimeAsync().ContinueWith(t =>
            {
                if (t.IsCompleted)
                {
                    gap = t.Result.Subtract(DateTime.Now).Ticks;
                }
            });
        }
Ejemplo n.º 3
0
        void JoinRoom(int roomIndex, bool resetReader = true)
        {
            currentState = State.GettingRoom;
            if (resetReader)
            {
                OnGetInput = null;
                readerActive = false;
            }
            Room toJoin = roomList[roomIndex];
            client = new TTClient(userInformation.userid, userInformation.userauth, toJoin.roomid);
            painter = new RoomPainter(client);

            client.OnJoinedRoom += new Action(client_OnJoinedRoom);

            Console.Clear();
            Console.SetCursorPosition(0, 0);
            Console.WriteLine("Now where did I leave my card for the room... ");

            client.StreamsToSync += new StreamSync(simpleStream.loadStream);
            client.StreamsToSync += new StreamSync(client_StreamsToSync);
            client.OnSpeak += RoomPainter.Instance.NewChat;

            int attempts = 0;
            while (!client.Connect() && attempts++ < 5) Console.WriteLine("Damnit, where the hell is it... x{0}", attempts);
            if (!client.isConnected)
            {
                DisplayRooms();
                return;
            }
        }
Ejemplo n.º 4
0
 public static void RegisteredUser(TTClient instance, Registered registeredUsers)
 {
     for (int i = 0; i < registeredUsers.user.Length; ++i)
         instance.RegisterUser(registeredUsers.user[i]);
 }
Ejemplo n.º 5
0
 public static void NoSong(TTClient instance, SongChange roomInfo)
 {
     instance.UpdateRoomInformation(roomInfo.room);
 }
Ejemplo n.º 6
0
 public static void DeregisteredUser(TTClient instance, DeRegistered deregisteredUsers)
 {
     for (int i = 0; i < deregisteredUsers.user.Length; ++i)
         instance.DeregisterUser(deregisteredUsers.user[i]);
 }