예제 #1
0
            /// <summary>
            /// Adds all the images that can be found in the XmlNode
            /// </summary>
            /// <param name="node">the XmlNode to search through</param>
            public void FromXmlNode(XmlNode node)
            {
                IEnumerator ienumImages = node.GetEnumerator();

                while (ienumImages.MoveNext())
                {
                    XmlNode imageNode = (XmlNode)ienumImages.Current;

                    switch (imageNode.Name)
                    {
                    case "fanart":
                        Fanart.Add(new PlatformImage(imageNode.FirstChild));
                        break;

                    case "banner":
                        Banners.Add(new PlatformImage(imageNode));
                        break;

                    case "boxart":
                        Boxart = new PlatformImage(imageNode);
                        break;

                    case "consoleart":
                        ConsoleArt = imageNode.InnerText;
                        break;

                    case "controllerart":
                        ControllerArt = imageNode.InnerText;
                        break;
                    }
                }
            }
        private void DrawTileMap(DevicePanel d, int x, int y, int platform_x, int platform_y, int platform_width, int platform_height, int transparency)
        {
            if (ScatchLayer != null)
            {
                if (TileMap == null || TileMap != ScatchLayer.Tiles || TilesNeedUpdate || PlatformImage == null)
                {
                    TilesNeedUpdate = false;
                    if (PlatformImage != null)
                    {
                        PlatformImage.Dispose();
                        PlatformImage = null;
                    }

                    TileMap = ScatchLayer.Tiles;

                    var bitmap = new System.Drawing.Bitmap(ScatchLayer.Width * Methods.Solution.SolutionConstants.TILE_SIZE, ScatchLayer.Height * Methods.Solution.SolutionConstants.TILE_SIZE);
                    System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);
                    ScatchLayer.Draw(g);
                    PlatformImage = Methods.Drawing.TextureCreator.FromBitmap(d._device, bitmap);
                    g.Clear(System.Drawing.Color.Transparent);
                    bitmap.Dispose();
                    g.Dispose();
                }

                d.DrawBitmap(PlatformImage, x, y, platform_x, platform_y, platform_width, platform_height, false, transparency);
            }
        }
예제 #3
0
        public ServerListPage()
        {
            listView = new ListView
            {
                ItemTemplate           = new DataTemplate(typeof(ServerCell)),
                SeparatorColor         = Color.FromHex("#ddd"),
                BackgroundColor        = Color.Black,
                IsPullToRefreshEnabled = true,
                HasUnevenRows          = true,
                StyleId = "serverListView"
            };

            listView.SetBinding <ServerListViewModel>(ListView.RefreshCommandProperty, x => x.GetServersCommand);
            listView.ItemTapped += OnItemSelected;
            listView.Refreshing += OnListViewRefreshing;

            StyleId = "serverListPage";
            Title   = "Servers";
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.Fill,
                Children        = { listView }
            };

            ToolbarItems.Add(new ToolbarItem("add", PlatformImage.Resolver("plus.png"), async() => await Navigation.PushAsync(new ServerPage())));
        }
예제 #4
0
        private void ValidatePlatformImage(PlatformImage image)
        {
            Assert.NotNull(image.Id);
            Assert.NotNull(image.Type);
            Assert.NotNull(image.Location);

            Assert.NotNull(image);
            Assert.NotNull(image.OsDisk);
            Assert.NotNull(image.ProvisioningState);
        }
        public ProjectItemOverlayService(ICompositionHost host)
        {
            _host              = host;
            _lockOverlay       = ResourceHelpers.LoadBitmapImage(typeof(SvnManagerPlugin), "Resources/LockControls.png");
            _modifiedOverlay   = ResourceHelpers.LoadBitmapImage(typeof(SvnManagerPlugin), "Resources/Modified.png");
            _unmodifiedOverlay = ResourceHelpers.LoadBitmapImage(typeof(SvnManagerPlugin), "Resources/Unmodified.png");

            _lockedModifiedOverlay   = ResourceHelpers.LoadBitmapImage(typeof(SvnManagerPlugin), "Resources/LockedModified.png");
            _lockedUnmodifiedOverlay = ResourceHelpers.LoadBitmapImage(typeof(SvnManagerPlugin), "Resources/LockedUnmodified.png");

            _addedOverlay = ResourceHelpers.LoadBitmapImage(typeof(SvnManagerPlugin), "Resources/Added.png");
            _svnManager   = _host.GetSharedExportedValue <SvnManagerPlugin>();
        }
