Esempio n. 1
0
        static NebulaClient()
        {
            AssemblyDirectory = GetAssemblyDirectory();
            MainWindow        = Application.Current.MainWindow as MainWindow;
            Settings          = NebulaSettings.LoadSettings(); //Needs to be first
            Notifications     = new NebulaNotifications();
            Network           = new NebulaNetClient();
            MediaPlayer       = new MediaPlayer();
            Updater           = new NebulaUpdater();
            Playlists         = new PlaylistsManager();
            KeyboardHooker    = new KeyboardHooker();
            SharedSession     = new NebulaSharedSession();
            Session           = new NebulaSession(); //Needs to be latest

            MediaProviders.Add(new YoutubeMediaProvider());

            KeyboardHooker.KeyDown += OnGlobalKeyDown;
            if (Settings.General.MediaKeyEnabled)
            {
                KeyboardHooker.Hook();
            }

            CancellationTokenSource = new CancellationTokenSource();
            Task.Run(() => AppTick(CancellationTokenSource.Token, 500));
#if RELEASE
            CheckForUpdate(true);
#endif
        }
Esempio n. 2
0
 private void OnReceiveSharedSessions(SharedSessionsPollResponse response, NebulaNetClient net)
 {
     NebulaClient.Invoke(() =>
     {
         ListView.Items.Clear();
         foreach (SharedSessionInfo sessionInfo in response.Sessions)
         {
             ListView.Items.Add(sessionInfo);
         }
     });
 }
Esempio n. 3
0
 private void OnReceiveSessionUserMessagePacket(SharedSessionUserMessagePacket packet, NebulaNetClient net)
 {
     if (!IsSessionActive)
     {
         return;
     }
     NebulaClient.BeginInvoke(() => AddMessage(new SharedSessionMessage(FindUserById(packet.User.Id), packet.Message)));
 }
Esempio n. 4
0
 private void OnReceiveSharedSessionUserLeft(SharedSessionUserLeftPacket response, NebulaNetClient net)
 {
     if (!IsSessionActive)
     {
         return;
     }
     NebulaClient.BeginInvoke(() =>
     {
         UserInfo listUser = FindUserById(response.User.Id);
         if (listUser == UserInfo.Empty)
         {
             return;
         }
         Users.Remove(listUser);
         AddMessage(new SharedSessionMessage(listUser, NebulaClient.GetLocString("SharedSessionMessageUserLeft"), "#fc0000"));
     });
 }
Esempio n. 5
0
 private void OnReceiveSharedSessionUserJoin(SharedSessionUserJoinedPacket response, NebulaNetClient net)
 {
     if (!IsSessionActive)
     {
         return;
     }
     NebulaClient.BeginInvoke(() =>
     {
         if (IsUserPresent(response.User))
         {
             return;
         }
         Users.Add(response.User);
         AddMessage(new SharedSessionMessage(FindUserById(response.User.Id), NebulaClient.GetLocString("SharedSessionMessageUserJoined"), "#10b513"));
     });
 }
Esempio n. 6
0
        private void OnReceiveSharedSessionJoinResponse(SharedSessionJoinResponse response, NebulaNetClient net)
        {
            NebulaClient.BeginInvoke(async() =>
            {
                switch (response.ResponseCode)
                {
                case 0:
                    SetSession(response.Session, response.Users);
                    break;

                case 10:
                    await NebulaMessageBox.ShowOk("SharedSessionCantJoin", "Session does not exists");
                    break;

                case 11:
                    break;

                case 12:
                    await NebulaMessageBox.ShowOk("SharedSessionCantJoin", "SharedSessionWrongPassword");
                    break;
                }
            });
        }