예제 #1
0
        public void AddTile(string title, string detail, string image_source)
        {
            tile_content = SetTileContent(title, detail, image_source);
            var notification = new TileNotification(tile_content.GetXml());

            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }
예제 #2
0
        public void OnLoaded()
        {
            Tile = new TileContent[Cols, Rows];

            using (var stream = new MemoryStream(Data))
            {
                using (var reader = new BinaryReader(stream))
                {
                    for (int y = 0; y < Rows; y++)
                    {
                        for (int x = 0; x < Cols; x++)
                        {
                            reader.BaseStream.Seek(2, SeekOrigin.Current);

                            if (ParseSotp(reader.ReadInt16(), reader.ReadInt16()))
                            {
                                Tile[x, y] = TileContent.Wall;
                            }
                            else
                            {
                                Tile[x, y] = TileContent.None;
                            }
                        }
                    }
                    SetWarps();
                }
            }

            Ready = true;
        }
예제 #3
0
        public static void CreateMainTileNotification(TileContent content, TimeSpan duration)
        {
            var notification = new TileNotification(content.GetXml());

            notification.ExpirationTime = DateTimeOffset.UtcNow + duration;
            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }
예제 #4
0
        private static async void UpdateNewsTile(ArticlePageWorkMode mode)
        {
            var news = await new MalArticlesIndexQuery(mode).GetArticlesIndex();

            try
            {
                var updater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(mode == ArticlePageWorkMode.Articles ? ArticlesTileId : NewsTileId);
                updater.EnableNotificationQueue(true);
                updater.Clear();
                foreach (var malNewsUnitModel in news.Take(5))
                {
                    var tileContent = new TileContent
                    {
                        Visual = new TileVisual
                        {
                            TileMedium = GenerateTileBindingMedium(malNewsUnitModel),
                            TileWide   = GenerateTileBindingWide(malNewsUnitModel),
                        }
                    };
                    if (!ViewModelLocator.Mobile)
                    {
                        tileContent.Visual.TileLarge = GenerateTileBindingLarge(malNewsUnitModel);
                    }
                    updater.Update(new TileNotification(tileContent.GetXml()));
                }
            }
            catch (Exception)
            {
                //can carsh due to unknown reasons
            }
            _tileUpdateSemaphore?.Release();
            NotificationTaskManager.StartNotificationTask(BgTasks.Tiles, false);
        }
예제 #5
0
 public bool IsTileValid(int x, int z, int floorNum, TileContent type)
 {
     Debug.Log("Floor num: " + floorNum);
     Tile[,] floor = map.Floors[floorNum];
     Debug.Log("Content under is " + floor[x, z].Content);
     return(floor[x, z].Content.Equals(type));
 }
예제 #6
0
    private TileNotification GetNotification(ChaseableItem item)
    {
        TileContent content = new TileContent()
        {
            Visual = new TileVisual()
            {
                Arguments  = item.Create(),
                Branding   = TileBranding.NameAndLogo,
                TileMedium = new TileBinding()
                {
                    Content = new TileBindingContentAdaptive()
                    {
                        Children =
                        {
                            new AdaptiveText()
                            {
                                Text      = item.Title,
                                HintStyle = AdaptiveTextStyle.Body
                            },
                            new AdaptiveText()
                            {
                                Text      = item.Body,
                                HintWrap  = true,
                                HintStyle = AdaptiveTextStyle.CaptionSubtle
                            }
                        }
                    }
                }
            }
        };

        return(new TileNotification(content.GetXml()));
    }