예제 #6
0
 private void AssertSame(PlatformImage expected, PlatformImage given, bool resourceToo = true)
 {
     if (resourceToo)
     {
         AssertSameResource(expected, given);
     }
     if (expected == null)
     {
         Assert.Null(given);
     }
     else
     {
         Assert.NotNull(given);
     }
 }
예제 #7
0
        private bool DrawTileMap(DevicePanel d, int _x, int _y, int transparency, System.Drawing.Color color)
        {
            if (ErrorKilled)
            {
                return(false);
            }
            try
            {
                int x = _x - (platform_width / 2);
                int y = _y - (platform_height / 2);

                if (MoveLayer != null)
                {
                    if (TileMap == null || TileMap != MoveLayer.Tiles || TilesNeedUpdate || PlatformImage == null)
                    {
                        TilesNeedUpdate = false;
                        if (PlatformImage != null)
                        {
                            PlatformImage.Dispose();
                            PlatformImage = null;
                        }

                        TileMap = MoveLayer.Tiles;

                        var bitmap = new System.Drawing.Bitmap(MoveLayer.Width * Methods.Solution.SolutionConstants.TILE_SIZE, MoveLayer.Height * Methods.Solution.SolutionConstants.TILE_SIZE);
                        System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);
                        MoveLayer.Draw(g);
                        PlatformImage = Methods.Drawing.TextureCreator.FromBitmap(d._device, bitmap);
                        g.Clear(System.Drawing.Color.Transparent);
                        bitmap.Dispose();
                        g.Dispose();
                    }

                    d.DrawBitmap(PlatformImage, x, y, platform_x, platform_y, platform_width, platform_height, false, transparency, false, false, 0, color);
                }
                return(true);
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
                ErrorKilled = true;
                return(false);
            }
        }
예제 #8
0
        public PlayerListPage()
        {
            listView = new InfiniteListView
            {
                HasUnevenRows          = true,
                ItemTemplate           = new DataTemplate(typeof(PlayerCell)),
                SeparatorColor         = Color.FromHex("#ddd"),
                IsPullToRefreshEnabled = true,
                Header = new Image {
                    Source = PlatformImage.Resolver("header.jpg")
                },
                BackgroundColor = Color.Black,
                LoadMoreCommand = ViewModel.LoadMoreCommand,
                ItemsSource     = ViewModel.Players,
                StyleId         = "playerListView"
            };

            listView.ItemTapped += OnItemSelected;
            listView.Refreshing += OnListViewRefreshing;

            StyleId = "playerListPage";

            var layout = new StackLayout
            {
                VerticalOptions = LayoutOptions.Fill,
                Children        = { listView }
            };

            if (SevenDays.Core.Helpers.Settings.ShowAds)
            {
                layout.Children.Add(new AdMobBuddyControl {
                    AdUnitId = App.AdMobId, StyleId = "admobControl"
                });
            }

            Content = layout;
        }
예제 #9
0
파일: Platform.cs 프로젝트: Blizz9/FanCut
            /// <summary>
            /// Adds all the images that can be found in the XmlNode
            /// </summary>
            /// <param name="node">the XmlNode to search through</param>
            public void FromXmlNode(XmlNode node)
            {
                IEnumerator ienumImages = node.GetEnumerator();
                while (ienumImages.MoveNext()) {
                    XmlNode imageNode = (XmlNode)ienumImages.Current;

                    switch (imageNode.Name) {
                        case "fanart":
                            Fanart.Add(new PlatformImage(imageNode.FirstChild));
                            break;
                        case "banner":
                            Banners.Add(new PlatformImage(imageNode));
                            break;
                        case "boxart":
                            Boxart = new PlatformImage(imageNode);
                            break;
                        case "consoleart":
                            ConsoleArt = imageNode.InnerText;
                            break;
                        case "controllerart":
                            ControllerArt = imageNode.InnerText;
                            break;
                    }
                }
            }
