Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var artistsList = new DocsReader().CreateIdList().Where(d => d.EventName == Intent.GetStringExtra("EventName")).Where(e => e.Day == Convert.ToInt32(Intent.GetStringExtra("Day"))).OrderBy(e => e.Stage).ThenBy(t => t.SetStartTime).ToList();
            var stages      = artistsList.Select(t => t.Stage).Distinct();

            var compareDate = DateTime.Parse("07:00:00.000");

            foreach (var artist in artistsList.ToList())
            {
                if (artist.SetStartTime < compareDate)
                {
                    var artist2 = artist;
                    artistsList.Remove(artist);
                    artistsList.Add(artist2);
                }
            }

            var layoutCreator = new LayoutCreation();
            var scrollView    = layoutCreator.CreateBaiscScrollView(this);
            var linearLayout  = layoutCreator.CreateBasicLinearLayout(this);


            foreach (var stage in stages)
            {
                linearLayout.AddView(layoutCreator.CreateSimpleButton(this, Color.White, Color.SteelBlue, stage, null, true));

                foreach (var artist in artistsList.Where(a => a.Stage == stage))
                {
                    var artistText = new TextView(this)
                    {
                        Text     = artist.Name + " :",
                        TextSize = 21
                    };
                    artistText.SetTextColor(Color.White);

                    var artistTime = new TextView(this)
                    {
                        Text = artist.SetStartTime.ToShortTimeString() + " - " +
                               artist.SetEndTime.ToShortTimeString(),
                        TextSize = 20
                    };
                    artistTime.SetTextColor(Color.Silver);

                    var breakLine = new TextView(this)
                    {
                        Text = "-------------------------------"
                    };
                    breakLine.SetTextColor(Color.Black);

                    linearLayout.AddView(artistText);
                    linearLayout.AddView(artistTime);
                    linearLayout.AddView(breakLine);
                }
            }
            scrollView.AddView(linearLayout);
            SetContentView(scrollView);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var layoutCreator = new LayoutCreation();
            var scrollView    = layoutCreator.CreateBaiscScrollView(this);
            var linearLayout  = layoutCreator.CreateBasicLinearLayout(this);

            var artistsList = new DocsReader().CreateIdList().Where(d => d.EventName == Intent.GetStringExtra("EventName")).Where(y => y.Day == Convert.ToInt32(Intent.GetStringExtra("Day"))).OrderBy(a => a.SetStartTime.Hour).ToList();

            var CompareDate = DateTime.Parse("07:00:00.000");

            foreach (var artist in artistsList.ToList())
            {
                if (artist.SetStartTime < CompareDate)
                {
                    var artist2 = artist;
                    artistsList.Remove(artist);
                    artistsList.Add(artist2);
                }
            }

            for (var artistId = 0; artistId < artistsList.Count(); artistId++)
            {
                if (artistId != 0)
                {
                    if (artistsList.ElementAt(artistId).Stage != artistsList.ElementAt(artistId - 1).Stage)
                    {
                        linearLayout.AddView(layoutCreator.CreateSimpleButton(this, Color.White, Color.SteelBlue, artistsList.ElementAt(artistId).Stage, null, true));
                    }
                }
                else
                {
                    linearLayout.AddView(layoutCreator.CreateSimpleButton(this, Color.White, Color.SteelBlue, artistsList.ElementAt(artistId).Stage, null, true));
                }

                var artistDetails = artistsList.ElementAt(artistId).Name + ": " +
                                    artistsList.ElementAt(artistId).SetStartTime.ToShortTimeString() + " - " +
                                    artistsList.ElementAt(artistId).SetEndTime.ToShortTimeString();

                linearLayout.AddView(layoutCreator.CreateSimpleButton(this, Color.White, Color.SteelBlue, artistDetails, 21, false));
            }

            scrollView.AddView(linearLayout);

            SetContentView(scrollView);
        }