예제 #7
0
        public static double WeightForTileType(TileContent content)
        {
            double weight = 0.0;

            switch (content)
            {
            case TileContent.Lava:
            case TileContent.Resource:
            case TileContent.Shop:
            case TileContent.Player:
                weight = Double.MaxValue;
                break;

            case TileContent.Wall:
                weight = 5.0;
                break;

            case TileContent.House:
            case TileContent.Empty:
                weight = 1.0;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(content), content, null);
            }

            return(weight);
        }
        private static void UpdateTile(Dictionary <string, StockData> stocks)
        {
            // Create a tile update manager for the specified syndication feed.
            var updater = TileUpdateManager.CreateTileUpdaterForApplication();

            updater.EnableNotificationQueue(true);

            // Keep track of the number feed items that get tile notifications.
            int itemCount = 0;

            // Create a tile notification for each feed item.
            foreach (var stock in stocks)
            {
                XmlDocument tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150Text03);

                var    ticker    = stock.Key;
                string titleText = ticker == null ? String.Empty : ticker;
                tileXml.GetElementsByTagName(textElementName)[0].InnerText = titleText;
                TileContent      tileContent  = Notification.CreateNotification(stock.Key, stock.Value);
                TileNotification notification = new TileNotification(tileContent.GetXml());
                notification.Tag = ticker;
                var coming = updater.GetScheduledTileNotifications();

                updater.Update(notification);
                // Create a new tile notification.
                // updater.Update(new TileNotification(tileXml));

                // Don't create more than 5 notifications.
                if (itemCount++ > 5)
                {
                    break;
                }
            }
        }
        private async void PinTile()
        {
            SecondaryTile tile = new SecondaryTile(DateTime.Now.Ticks.ToString())
            {
                DisplayName = "Xbox",
                Arguments   = "args"
            };

            tile.VisualElements.Square150x150Logo           = Constants.Square150x150Logo;
            tile.VisualElements.Wide310x150Logo             = Constants.Wide310x150Logo;
            tile.VisualElements.Square310x310Logo           = Constants.Square310x310Logo;
            tile.VisualElements.ShowNameOnSquare150x150Logo = true;
            tile.VisualElements.ShowNameOnSquare310x310Logo = true;
            tile.VisualElements.ShowNameOnWide310x150Logo   = true;

            if (!await tile.RequestCreateAsync())
            {
                return;
            }

            // Generate the tile notification content and update the tile
            TileContent content = GenerateTileContent("MasterHip", "Assets/Photos/Owl.jpg");

            TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(new TileNotification(content.GetXml()));
        }
예제 #10
0
        /// <summary>
        /// Makes sure the main app tile is an icon tile type
        /// </summary>
        public void EnsureMainTileIsIconic()
        {
            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileSmall = new TileBinding()
                    {
                        Content = new TileBindingContentIconic()
                        {
                            Icon = new TileImageSource("ms-appx:///Assets/AppAssets/IconicTiles/Iconic144.png"),
                        }
                    },
                    TileMedium = new TileBinding()
                    {
                        Content = new TileBindingContentIconic()
                        {
                            Icon = new TileImageSource("ms-appx:///Assets/AppAssets/IconicTiles/Iconic200.png"),
                        }
                    }
                }
            };

            // Update the tile
            TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(content.GetXml()));
        }
예제 #11
0
        public static void UpdateBatteryTile(int?percentage)
        {
            if (!SecondaryTile.Exists(BatteryTileId))
            {
                return;
            }

            var deviceId   = SettingsHelper.GetValue(Constants.LastSavedDeviceIdSettingKey, string.Empty);
            var deviceName = SettingsHelper.GetValue(Constants.LastSavedDeviceNameSettingKey, string.Empty);

            var tileVisual = new TileVisual
            {
                Branding   = TileBranding.NameAndLogo,
                TileMedium = CreateMediumTileBinding(percentage ?? 0, deviceName),
                TileWide   = CreateWideTileBinding(percentage ?? 0, deviceName),
                TileLarge  = CreateLargeTileBinding(percentage ?? 0, deviceName)
            };

            var tileContent = new TileContent
            {
                Visual = tileVisual
            };

            var tileNotification = new TileNotification(tileContent.GetXml());

            TileUpdateManager.CreateTileUpdaterForSecondaryTile(BatteryTileId).Update(tileNotification);
        }
예제 #12
0
        public static void ResumeTile()
        {
            var tile = new TileBinding()
            {
                DisplayName = Windows.ApplicationModel.Package.Current.DisplayName,
                Branding    = TileBranding.Name,
                Content     = new TileBindingContentAdaptive()
                {
                    BackgroundImage = new TileBackgroundImage()
                    {
                        Source = MusicImage.DefaultImagePath
                    },
                }
            };
            var tileContent = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = tile,
                    TileWide   = tile,
                    TileLarge  = tile
                }
            };

            // Create the tile notification
            var tileNotification = new TileNotification(tileContent.GetXml());

            // And send the notification to the primary tile
            tileUpdater.Update(tileNotification);
        }
