예제 #1
0
        private string backTitleForIMC(double imc, double currentHeight, double currentWeight)
        {
            IMCCalculatorManager imcManager = new IMCCalculatorManager();

            string backTitle = "";
            if (imc < 16.5) // Dénutrition
            {
                backTitle = imcManager.weightToGainFromIMC(imc, currentHeight, currentWeight);
            }
            if (16.5 <= imc && imc < 18.5) // Maigreur
            {
                backTitle = imcManager.weightToGainFromIMC(imc, currentHeight, currentWeight);
            }
            if (25 < imc && imc <= 30) // Surpoids
            {
                backTitle = imcManager.weightToLoseFromIMC(imc, currentHeight, currentWeight);
            }
            if (30 < imc) // Obésité et Obésité sévère
            {
                backTitle = imcManager.weightToLoseFromIMC(imc, currentHeight, currentWeight);
            }
            if (18.5 <= imc && imc <= 25) // Zone normale
            {
                backTitle = AppResources.LiveTileBackTitleNormal;
            }

            return backTitle;
        }
예제 #2
0
        /// <summary>
        /// Manage the Tile. Change its count, backTitle and backContent.
        /// </summary>
        /// <param name="count">The tile count</param>
        /// <param name="backTitle">The tile backTitle</param>
        /// <param name="backContent">The tile backContent</param>
        public void changeBackTile(double imc, double currentHeight, double currentWeight, string backContent)
        {
            IMCCalculatorManager imcManager = new IMCCalculatorManager();
            string backTitle = backTitleForIMC(imc, currentHeight, currentWeight);
            string backBackgroundImageName = imageFileNameForIMC(imc);

            // Application Tile is always the first Tile, even if it is not pinned to Start.
            ShellTile TileToFind = ShellTile.ActiveTiles.First();

            // Application should always be found
            if (TileToFind != null)
            {
                createImageForBackTile(backBackgroundImageName);

                // Set the properties to update for the Application Tile.
                // Empty strings for the text values and URIs will result in the property being cleared.
                StandardTileData NewTileData = new StandardTileData
                {
                    // Title = "Mon title",
                    // BackgroundImage = new Uri(textBoxBackgroundImage.Text, UriKind.Relative),
                    Count = Convert.ToInt32(imc),
                    BackTitle = backTitle,
                    BackBackgroundImage = new Uri("isostore:/Shared/ShellContent/tile.png", UriKind.Absolute),
                    BackContent = backContent
                };

                // Update the Application Tile
                TileToFind.Update(NewTileData);
            }
        }