Exemple #1
0
        /// <summary>
        /// Get color from identifier
        /// </summary>
        /// <param name="strategyType"></param>
        /// <returns></returns>
        public static Color GetStatusColor(Identifiers.Strategies strategyType)
        {
            Color mColor;

            switch (strategyType)
            {
            case Identifiers.Strategies.Specific:
                mColor = Color.FromHex("C5C5C5");
                break;

            case Identifiers.Strategies.Relaxation:
                mColor = Color.FromHex("00A2D3");
                break;

            case Identifiers.Strategies.SleepHygiene:
                mColor = Color.FromHex("E74C3C");
                break;

            default:
                mColor = Color.FromHex("E3E3E3");
                break;
            }

            return(mColor);
        }
        public CardCheckTemplate(string title, string instructions, Identifiers.Strategies strategyType)
        {
            grid = new Grid
            {
                Padding         = new Thickness(0, 1, 1, 1),
                RowSpacing      = 1,
                ColumnSpacing   = 1,
                BackgroundColor = Color.White,
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions  =
                {
                    new RowDefinition {
                        Height = new GridLength(70, GridUnitType.Auto)
                    },
                    new RowDefinition {
                        Height = new GridLength(30, GridUnitType.Absolute)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(4, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(70, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(100, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(100, GridUnitType.Absolute)
                    }
                }
            };

            grid.Children.Add(new CardStatusView(strategyType), 0, 1, 0, 2);

            grid.Children.Add(new Switch
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                BackgroundColor   = Color.White
            }, 4, 5, 0, 1);

            grid.Children.Add(new CardDetailsView(title, instructions)
            {
                Margin = new Thickness(0, 5, 0, 5)
            }, 1, 4, 0, 1);

            grid.Children.Add(new CardButtonView("Please check the box if completed."), 1, 5, 1, 2);

            grid.Margin = new Thickness(0, 0, 0, 10);

            Content = grid;
        }
Exemple #3
0
 public CardStatusView(Identifiers.Strategies strategyType)
 {
     Content = new BoxView
     {
         VerticalOptions   = LayoutOptions.Fill,
         HorizontalOptions = LayoutOptions.Fill,
         BackgroundColor   = GetStatusColor(strategyType)
     };
 }