示例#1
0
        public override Style SelectStyle(object item, DependencyObject container)
        {
            string itemString = item as string;

            string[] strings = itemString.Split(null);
            int      value;

            if (!Int32.TryParse(strings[strings.Length - 1], out value))
            {
                return(null);
            }

            StackPanel sp = ((Window1)Application.Current.MainWindow).sp1;

            if (value < 5)
            {
                return(sp.FindResource("TreeViewItemStyle1") as Style);
            }
            else
            {
                return(sp.FindResource("TreeViewItemStyle2") as Style);
            }
        }
示例#2
0
        public static StackPanel CreateNewsItem(Article a)
        {
            StackPanel spNews = new StackPanel();

            spNews.Orientation = Orientation.Horizontal;
            int days = Utils.DaysNumberBetweenTwoDates(Session.Instance.Game.date, a.publication);

            string dateString = days == 0 ? spNews.FindResource("str_today").ToString() : String.Format(spNews.FindResource("str_daysAgo").ToString(), days, (days == 1 ? "" : "s"));

            System.Windows.Media.Color color = (System.Windows.Media.Color)Application.Current.FindResource("ColorDate");
            SolidColorBrush            brush = new SolidColorBrush(color);

            brush.Opacity = 0.6;
            spNews.Children.Add(CreateLabel(dateString, "StyleLabel2", 11, 100, brush, null, true));
            spNews.Children.Add(CreateLabel(a.title, "StyleLabel2", 11, -1));
            return(spNews);
        }
示例#3
0
        public override void Full(StackPanel spRanking)
        {
            this.spRanking = spRanking;
            spRanking.Children.Clear();

            StackPanel spLine = new StackPanel();

            spLine.Orientation = Orientation.Horizontal;
            spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.NAME, sortPlayers, spLine.FindResource("str_name").ToString(), "StyleLabel2", FontSize, 100));

            if (Position)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.POSITION, sortPlayers, "Pos", "StyleLabel2", FontSize, 30));
            }
            if (Age)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.AGE, sortPlayers, "Age", "StyleLabel2", FontSize, 60));
            }
            if (Level)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.LEVEL, sortPlayers, "GLO", "StyleLabel2", FontSize, LevelsInNumbers ? 40 : FontSize * 1.5f * 6));
            }
            if (Potential)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.POTENTIAL, sortPlayers, "Pot", "StyleLabel2", FontSize, LevelsInNumbers ? 40 : FontSize * 1.5f * 6));
            }
            if (Condition)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.CONDITION, sortPlayers, "Cond.", "StyleLabel2", FontSize, 40));
            }
            if (Nationality)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.NATIONALITY, sortPlayers, "Nat.", "StyleLabel2", FontSize, 40));
            }
            if (Value)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.VALUE, sortPlayers, "Value", "StyleLabel2", FontSize, 60));
            }
            if (Wage)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.WAGE, sortPlayers, "Wage", "StyleLabel2", FontSize, 60));
            }
            if (ContractBegin)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.CONTRACT_BEGIN, sortPlayers, "Begin", "StyleLabel2", FontSize, 80));
            }
            if (ContractEnd)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.CONTRACT_END, sortPlayers, "End", "StyleLabel2", FontSize, 80));
            }
            if (IsInjuried)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.IS_INJURIED, sortPlayers, "Inj.", "StyleLabel2", FontSize, 30));
            }
            if (Games)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.GAMES, sortPlayers, "Games", "StyleLabel2", FontSize, 50));
            }
            if (Goals)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.GOALS, sortPlayers, "Goals", "StyleLabel2", FontSize, 50));
            }
            if (IsSuspended)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.IS_SUSPENDED, sortPlayers, "Sus", "StyleLabel2", FontSize, 30));
            }
            if (IsInternational)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.IS_INTERNATIONAL, sortPlayers, "Int.", "StyleLabel2", FontSize, 30));
            }
            if (InternationalSelections)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.INTERNATIONAL_SELECTIONS, sortPlayers, "Int. S", "StyleLabel2", FontSize, 50));
            }
            if (InternationalGoals)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.INTERNATIONAL_GOALS, sortPlayers, "Int. G", "StyleLabel2", FontSize, 50));
            }

            spRanking.Children.Add(spLine);

            foreach (Player player in Players)
            {
                StackPanel spPlayer = new StackPanel();
                spPlayer.Orientation = Orientation.Horizontal;
                spPlayer.Children.Add(ViewUtils.CreateLabelOpenWindow <Player>(player, OpenPlayer, player.Name, "StyleLabel2", FontSize, 100));

                if (Position)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(ViewUtils.PlayerPositionOneLetter(player), "StyleLabel2", FontSize, 30));
                }
                if (Age)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(player.Age + " " + spLine.FindResource("str_yo").ToString(), "StyleLabel2", FontSize, 60));
                }
                if (Level)
                {
                    if (!LevelsInNumbers)
                    {
                        spPlayer.Children.Add(ViewUtils.CreateStarNotation(player.Stars, FontSize * 1.5f));
                    }
                    else
                    {
                        spPlayer.Children.Add(ViewUtils.CreateLabel(player.level.ToString(), "StyleLabel2", FontSize, 40, null, null, true));
                    }
                }
                if (Potential)
                {
                    if (!LevelsInNumbers)
                    {
                        spPlayer.Children.Add(ViewUtils.CreateStarNotation(player.StarsPotential, FontSize * 1.5f));
                    }
                    else
                    {
                        spPlayer.Children.Add(ViewUtils.CreateLabel(player.potential.ToString(), "StyleLabel2", FontSize, 40));
                    }
                }
                if (Condition)
                {
                    ProgressBar pb = ViewUtils.CreateProgressBar(player.energy, 0, 100, 40, 10);
                    spPlayer.Children.Add(pb);
                }
                if (Nationality)
                {
                    spPlayer.Children.Add(ViewUtils.CreateFlag(player.nationality, 30, 15));
                }
                if (Value)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(Utils.FormatMoney(player.EstimateTransferValue()), "StyleLabel2", FontSize, 60));
                }
                if (Wage)
                {
                    string wageStr = player.Club != null?Utils.FormatMoney(player.Club.FindContract(player).wage) + "/m" : "-";

                    spPlayer.Children.Add(ViewUtils.CreateLabel(wageStr, "StyleLabel2", FontSize, 60));
                }
                if (ContractBegin)
                {
                    string contractBegin = player.Club != null?player.Club.FindContract(player).beginning.ToShortDateString() : "-";

                    spPlayer.Children.Add(ViewUtils.CreateLabel(contractBegin, "StyleLabel2", FontSize, 80));
                }
                if (ContractEnd)
                {
                    string contractEnd = player.Club != null?player.Club.FindContract(player).end.ToShortDateString() : "-";

                    spPlayer.Children.Add(ViewUtils.CreateLabel(contractEnd, "StyleLabel2", FontSize, 80));
                }
                if (IsInjuried)
                {
                    throw new NotImplementedException();
                }
                if (Games)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(player.playedGames.ToString(), "StyleLabel2", FontSize, 50));
                }
                if (Goals)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(player.goalsScored.ToString(), "StyleLabel2", FontSize, 50));
                }
                if (IsSuspended)
                {
                    throw new NotImplementedException();
                }
                if (IsInternational)
                {
                    throw new NotImplementedException();
                }
                if (InternationalSelections)
                {
                    throw new NotImplementedException();
                }
                if (InternationalGoals)
                {
                    throw new NotImplementedException();
                }

                spRanking.Children.Add(spPlayer);
            }
        }