public GenreListDataController(IDeezerSession session)
        {
            this.session = session;

            this.fetchState  = new UpdatableFetchState();
            this.tokenSource = new ResetableCancellationTokenSource();
            this.genreList   = new FixedSizeObservableCollection <IGenreViewModel>();
        }
Exemplo n.º 2
0
        public void Test_FixedSizeObservableCollection_FirstReturnsFirstItemInList()
        {
            FixedSizeObservableCollection <string> collection = new FixedSizeObservableCollection <string>(5);

            for (int i = 0; i < 20; i++)
            {
                collection.Add(i.ToString());
                Assert.AreEqual((i < 5 ? "0" : (i - 4).ToString()), collection.First, "First did not return the first instance in list");
            }
        }
Exemplo n.º 3
0
        public void Test_FixedSizeObservableCollection_LastReturnsLastItemInList()
        {
            FixedSizeObservableCollection <string> collection = new FixedSizeObservableCollection <string>(5);

            for (int i = 0; i < 20; i++)
            {
                collection.Add(i.ToString());
                Assert.AreEqual(i.ToString(), collection.Last, "Last did not return the last instance in list");
            }
        }
Exemplo n.º 4
0
        public void Test_FixedSizeObservableCollection_InsertCanInsert()
        {
            FixedSizeObservableCollection <string> collection = new FixedSizeObservableCollection <string>(5);

            for (int i = 0; i < 20; i++)
            {
                collection.Insert(i.ToString());
            }

            Assert.AreEqual("19", collection[0], "Item was added, not inserted.");
        }
Exemplo n.º 5
0
        public void Test_FixedSizeObservableCollection_OnlyOneExistsIfUnique()
        {
            FixedSizeObservableCollection <string> collection = new FixedSizeObservableCollection <string>(5);

            for (int i = 0; i < 20; i++)
            {
                collection.Add("test", true);
            }

            Assert.AreEqual(1, collection.Count);
        }
Exemplo n.º 6
0
        public void Test_FixedSizeObservableCollection_AddingAppendsToList()
        {
            FixedSizeObservableCollection <string> collection = new FixedSizeObservableCollection <string>(5);

            for (int i = 0; i < 20; i++)
            {
                collection.Add(i.ToString());
            }

            Assert.AreEqual("19", collection.Last);
        }
Exemplo n.º 7
0
        public void Test_FixedSizeObservableCollection_CanOnlyStoreFixedSize()
        {
            FixedSizeObservableCollection <string> collection = new FixedSizeObservableCollection <string>(5);

            for (int i = 0; i < 20; i++)
            {
                collection.Add(i.ToString());
            }

            Assert.AreEqual(5, collection.Count, "Collection does not respect the fixed size constraint");
        }
        public UserOverviewDataController(IDeezerSession session)
        {
            this.session = session;

            this.CurrentUserId = 0;
            this.tokenSource   = new ResetableCancellationTokenSource();

            this.flowFetchState            = new UpdatableFetchState();
            this.playlistsFetchState       = new UpdatableFetchState();
            this.completeProfileFetchState = new UpdatableFetchState();

            this.flow      = new PagedObservableCollection <ITrackViewModel>();
            this.playlists = new FixedSizeObservableCollection <IPlaylistViewModel>();
        }
        public ConsoleViewModel()
        {
            ConsoleSettings     = App.ModelManager.Get <UserSettings>().ConsoleSettings;
            ConsoleMessages     = new FixedSizeObservableCollection <string>(100);
            NewCommand          = string.Empty;
            ChatBoxKeyDown      = new RelayCommand(ConsoleCommandEnter);
            ClearConsoleCommand = new RelayCommand(ClearConsole);

            App.ArkRcon.ConsoleLogUpdated += (s, args) =>
            {
                string message = args.Message;
                if (ConsoleSettings.IsTimestampingEnabled)
                {
                    message = args.Timestamp.ToString("(hh:mm tt) ") + message;
                }
                ConsoleMessages.Add(message);
                CheckScrollToBottom();
            };
        }
        public ChatViewModel()
        {
            ChatSettings = App.ModelManager.Get <UserSettings>().ChatSettings;
            ChatMessages = new FixedSizeObservableCollection <ChatMessage>(30);
            EnableChat   = true;
            DisableChat  = false;
            NewMessage   = string.Empty;

            #region Rcon Events
            App.ArkRcon.ChatLogUpdated += (s, args) =>
            {
                AddTextRecieved(args);
            };

            App.ArkRcon.SentMessageUpdated += (s, args) =>
            {
                AddTextSend(args);
            };

            App.ArkRcon.ServerAuthSucceeded += (s, args) =>
            {
                if (App.ModelManager.Get <UserSettings>().GeneralSettings.AutoStartChat)
                {
                    DoEnableChat();
                }
            };

            App.ArkRcon.ServerConnectionDisconnected += (s, args) =>
            {
                DoDisableChat();
            };
            #endregion

            ClearChatCommand             = new RelayCommand(ClearChat);
            EnableChatCommand            = new RelayCommand(DoEnableChat);
            DisableChatCommand           = new RelayCommand(DoDisableChat);
            NewMessageEnterKeyCommand    = new RelayCommand(NewMessageEnterKeyPress);
            NewMessageFocusChangeCommand = new RelayCommand(NewMessageFocusChange);
        }
        public ChatViewModel()
        {
            ChatSettings = App.ModelManager.Get<UserSettings>().ChatSettings;
            ChatMessages = new FixedSizeObservableCollection<ChatMessage>(30);
            EnableChat = true;
            DisableChat = false;
            NewMessage = string.Empty;

            #region Rcon Events
            App.ArkRcon.ChatLogUpdated += (s, args) =>
            {
                AddTextRecieved(args);
            };

            App.ArkRcon.SentMessageUpdated += (s, args) =>
            {
                AddTextSend(args);
            };

            App.ArkRcon.ServerAuthSucceeded += (s, args) =>
            {
                if (App.ModelManager.Get<UserSettings>().GeneralSettings.AutoStartChat)
                    DoEnableChat();
            };

            App.ArkRcon.ServerConnectionDisconnected += (s, args) =>
            {
                DoDisableChat();
            };
            #endregion

            ClearChatCommand = new RelayCommand(ClearChat);
            EnableChatCommand = new RelayCommand(DoEnableChat);
            DisableChatCommand = new RelayCommand(DoDisableChat);
            NewMessageEnterKeyCommand = new RelayCommand(NewMessageEnterKeyPress);
            NewMessageFocusChangeCommand = new RelayCommand(NewMessageFocusChange);
        }