Beispiel #1
0
        public async void Pin(GenreItem genre)
        {
            int    id     = ApplicationSettingsHelper.ReadTileIdValue() + 1;
            string tileId = AppConstants.TileId + id.ToString();

            ApplicationSettingsHelper.SaveTileIdValue(id);

            string displayName             = "Next Player";
            string tileActivationArguments = ParamConvert.ToString(new string[] { "genre", genre.GenreParam });
            Uri    square150x150Logo       = new Uri("ms-appx:///Assets/AppImages/Logo/Logo.png");

            SecondaryTile secondaryTile = new SecondaryTile(tileId,
                                                            displayName,
                                                            tileActivationArguments,
                                                            square150x150Logo,
                                                            TileSize.Wide310x150);

            secondaryTile.VisualElements.Wide310x150Logo = new Uri("ms-appx:///Assets/AppImages/WideLogo/WideLogo.png");
            secondaryTile.VisualElements.Square71x71Logo = new Uri("ms-appx:///Assets/AppImages/Square71x71Logo/Square71x71LogoTr.png");


            ApplicationSettingsHelper.SaveSettingsValue(AppConstants.TileId, tileId);
            ApplicationSettingsHelper.SaveSettingsValue(AppConstants.TileName, genre.Genre);
            ResourceLoader loader = new ResourceLoader();

            ApplicationSettingsHelper.SaveSettingsValue(AppConstants.TileType, loader.GetString("Genre"));

            App.OnNewTilePinned = UpdateNewSecondaryTile;

            await secondaryTile.RequestCreateAsync();
        }
Beispiel #2
0
        public void RetrieveAdditionalInformationTest_withInvalidID(string value)
        {
            // Arrange
            GenreItem item = new GenreItem("_aa1", "Genre");

            item.BaseTableName = value;

            // Act
            int count = item.RetrieveAdditionalInformation();

            // Assert
            Assert.AreEqual(0, count);
        }
Beispiel #3
0
        public void GenreItemTest_withID()
        {
            // Arrange
            GenreItem item = new GenreItem("_xx1", "Genre");

            // Act
            // Assert
            Assert.IsNotNull(item);
            Assert.IsNotNull(item.Reader);
            Assert.AreEqual("", item.BaseTableName);
            Assert.AreEqual("Genre", item.TargetTableName);

            Assert.AreEqual("_xx1", item.ID);
            Assert.IsNull(item.Genre);
            Assert.IsNull(item.Details);
            Assert.IsNull(item.Status);
            Assert.IsNull(item.LastUpdated);
        }
Beispiel #4
0
        public void RetrieveBasicInformationTest_withValidID_AdditionalInfo(string value)
        {
            // Arrange
            GenreItem item = new GenreItem("_xx1", "Genre");

            item.BaseTableName = value;

            // Act
            int count = item.RetrieveBasicInformation(false);

            // Assert
            Assert.AreEqual(1, count);

            Assert.AreEqual("_xx1", item.ID);
            Assert.AreEqual("_xxx", item.Genre.ID);
            Assert.AreEqual($"{value} Genre Details X1", item.Details);
            Assert.AreEqual("_xxx", item.Status.ID);
            Assert.AreEqual($"{value} Genre LastUpdated X1", item.LastUpdated);
        }
Beispiel #5
0
        public void RetrieveTest_withInvalidID_AdditionalInfo(string value)
        {
            // Arrange
            GenreItem item = new GenreItem("_aa1", "Genre");

            item.BaseTableName = value;

            // Act
            int count = item.Retrieve(false);

            // Assert
            Assert.AreEqual(0, count);

            Assert.AreEqual("_aa1", item.ID);
            Assert.IsNull(item.Genre);
            Assert.IsNull(item.Details);
            Assert.IsNull(item.Status);
            Assert.IsNull(item.LastUpdated);
        }
Beispiel #6
0
        private void button4_Click(object sender, EventArgs e)
        {
            AddEntityForm dlg = new AddEntityForm();

            dlg.Owner = this;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Genre ng    = BookServiceClient.instance.Service.addNewGenre(dlg.NewValue);
                bool  exist = false;
                foreach (object g in comboBox1.Items)
                {
                    GenreItem gi = (GenreItem)g;
                    if (gi.genre.id == ng.id)
                    {
                        exist = true;
                        break;
                    }
                }
                if (!exist)
                {
                    comboBox1.Items.Add(new GenreItem(ng));
                }
            }
        }
Beispiel #7
0
        public async void AddToNowPlayingAsync(GenreItem item)
        {
            var g = await DatabaseManager.GetSongItemsFromGenreAsync(item.GenreParam);

            Library.Current.AddToNowPlaying(g);
        }