예제 #13
0
파일: Bot.cs 프로젝트: LHGames-2018/XSF
        internal int[] getDistance(TileContent tile, Map map)
        {
            int lowest    = 20;
            int Xdistance = 0;
            int Ydistance = 0;

            for (int dx = -9; dx <= 9; dx++)
            {
                for (int dy = -9; dy <= 9; dy++)
                {
                    if (map.GetTileAt(PlayerInfo.Position.X + dx, PlayerInfo.Position.Y + dy) == tile)
                    {
                        int total = Math.Abs(dx) + Math.Abs(dy);
                        if (total <= lowest)
                        {
                            Xdistance = dx;
                            Ydistance = dy;
                            lowest    = total;
                        }
                        Console.WriteLine("total: " + total);
                    }
                }
            }
            int[] returnValue = { Xdistance, Ydistance };
            return(returnValue);
        }
예제 #14
0
        private void SendTileNotification_Click(object sender, RoutedEventArgs e)
        {
            if (VerifyTileIsPinned())
            {
                var tileContent = new TileContent
                {
                    Visual = new TileVisual
                    {
                        TileWide = new TileBinding
                        {
                            Content = new TileBindingContentAdaptive
                            {
                                Children =
                                {
                                    new AdaptiveText {
                                        Text = "Sent to a secondary tile from NotificationsExtensions!", HintWrap = true
                                    },
                                }
                            }
                        }
                    }
                };
                // Send the notification to the secondary tile by creating a secondary tile updater
                TileUpdateManager.CreateTileUpdaterForSecondaryTile(MainPage.dynamicTileId).Update(new TileNotification(tileContent.GetXml()));

                rootPage.NotifyUser("Tile notification sent to " + MainPage.dynamicTileId, NotifyType.StatusMessage);
            }
        }
예제 #15
0
        public static void UpdateTile(TileBindingContentAdaptive tileContent, int tileStyle)
        {
            //  tileStyle == 0  ->  中磁贴
            //  tileStyle == 1  ->  宽磁贴
            TileContent content;

            if (tileStyle == 0)
            {
                content = new TileContent()
                {
                    Visual = new TileVisual()
                    {
                        TileMedium = new TileBinding()
                        {
                            Content = tileContent
                        }
                    }
                };
            }
            else
            {
                content = new TileContent()
                {
                    Visual = new TileVisual()
                    {
                        TileWide = new TileBinding()
                        {
                            Content = tileContent
                        }
                    }
                };
            }
            TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(content.GetXml()));
        }
예제 #16
0
    private void BuildMultipleWallTwo(TileContent wallTextureType)
    {
        for (int y = 4; y < 9; y++)
        {
            BuildAWall(12, y, wallTextureType);
            BuildAWall(18, y, wallTextureType);
        }

        for (int y = 12; y < 17; y++)
        {
            BuildAWall(12, y, wallTextureType);
            BuildAWall(18, y, wallTextureType);
        }

        for (int x = 7; x < 12; x++)
        {
            BuildAWall(x, 8, wallTextureType);
            BuildAWall(x, 12, wallTextureType);
        }

        for (int x = 19; x < 24; x++)
        {
            BuildAWall(x, 8, wallTextureType);
            BuildAWall(x, 12, wallTextureType);
        }

        BuildAWall(15, 10, wallTextureType);
    }
예제 #17
0
        internal async Task PinTile(ForecastData fd)
        {
            data = fd;

            if (data.confidenceDifference > 0.01)
            {
                diffDemocrat   = " (+" + data.confidenceDifference.ToString("F1") + "%)";
                diffRepublican = " (" + (-data.confidenceDifference).ToString("F1") + "%)";
            }
            else if (data.confidenceDifference < -0.01)
            {
                diffDemocrat   = " (" + data.confidenceDifference.ToString("F1") + "%)";
                diffRepublican = " (+" + (-data.confidenceDifference).ToString("F1") + "%)";
            }



            TileUpdateManager.CreateTileUpdaterForApplication().Clear();
            TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);

            int mode = 0;

            for (int i = 0; i < 2; i++)
            {
                TileContent content = GenerateTileContent(mode);

                TileNotification t = new TileNotification(content.GetXml());
                t.Tag = i.ToString();
                TileUpdateManager.CreateTileUpdaterForApplication().Update(t);
                mode++;
            }
        }