예제 #10
0
        public MenuPage()
        {
            Icon            = PlatformImage.Resolver("menu.png");
            Title           = "menu"; // The Title property must be set.
            BackgroundColor = Color.FromHex("333333");
            StyleId         = "menuPage";

            var cell = new DataTemplate(typeof(MenuCell));

            cell.SetBinding(MenuCell.TextProperty, "Title");
            cell.SetBinding(MenuCell.ImageSourceProperty, "IconSource");

            var menuItems = new List <Model.MenuItem>
            {
                new Model.MenuItem {
                    Title      = "Players",
                    IconSource = PlatformImage.Resolver("people.png"),
                    TargetType = typeof(PlayerListPage)
                },
                new Model.MenuItem {
                    Title      = "Servers",
                    IconSource = PlatformImage.Resolver("servers.png"),
                    TargetType = typeof(ServerListPage)
                },
                new Model.MenuItem {
                    Title      = "Map",
                    IconSource = PlatformImage.Resolver("map.png"),
                    TargetType = typeof(MapPage)
                },
                new Model.MenuItem {
                    Title      = "About",
                    IconSource = PlatformImage.Resolver("info.png"),
                    TargetType = typeof(AboutPage)
                }
            };

            Menu = new ListView
            {
                ItemsSource         = menuItems,
                VerticalOptions     = LayoutOptions.FillAndExpand,
                BackgroundColor     = Color.Transparent,
                SeparatorVisibility = SeparatorVisibility.None,
                ItemTemplate        = cell,
                HasUnevenRows       = true,
                StyleId             = "menuListView"
            };

            var menuLabel = new ContentView
            {
                Padding = new Thickness(10, 36, 0, 5),
                Content = new Label
                {
                    TextColor = Color.FromHex("AAAAAA"),
                    Text      = "MENU",
                },
                StyleId = "menuLabel"
            };

            var layout = new StackLayout
            {
                Spacing         = 0,
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        = { menuLabel, Menu }
            };

            Content = layout;
        }
예제 #11
0
        public PlayerCell()
        {
            var profileImage = new CircleImage
            {
                BorderColor       = Color.Teal,
                BorderThickness   = 2,
                HeightRequest     = 50,
                WidthRequest      = 50,
                Aspect            = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                StyleId           = "profileImage"
            };

            profileImage.SetBinding <PlayerViewModel>(Image.SourceProperty, x => x.Avatar);

            var nameLabel = new Label()
            {
                FontFamily = "HelveticaNeue-Medium",
                FontSize   = Device.OnPlatform(18, 18, 24),
                TextColor  = Color.White,
                StyleId    = "nameLabel"
            };

            nameLabel.SetBinding <PlayerViewModel>(Label.TextProperty, x => x.Name);

            var steamLabel = new Label()
            {
                FontAttributes = FontAttributes.Bold,
                FontSize       = 12,
                StyleId        = "steamLabel"
            };

            steamLabel.SetBinding <PlayerViewModel>(Label.TextColorProperty, x => x.SteamColor);
            steamLabel.SetBinding <PlayerViewModel>(Label.TextProperty, x => x.SteamAvailability);

            var onlineImage = new Image()
            {
                Source        = PlatformImage.Resolver("online.png"),
                HeightRequest = 8,
                WidthRequest  = 8,
                StyleId       = "onlineImage"
            };

            onlineImage.SetBinding <PlayerViewModel>(Image.IsVisibleProperty, x => x.ShouldShowAsOnline);
            var onLineLabel = new Label()
            {
                Text      = "Online",
                TextColor = Color.Green,
                FontSize  = 12,
                IsVisible = false,
                StyleId   = "onlineLabel"
            };

            onLineLabel.SetBinding <PlayerViewModel>(Label.IsVisibleProperty, x => x.ShouldShowAsOnline);

            // Offline image and label
            var offlineImage = new Image()
            {
                Source        = PlatformImage.Resolver("offline.png"),
                HeightRequest = 8,
                WidthRequest  = 8,
                StyleId       = "offlineImage"
            };

            offlineImage.SetBinding <PlayerViewModel>(Image.IsVisibleProperty, x => x.ShouldShowAsOffline);
            var offLineLabel = new Label()
            {
                Text      = "Offline",
                TextColor = Color.FromHex("#ddd"),
                FontSize  = 12,
                IsVisible = false,
                StyleId   = "offlineLabel"
            };

            offLineLabel.SetBinding <PlayerViewModel>(Label.IsVisibleProperty, x => x.ShouldShowAsOffline);

            var statusLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    = { onlineImage, onLineLabel, offlineImage, offLineLabel, steamLabel }
            };

            var timeLabel = new Label
            {
                TextColor      = Color.FromHex("#ddd"),
                FontAttributes = FontAttributes.Italic,
                FontSize       = 10,
                StyleId        = "timeLabel"
            };

            timeLabel.SetBinding <PlayerViewModel>(Label.TextProperty, x => x.LastLogOff);

            var detailsLayout = new StackLayout
            {
                Padding           = new Thickness(10, 0, 0, 0),
                Spacing           = 0,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { nameLabel, statusLayout, timeLabel }
            };

            var tapImage = new Image()
            {
                Source            = PlatformImage.Resolver("tap.png"),
                HorizontalOptions = LayoutOptions.End,
                HeightRequest     = 12,
                StyleId           = "tapImage"
            };

            var cellLayout = new StackLayout
            {
                Spacing           = 0,
                Padding           = new Thickness(10, 5, 10, 5),
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { profileImage, detailsLayout, tapImage }
            };

            StyleId   = "playerCell";
            this.View = cellLayout;
        }
