예제 #1
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");
            }
        }
예제 #2
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");
            }
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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 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();
            };
        }
예제 #7
0
        private async void GetInstaAsync()
        {
            if (IsInternet())
            {
                try
                {
                    using (HttpClient client = new HttpClient())
                    {
                        Insta insta    = new Insta();
                        var   response = await client.GetStringAsync("https://api.instagram.com/v1/tags/techtatva16/media/recent?access_token=630237785.f53975e.8dcfa635acf14fcbb99681c60519d04c");

                        insta = JsonConvert.DeserializeObject <Insta>(response);

                        instagram = insta;
                        foreach (Datum d in insta.data)
                        {
                            BitmapImage b = new BitmapImage();
                            b.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
                            b.UriSource     = new Uri(d.images.thumbnail.url);

                            bmi9.Add(b);
                            bmi25.Add(b);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }

            else
            {
                MainPage.Instance.ShowPopup();

                PRing.Visibility = Visibility.Collapsed;
            }
        }