예제 #18
0
 public Node(Node goalNode, Point point, Node parent, TileContent tileType)
 {
     this.goalNode = goalNode;
     Point         = point;
     Parent        = parent;
     tileContent   = tileType;
 }
예제 #19
0
        /// <summary>
        /// Gets tile content by index.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="steamId"></param>
        /// <returns></returns>
        private async Task <TileContent> GetTileContentAsync(int index, string steamId = null)
        {
            var game = await GetSingleGameAsync(index, steamId);

            // No text on wide tile because game images contain the game name
            // No medium live tile because game images contain text, which would usually be cropped
            // No large tile because game images aren't as big
            // Perhaps we could show some community content on large tile?

            var content = new TileContent
            {
                Visual = new TileVisual
                {
                    TileWide = new TileBinding
                    {
                        Content = new TileBindingContentAdaptive
                        {
                            BackgroundImage = new TileBackgroundImage()
                            {
                                Source = game.FormattedLogoUrl
                            }
                        }
                    }
                }
            };

            return(content);
        }
예제 #20
0
        public static XmlDocument GenerateTextTile(string text)
        {
            TileContent tile = new TileContent()
            {
                Visual = new TileVisual()
                {
                    Branding   = TileBranding.None,
                    TileMedium = new TileBinding()
                    {
                        Content = CreateMediumAdaptiveTextContent(text)
                    },
                    TileWide = new TileBinding()
                    {
                        Content = CreateLargeAdaptiveTextContent(text)
                    },
                    TileLarge = new TileBinding()
                    {
                        Content = CreateLargeAdaptiveTextContent(text)
                    },
                }
            };

            var xdoc = new XmlDocument();

            xdoc.LoadXml(tile.GetContent());

            return(xdoc);
        }
        private async void UpdateMedium(TileBindingContentAdaptive mediumContent)
        {
            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Content = mediumContent
                    }
                }
            };

            try
            {
                TileUpdateManager.CreateTileUpdaterForSecondaryTile("SecondaryTile").Update(new TileNotification(content.GetXml()));
            }

            catch
            {
                SecondaryTile tile = new SecondaryTile("SecondaryTile", "Example", "args", new Uri("ms-appx:///Assets/Logo.png"), TileSize.Default);
                tile.VisualElements.ShowNameOnSquare150x150Logo = true;
                tile.VisualElements.ShowNameOnSquare310x310Logo = true;
                tile.VisualElements.ShowNameOnWide310x150Logo   = true;
                tile.VisualElements.BackgroundColor             = Colors.Transparent;
                await tile.RequestCreateAsync();

                TileUpdateManager.CreateTileUpdaterForSecondaryTile("SecondaryTile").Update(new TileNotification(content.GetXml()));
            }
        }
예제 #22
0
        public string CreateAdaptiveTile(string prefix, string leftTitle, string leftValue, string rightTitle, string rightValuevalue, string dateTitle, string dateContent)
        {
            // Create a TileBinding for Large and Wide
            var bigTilebinding = new TileBinding();

            bigTilebinding.Content = CreateTileContent(prefix, leftTitle, leftValue, rightTitle, rightValuevalue, dateTitle, dateContent);

            var mediumTileBinding = new TileBinding();

            mediumTileBinding.Content = CreateTileContent(string.Empty, leftTitle, leftValue, rightTitle, rightValuevalue, string.Empty, dateContent);

            //Create visual object
            var tileVisual = new TileVisual();

            tileVisual.TileLarge = tileVisual.TileWide = bigTilebinding;

            tileVisual.TileMedium = mediumTileBinding;

            //Create tile object
            var tileObject = new TileContent();

            tileObject.Visual = tileVisual;

            return(tileObject.GetContent());
        }
예제 #23
0
        public static TileNotification update_players1()
        {
            var tileContent = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Branding = TileBranding.Logo,
                        Content  = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                new AdaptiveText()
                                {
                                    Text = "测试2"
                                }
                            }
                        }
                    }
                }
            };
            var tileNotif = new TileNotification(tileContent.GetXml());

            return(tileNotif);
        }
