public void SetList(LastfmData <RecentTrack> tracks)
            {
                tile_view.ClearWidgets();

                foreach (RecentTrack track in tracks)
                {
                    MenuTile tile = new MenuTile();
                    widget_track_map [tile] = track;
                    tile.PrimaryText        = track.Name;
                    tile.SecondaryText      = track.Artist;
                    tile.ButtonPressEvent  += OnTileActivated;

                    // Unfortunately the recently loved list doesn't include what album the song is on
                    if (!String.IsNullOrEmpty(track.Album))
                    {
                        AlbumInfo album = new AlbumInfo(track.Album);
                        album.ArtistName = track.Artist;

                        Gdk.Pixbuf pb = artwork_manager == null ? null : artwork_manager.LookupScalePixbuf(album.ArtworkId, 40);
                        if (pb != null)
                        {
                            tile.Pixbuf = pb;
                        }
                    }

                    tile_view.AddNumberedWidget(tile);
                }

                tile_view.ShowAll();
            }
        public void ItemTest()
        {
            MenuTiles target = new MenuTiles();
            MenuTile  actual = new MenuTile();

            target.Add(actual);
            Assert.AreEqual(target[0], actual);
        }
        public void AddTest()
        {
            var target      = new MenuTiles();
            var historyTile = new MenuTile();

            target.Add(historyTile);
            Assert.IsTrue(target.Count == 1);
        }
 private void SelectionChangedExecute(MenuTile tile)
 {
     //if (tile.Tag == "Translator") {
     //    ShowNotAvailable (tile.Title);
     //    return;
     //}
     _navigationService.Navigate($"Aldeo.View.{tile.Tag}Page");
 }
Exemple #5
0
        public void DisplayNameTest()
        {
            var target = new MenuTile {
                DisplayName = "TestDisplay"
            };
            var actual = target.DisplayName;

            Assert.AreEqual("TestDisplay", actual);
        }
Exemple #6
0
        public void AreaNameTest()
        {
            var target = new MenuTile {
                AreaName = "TestArea"
            };
            var actual = target.AreaName;

            Assert.AreEqual("TestArea", actual);
        }
Exemple #7
0
        private void AppendToList(Connection conn)
        {
            if (conn == null || conn.Roster == null)
            {
                return;
            }

            foreach (Contact contact in conn.Roster.GetAllContacts())
            {
                if (contact == null || contact.Avatar == null)
                {
                    continue;
                }

                MenuTile tile = new MenuTile();
                tile.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                    int main_width, main_height = 0;
                    main_box.GetSizeRequest(out main_width, out main_height);

                    tile.WidthRequest = main_width;
                };

                tile.PrimaryText   = contact.Name;
                tile.SecondaryText = String.IsNullOrEmpty(contact.StatusMessage) ? contact.Status.ToString() : contact.StatusMessage;

                Avatar avatar = contact.Avatar;
                if (avatar.State == AvatarState.Loaded)
                {
                    tile.Pixbuf = new Gdk.Pixbuf(avatar.Image);
                    avatar.Clear(false);
                }
                else
                {
                    tile_map.Add(contact, tile);

                    avatar.Loaded += delegate(object sender, AvatarStateEventArgs e) {
                        Avatar a = sender as Avatar;
                        if (a != null && tile_map.ContainsKey(a.Contact))
                        {
                            if (e.State == AvatarState.Loaded)
                            {
                                tile_map[a.Contact].Pixbuf = new Gdk.Pixbuf(a.Image);
                                a.Clear(false);

                                main_box.QueueDraw();
                            }

                            tile_map.Remove(a.Contact);
                        }
                    };

                    avatar.Load();
                }

                contacts_view.AddWidget(tile);
            }
        }
        public void RemoveAtTest()
        {
            MenuTiles target      = new MenuTiles();
            MenuTile  historyTile = new MenuTile();

            target.Add(historyTile);
            Assert.IsTrue(target.Count == 1);
            target.RemoveAt(0);
            Assert.IsTrue(target.Count == 0);
        }
Exemple #9
0
 private void SelectionChangedExecute(MenuTile tile)
 {
     if (tile.Tag == "Clean" ||
         tile.Tag == "Feed" ||
         tile.Tag == "Play")
     {
         ShowNotAvailable(tile.Title);
         return;
     }
     _navigationService.Navigate($"Aldeo.View.{tile.Tag}Page");
 }
Exemple #10
0
        public override void SetUp()
        {
            base.SetUp();

            firstMenuTile = Presto.Persist <MenuTile>(x => x.Title = "First");
            firstTenant   = firstMenuTile.Tenant;

            secondMenuTile = Presto.Persist <MenuTile>(x => x.Title = "Second");
            secondTenant   = secondMenuTile.Tenant;

            ClarityDB.Instance.SaveChanges();
            ClarityDB.CreateInstance(firstMenuTile.Owner);
        }
            // TODO generalize this
            public void SetList(LastfmData <UserTopArtist> artists)
            {
                tile_view.ClearWidgets();

                foreach (UserTopArtist artist in artists)
                {
                    MenuTile tile = new MenuTile();
                    tile.PrimaryText   = artist.Name;
                    tile.SecondaryText = String.Format(Catalog.GetString("{0} plays"), artist.PlayCount);
                    tile_view.AddNumberedWidget(tile);
                }

                tile_view.ShowAll();
            }
Exemple #12
0
    //This function if called by the MenuTile when one is clicked, it removes the highlighting on all tiles and adds highlighting on the selected one.
    public void ColorSelectedMenuTile(MenuTile selectedTile)
    {
        for (int i = 0; i < menuTiles.Count; i++)
        {
            MenuTile currentTile = menuTiles[i].GetComponent <MenuTile>();
            if (currentTile)
            {
                currentTile.UnSelect();
            }
        }

        if (inventory.currentItem == selectedTile.inventoryEntry && inventory.currentItem.itemName != "BananaFruit" && inventory.currentItem.itemName != "BreadfruitFruit" && inventory.currentItem.itemName != "ShampooGingerFruit" && inventory.currentItem.itemName != "SugarcaneFruit" && inventory.currentItem.itemName != "WildindigoFruit")
        {
            selectedTile.Select();
        }
    }
        public void SetList()
        {
            List <Genre> genres = RadioSource.GetGenres();

            genre_map.Clear();
            tile_view.ClearWidgets();
            foreach (Genre genre in genres)
            {
                MenuTile tile = new MenuTile();
                tile.PrimaryText = genre.Title;
                genre_map.Add(genre.Title, genre);
                tile.SecondaryText     = genre.Description;
                tile.ButtonPressEvent += PlayGenre;
                tile_view.AddWidget(tile);
            }
            tile_view.ShowAll();
        }
        private void PlayGenre(object sender, ButtonPressEventArgs args)
        {
            MenuTile       tile = sender as MenuTile;
            Genre          g    = genre_map[tile.PrimaryText];
            string         type = RadioSource.MembershipTypeSchema.Get();
            RadioTrackInfo rti;

            if (type != "")
            {
                string user = RadioSource.UsernameSchema.Get();
                string pass = RadioSource.PasswordSchema.Get();
                rti = new RadioTrackInfo(g.GetM3uUri(type, user, pass));
            }
            else
            {
                rti = new RadioTrackInfo(g.GetM3uUri());
            }
            Log.Debug(string.Format("Tuning Magnatune to {0}", g.GetM3uUri()), null);
            rti.Play();
        }
Exemple #15
0
        public void MenuTileConstructorTest()
        {
            var target = new MenuTile();

            Assert.IsNotNull(target);
        }