예제 #12
0
        public ServerCell()
        {
            var favoriteAction = new MenuItem {
                Text = "Favorite"
            };

            favoriteAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
            favoriteAction.SetBinding <ServerViewModel>(MenuItem.CommandProperty, x => x.SetDefaultCommand);
            favoriteAction.Clicked += (sender, e) =>
            {
                var mi = (MenuItem)sender;
                var vm = (ServerViewModel)mi.CommandParameter;
                MessagingCenter.Send <ServerCell, ServerViewModel>(this, "Favorite", vm);
            };

            var deleteAction = new MenuItem {
                Text = "Delete", IsDestructive = true
            };

            deleteAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));
            deleteAction.SetBinding <ServerViewModel>(MenuItem.CommandProperty, x => x.DeleteCommand);
            deleteAction.Clicked += (sender, e) =>
            {
                var mi = (MenuItem)sender;
                var vm = (ServerViewModel)mi.CommandParameter;
                MessagingCenter.Send <ServerCell, ServerViewModel>(this, "Delete", vm);
            };

            ContextActions.Add(favoriteAction);
            ContextActions.Add(deleteAction);

            var image = new Image
            {
                Source            = PlatformImage.Resolver("favorite.png"),
                HeightRequest     = 40,
                WidthRequest      = 40,
                Aspect            = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };

            image.SetBinding <ServerViewModel>(Image.IsVisibleProperty, x => x.IsFavorite);

            var notimage = new Image
            {
                HeightRequest     = 40,
                WidthRequest      = 40,
                Aspect            = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };

            notimage.SetBinding <ServerViewModel>(Image.IsVisibleProperty, x => x.IsNotFavorite);

            var nameLabel = new Label()
            {
                FontFamily = "HelveticaNeue-Medium",
                FontSize   = Device.OnPlatform(18, 18, 24),
                TextColor  = Color.White,
                StyleId    = "nameLabel"
            };

            nameLabel.SetBinding <ServerViewModel>(Label.TextProperty, x => x.Host);

            var detailsLayout = new StackLayout
            {
                Padding           = new Thickness(10, 0, 0, 0),
                Spacing           = 0,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                Children          = { nameLabel }
            };

            var cellLayout = new StackLayout
            {
                Spacing           = 0,
                Padding           = new Thickness(10, 10, 10, 5),
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { image, notimage, detailsLayout }
            };

            StyleId   = "serverCell";
            this.View = cellLayout;
        }