예제 #24
0
 public bool LoadTileSheets()
 {
     string[] files = null;
     try {
         files = Directory.GetFiles(Constants.Paths.TileDirectory);
     } catch (Exception e) {
         System.Diagnostics.Debug.WriteLine("Exception while reading directory: " + e.Message);
         return(false);
     }
     if (files != null)
     {
         foreach (string file in files)
         {
             if (file.EndsWith(".jts", StringComparison.OrdinalIgnoreCase))
             {
                 TileSheet newTileSheet = TileSheet.ReadFromFile(file);
                 if (newTileSheet != null)
                 {
                     try {
                         TileContent.Load <Texture2D>(newTileSheet.TextureKey);
                     } catch (ContentLoadException e) {
                         System.Diagnostics.Debug.WriteLine("Error while reading file" + newTileSheet.TextureKey + ": " + e.Message);
                         Exit();
                     }
                     TileSheets.Add(newTileSheet.TextureKey, newTileSheet);
                     newTileSheet.GetTexture = GetTileSheet;
                 }
             }
         }
     }
     return(true);
 }
예제 #25
0
        private static void ShowNowPlayingTileUpdateBase(SongMetadata nowPlaying, TileUpdater tiler, TileBindingContentAdaptive largeBindingContent, TileBindingContentAdaptive mediumBindingContent, TileBindingContentAdaptive smallBindingContent)
        {
            Func <TileBindingContentAdaptive, TileBinding> createBinding = (TileBindingContentAdaptive con) =>
            {
                return(new TileBinding()
                {
                    Branding = TileBranding.NameAndLogo,

                    DisplayName = "Now Playing on Neptunium",

                    Content = con,

                    ContentId = nowPlaying.Track.GetHashCode().ToString()
                });
            };



            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = createBinding(smallBindingContent),
                    TileWide   = createBinding(mediumBindingContent),
                    TileLarge  = createBinding(largeBindingContent)
                }
            };

            var tile = new TileNotification(content.GetXml());

            tiler.Update(tile);
        }
        public static void CreateRecentActvityLiveTile(Feed feed)
        {
            TileBindingContentAdaptive bindingContent;

            if (feed.SmallImageUrl != null)
            {
                bindingContent = new TileBindingContentAdaptive()
                {
                    PeekImage = new TilePeekImage()
                    {
                        Crop    = TileImageCrop.None,
                        Overlay = 0,
                        Source  =
                            new TileImageSource(feed.SmallImageUrl)
                    },
                    Children =
                    {
                        new TileText()
                        {
                            Text  = feed.Caption,
                            Wrap  = true,
                            Style = TileTextStyle.Body
                        }
                    }
                };
            }
            else
            {
                bindingContent = new TileBindingContentAdaptive()
                {
                    Children =
                    {
                        new TileText()
                        {
                            Text  = feed.Caption,
                            Wrap  = true,
                            Style = TileTextStyle.Body
                        }
                    }
                };
            }
            var binding = new TileBinding()
            {
                Branding = TileBranding.NameAndLogo,
                Content  = bindingContent
            };
            var content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = binding,
                    TileWide   = binding,
                    TileLarge  = binding
                }
            };
            var tileXml          = content.GetXml();
            var tileNotification = new TileNotification(tileXml);

            TileUpdateManager.CreateTileUpdaterForApplication().Update(tileNotification);
        }
예제 #27
0
    string SearchDirection(Point direction)
    {
        Point position = brain.playerInfo.HouseLocation;

        for (int i = 0; i < 20; i++)
        {
            Point nextPosition = position + direction;
            if (IsOutOfMap(nextPosition))
            {
                break;
            }
            else
            {
                TileContent tile = brain.map.GetTileAt(nextPosition.X, nextPosition.Y);
                if (tile == TileContent.Wall || tile == TileContent.Resource)
                {
                    destination = nextPosition;
                    return(GoTo(nextPosition));
                }
            }
            position = nextPosition;
        }

        destination = position;
        return(GoTo(position));
    }
