Ejemplo n.º 1
0
        public TimeBlock CreateTimeBlock()
        {
            ResetScreenShotTimer();
            if (currentTimeBlock != null)
            {
                PreviousTimeBlock = currentTimeBlock;
            }

            TimeBlock timeblock = new TimeBlock();

            timeblock.Start = DateTime.Today;
            TimeBlocks.Add(timeblock);
            currentTimeBlock = timeblock;
            timeblock.Work   = this;
            timeblock.Subcon = this.Subcon;

            Random r    = new Random();
            int    rInt = r.Next(0, timeBlockLength * 60); //for ints

            timeblock.ScreenShotCapturedSecond = rInt;
            return(timeblock);
        }
        /// <summary>
        /// Creates one clock to be displayed in the top section
        /// </summary>
        /// <param name="timezone"></param>
        /// <returns></returns>
        protected UIElement CreateOneClock(string timezone)
        {
            if (!ViewModel.TimezonesAvailable.ContainsKey(timezone))
            {
                return(null);
            }

            Grid Ret = new Grid()
            {
                Width = 180, Height = 88, Margin = new Thickness(5, 5, 0, 0), Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#EEEEEE"))
            };

            Ret.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24)
            });
            Ret.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Star)
            });
            Ret.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(24)
            });

            #region Row 0
            TextBlock TmpText = new TextBlock()
            {
                Text = timezone, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 5, 0, 0)
            };
            Viewbox VB = new Viewbox()
            {
                Margin = new Thickness(2)
            };
            VB.SetValue(Grid.RowProperty, 0);
            VB.Child = TmpText;
            Ret.Children.Add(VB);
            #endregion

            #region Row 1
            TmpText = new TextBlock()
            {
                Text = "", FontFamily = new FontFamily(new Uri("pack://application:,,,/"), "Resources/Fonts/#Orbitron"), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Tag = timezone
            };
            VB = new Viewbox();
            VB.SetValue(Grid.RowProperty, 1);
            VB.Child = TmpText;
            Ret.Children.Add(VB);
            TimeBlocks.Add(TmpText);
            #endregion

            #region Row 2
            TmpText = new TextBlock()
            {
                Text = "", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 0, 5), Tag = timezone
            };
            TmpText.SetValue(Grid.RowProperty, 2);
            Ret.Children.Add(TmpText);
            DateBlocks.Add(TmpText);
            #endregion

            return(Ret);
        }