예제 #28
0
        public static void UpdateLiveTile()
        {
            try
            {
                var tile          = new TileBinding();
                var photosContent = new TileBindingContentPhotos();

                var list = new HighlightImageService(null, null).GetImages(1, 5);
                foreach (var e in list)
                {
                    photosContent.Images.Add(new TileImageSource(e.Urls.Tile));
                }

                tile.Content = photosContent;

                var tileContent = new TileContent
                {
                    Visual = new TileVisual()
                };
                tileContent.Visual.Branding   = TileBranding.NameAndLogo;
                tileContent.Visual.TileMedium = tile;
                tileContent.Visual.TileWide   = tile;
                tileContent.Visual.TileLarge  = tile;

                TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(tileContent.GetXml()));
            }
            catch (Exception e)
            {
                _ = Logger.LogAsync(e);
            }
        }
예제 #29
0
    private void BuildMultipleWallNine(TileContent wallTextureType)
    {
        for (int y = 0; y < 6; y++)
        {
            BuildAWall(27, y, wallTextureType);
            BuildAWall(24, y, wallTextureType);
            BuildAWall(21, y, wallTextureType);
            BuildAWall(18, y, wallTextureType);
            BuildAWall(15, y, wallTextureType);
            BuildAWall(12, y, wallTextureType);
        }

        for (int y = 9; y < 15; y++)
        {
            BuildAWall(27, y, wallTextureType);
            BuildAWall(24, y, wallTextureType);
            BuildAWall(21, y, wallTextureType);
            BuildAWall(18, y, wallTextureType);
            BuildAWall(15, y, wallTextureType);
            BuildAWall(12, y, wallTextureType);
        }

        for (int x = 1; x < 29; x += 2)
        {
            BuildAWall(x, 16, wallTextureType);
            BuildAWall(x, 18, wallTextureType);
        }
    }
예제 #30
0
 public void ExplodeContent()
 {
     if (TileContent != null)
     {
         TileContent.Destroy();
     }
 }
예제 #31
0
파일: Tile.cs 프로젝트: k-lock/Unity3D
    public void Init( MeshBoard meshboard, int index )
    {
        meshBoard = meshboard;

        Index = index;
        CONTENTCODE = TileContent.Empty;

        SetColor( Color.white );
    }
예제 #32
0
    private Point FindCode( TileContent contentIn )
    {
        // Find the requested code and return the point.

        foreach ( Point point in AllSquares() )
        {
            if ( squares[ point.x, point.y ].ContentCode == contentIn)
            {
                return new Point( point.x, point.y );
            }
        }
        return new Point(-1, -1);
    }
        private void ButtonNotifyPrimaryTile_Click(object sender, RoutedEventArgs e)
        {
            // In a real app, these would be initialized with actual data
            string from = "Jennifer Parker";
            string subject = "Photos from our trip";
            string body = "Check out these awesome photos I took while in New Zealand!";


            // Construct the tile content
            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Content = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                new AdaptiveText()
                                {
                                    Text = from
                                },

                                new AdaptiveText()
                                {
                                    Text = subject,
                                    HintStyle = AdaptiveTextStyle.CaptionSubtle
                                },

                                new AdaptiveText()
                                {
                                    Text = body,
                                    HintStyle = AdaptiveTextStyle.CaptionSubtle
                                }
                            }
                        }
                    },

                    TileWide = new TileBinding()
                    {
                        Content = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                new AdaptiveText()
                                {
                                    Text = from,
                                    HintStyle = AdaptiveTextStyle.Subtitle
                                },

                                new AdaptiveText()
                                {
                                    Text = subject,
                                    HintStyle = AdaptiveTextStyle.CaptionSubtle
                                },

                                new AdaptiveText()
                                {
                                    Text = body,
                                    HintStyle = AdaptiveTextStyle.CaptionSubtle
                                }
                            }
                        }
                    }
                }
            };


            // Then create the tile notification
            var notification = new TileNotification(content.GetXml());


            // And send the notification
            TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
        }
예제 #34
0
        private void RefreshTiles(Coord[] coords, TileContent toType)
        { //ändert die Felder an den Angegebenen Koordinaten in den angegebenen typ                                                        
            for (int i = 0; i < coords.Length; i++)
            {
                homeTiles[coords[i].Row, coords[i].Col] = toType;
            }

        }
예제 #35
0
 private static async void UpdateNewsTile(ArticlePageWorkMode mode)
 {
     var news = await new MalArticlesIndexQuery(mode).GetArticlesIndex();
     try
     {
         var updater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(mode == ArticlePageWorkMode.Articles ? ArticlesTileId : NewsTileId);
         updater.EnableNotificationQueue(true);
         updater.Clear();
         foreach (var malNewsUnitModel in news.Take(5))
         {
             var tileContent = new TileContent
             {
                 Visual = new TileVisual
                 {
                     TileMedium = GenerateTileBindingMedium(malNewsUnitModel),
                     TileWide = GenerateTileBindingWide(malNewsUnitModel),
                 }
             };
             if (!ViewModelLocator.Mobile)
                 tileContent.Visual.TileLarge = GenerateTileBindingLarge(malNewsUnitModel);
             updater.Update(new TileNotification(tileContent.GetXml()));
         }
     }
     catch (Exception)
     {
         //can carsh due to unknown reasons
     }
     _tileUpdateSemaphore?.Release();
     NotificationTaskManager.StartNotificationTask(BgTasks.Tiles, false);
 }
예제 #36
0
    public void ToNext(TileContent next)
    {
        this.Next = next;

        this.TargetSide = Side.Custom;
        flipFullIfNeeded = true;
        this.SwapContentOnEdge();
    }
예제 #37
0
    protected virtual void SwapContentOnEdge()
    {
        if (!this.gameObject.activeInHierarchy)
        {
            return;
        }

        if (this.CurrentSide != Side.Edge)
        {
            return;
        }

        this.flipFullIfNeeded = false;
        if (this.TargetSide == Side.Edge)
        {
            return;
        }

        TileContent newContent = null;
        if (this.Next != null)
        {
            newContent = this.Next;
            this.TargetSide = Side.Custom;
            this.Next = null;   // applied next.
            Debug.Log("Got next content. Got to go to Custom.");
        }
        else
        {
            newContent = this.TargetSide == Side.Front ? this.Front : this.Back;
        }

        if (newContent == null)
        {
            this.gameObject.SetActive(false);
        }
        // update text
        if (this.TextMesh == null)
        {
            Debug.Log(string.Format("{0} can't swap on edge. textMesh null: {1} activeInHierarchy: {2}", this, (this.TextMesh == null), this.gameObject.activeInHierarchy));
            return;
        }
        this.TextMesh.text = newContent.Text;

        // update material
        if (newContent.Material != null)
        {
            this.GetComponent<Renderer>().material = newContent.Material;
        }

        if (this.ClickCall != null)
        {
            this.ClickCall.CallMessage = newContent.CallMessage;
            this.ClickCall.Parameter = newContent.CallParameter;
        }
        else
        {
            Debug.Log(string.Format("ClickCall is null on: {0}", this));
        }
    }
        private async void ButtonNotifySecondary_Click(object sender, RoutedEventArgs e)
        {
            // In a real app, these would be initialized with actual data
            string from = "Steve Bosniak";
            string subject = "Build 2015 Dinner";
            string body = "Want to go out for dinner after Build tonight?";


            // Construct the tile content
            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding()
                    {
                        Content = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                new AdaptiveText()
                                {
                                    Text = from
                                },

                                new AdaptiveText()
                                {
                                    Text = subject,
                                    HintStyle = AdaptiveTextStyle.CaptionSubtle
                                },

                                new AdaptiveText()
                                {
                                    Text = body,
                                    HintStyle = AdaptiveTextStyle.CaptionSubtle
                                }
                            }
                        }
                    }
                }
            };


            // Then create the tile notification
            var notification = new TileNotification(content.GetXml());


            // If the secondary tile is pinned
            if (SecondaryTile.Exists("MySecondaryTile"))
            {
                // Get its updater
                var updater = TileUpdateManager.CreateTileUpdaterForSecondaryTile("MySecondaryTile");

                // And send the notification
                updater.Update(notification);
            }

            else
                await new MessageDialog("You must first pin the secondary tile.").ShowAsync();
        }
예제 #39
0
        private TileNotification CreateLiveTile(SimpleLaunchData launchData)
        {
            TileContent content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = new TileBinding
                    {
                        Branding = TileBranding.None,
                        Content = new TileBindingContentAdaptive
                        {
                            PeekImage = new TilePeekImage()
                            {
                                Source = "Assets/Square150x150Logo.scale-200.png"
                            },
                            Children =
                            {
                                new AdaptiveText()
                                {
                                    Text = "Next Launch:",
                                    HintWrap = true,
                                    HintStyle = AdaptiveTextStyle.Caption
                                },
                                new AdaptiveText(),
                                new AdaptiveText()
                                {
                                    Text = launchData.LaunchNet,
                                    HintWrap = true,
                                    HintStyle = AdaptiveTextStyle.Caption
                                }
                            }
                        }
                    },

                    TileWide = new TileBinding()
                    {
                        Branding = TileBranding.NameAndLogo,
                        DisplayName = "LaunchPal",
                        Content = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                new AdaptiveText()
                                {
                                    Text = launchData.Name,
                                    HintWrap = false,
                                    HintStyle = AdaptiveTextStyle.Body
                                },

                                new AdaptiveText()
                                {
                                    Text = launchData.LaunchNet,
                                    HintWrap = false,
                                    HintStyle = AdaptiveTextStyle.CaptionSubtle
                                },

                                new AdaptiveText()
                                {
                                    Text = "Status: " + launchData.Status,
                                    HintWrap = false,
                                    HintStyle = AdaptiveTextStyle.Body
                                },                                
                            }
                        }
                    },

                    TileLarge = new TileBinding
                    {
                        Branding = TileBranding.NameAndLogo,
                        DisplayName = "LaunchPal",
                        Content = new TileBindingContentAdaptive()
                        {
                            Children =
                            {
                                new AdaptiveText()
                                {
                                    Text = launchData.Name,
                                    HintWrap = false,
                                    HintStyle = AdaptiveTextStyle.Body
                                },

                                new AdaptiveText()
                                {
                                    Text = launchData.LaunchNet,
                                    HintWrap = false,
                                    HintStyle = AdaptiveTextStyle.CaptionSubtle
                                },

                                new AdaptiveText()
                                {
                                    Text = "Status - " + launchData.Status,
                                    HintWrap = false,
                                    HintStyle = AdaptiveTextStyle.Body
                                },

                                new AdaptiveText(),

                                new AdaptiveText
                                {
                                    Text = "Mission Description",
                                    HintWrap = false,
                                    HintStyle = AdaptiveTextStyle.Body
                                },

                                new AdaptiveText()
                                {
                                    Text = launchData.Description,
                                    HintWrap = true,
                                    HintStyle = AdaptiveTextStyle.Caption
                                },
                            }
                        }
                    }

                }
            };

            return new TileNotification(content.GetXml())
            {
                ExpirationTime = launchData.Net.AddMinutes(30)
            };
        }
        private void ButtonSendTileNotification_Click(object sender, RoutedEventArgs e)
        {
            var version = GetOSVersion();
            var deviceFamily = AnalyticsInfo.VersionInfo.DeviceFamily;

            TileContent content;

            // If they're running 10586 or newer
            if (version > new Version(10, 0, 10586, 0))
            {
                content = new TileContent()
                {
                    Visual = new TileVisual()
                    {
                        TileMedium = new TileBinding()
                        {
                            Content = new TileBindingContentAdaptive()
                            {
                                Children =
                                {
                                    new AdaptiveText()
                                    {
                                        Text = $"Build {version.Build}",
                                        HintWrap = true
                                    },

                                    new AdaptiveText()
                                    {
                                        Text = $"Family: {deviceFamily}",
                                        HintWrap = true
                                    }
                                },

                                // We include the peek image here
                                PeekImage = new TilePeekImage()
                                {
                                    Source = "Assets/map.jpg",
                                    HintOverlay = 20
                                }
                            }
                        }
                    }
                };
            }

            // Otherwise assume they're running 10240
            else
            {
                content = new TileContent()
                {
                    Visual = new TileVisual()
                    {
                        TileMedium = new TileBinding()
                        {
                            Content = new TileBindingContentAdaptive()
                            {
                                Children =
                                {
                                    new AdaptiveText()
                                    {
                                        Text = $"Build {version.Build}",
                                        HintWrap = true
                                    },

                                    new AdaptiveText()
                                    {
                                        Text = $"Family: {deviceFamily}",
                                        HintWrap = true
                                    }
                                }

                                // No peek image
                            }
                        }
                    }
                };
            }

            TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(content.GetXml()));
        }