public FeedbackPage()
            : base(typeof(FeedbackViewModel), typeof(FeedbackContentUI))
        {
            BackgroundColor         = MainStyles.StatusBarColor.FromResources <Color>();
            Content.BackgroundColor = MainStyles.MainBackgroundColor.FromResources <Color>();

            var loadingColor = MainStyles.LoadingColor.FromResources <Color>();

            LoadingActivityIndicator.Color = loadingColor;
            LoadingActivityText.TextColor  = loadingColor;

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor   = MainStyles.StatusBarColor.FromResources <Color>(),
                TitleStyle = LabelStyles.PageTitleStyle.FromResources <Style>(),
                BtnBack    =
                {
                    Source = contentUI.IconBack
                }
            };

            appBar.SetBinding(TitleBar.TitleProperty, "Title");

            var txtNameTitle = new Label
            {
                Style = LabelStyles.FeedbackLabelStyle.FromResources <Style>(),
                Text  = contentUI.TxtName
            };

            _txtName = new Entry
            {
                Style     = LabelStyles.FeedbackEntryStyle.FromResources <Style>(),
                MaxLength = 30
            };
            _txtName.SetBinding(Entry.TextProperty, "Name");
            _txtName.SetBinding(IsEnabledProperty, "IsNotLoading");

            var txtCommentTitle = new Label
            {
                Style = LabelStyles.FeedbackLabelStyle.FromResources <Style>(),
                Text  = contentUI.TxtComment
            };

            _txtComment = new Editor
            {
                Style           = LabelStyles.FeedbackEditorStyle.FromResources <Style>(),
                VerticalOptions = LayoutOptions.FillAndExpand,
                MaxLength       = 1000
            };
            _txtComment.SetBinding(Editor.TextProperty, "Comment");
            _txtComment.SetBinding(IsEnabledProperty, "IsNotLoading");

            var btnSubmit = new ButtonExtended
            {
                Style             = LabelStyles.ButtonStyle.FromResources <Style>(),
                Text              = contentUI.TxtSubmit.ToUpper(),
                HorizontalOptions = LayoutOptions.Center,
                WidthRequest      = 150
            };

            btnSubmit.SetBinding(IsEnabledProperty, "IsValidFeedback");
            btnSubmit.SetBinding(IsVisibleProperty, "IsNotLoading");
            btnSubmit.Clicked += viewModel.BtnSubmit_Clicked;

            var activityIndicator = new ActivityIndicator
            {
                Color             = loadingColor,
                HorizontalOptions = LayoutOptions.Center
            };

            activityIndicator.SetBinding(IsVisibleProperty, "IsSubmitting");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsSubmitting");

            _layoutFeedback = new KeyboardView
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Star
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                }
            };

            _layoutFeedback.Children.Add(txtNameTitle, 0, 0);
            _layoutFeedback.Children.Add(_txtName, 0, 1);
            _layoutFeedback.Children.Add(txtCommentTitle, 0, 2);
            _layoutFeedback.Children.Add(_txtComment, 0, 3);
            _layoutFeedback.Children.Add(btnSubmit, 0, 4);
            _layoutFeedback.Children.Add(activityIndicator, 0, 5);

            var layoutContainer = new ContentView
            {
                Padding         = 24,
                Content         = _layoutFeedback,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            var safeAreaHelper = new SafeAreaHelper();

            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.Top);
            safeAreaHelper.UseSafeArea(appBar.BtnBack, SafeAreaHelper.CustomSafeAreaFlags.Left);
            safeAreaHelper.UseSafeArea(layoutContainer, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);

            ContentLayout.Children.Add(appBar);
            ContentLayout.Children.Add(layoutContainer);
        }
        public SplashPage()
            : base(typeof(SplashViewModel), typeof(SplashContentUI))
        {
            NavigationPage.SetHasNavigationBar(this, false);

            BackgroundColor = MainStyles.MainBackgroundColor.FromResources <Color>();

            var layoutSplash = new AbsoluteLayout
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            var boxBackOpacity = new BoxView
            {
                Color = MainStyles.MainBackgroundColor.FromResources <Color>()
            };

            AbsoluteLayout.SetLayoutFlags(boxBackOpacity, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(boxBackOpacity, new Rectangle(0f, 0f, 1f, 1f));
            layoutSplash.Children.Add(boxBackOpacity);

            var imgLogo = new Image
            {
                Source = contentUI.ImgLogo
            };

            AbsoluteLayout.SetLayoutFlags(imgLogo, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(imgLogo,
                                           new Rectangle(0.5, 0.4, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            layoutSplash.Children.Add(imgLogo);

            var activityIndicator = new ActivityIndicator
            {
                Color = Color.White
            };

            activityIndicator.SetBinding(IsVisibleProperty, "IsShowLoading");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsShowLoading");
            AbsoluteLayout.SetLayoutFlags(activityIndicator, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(activityIndicator,
                                           new Rectangle(0.5, 0.8, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            layoutSplash.Children.Add(activityIndicator);

            var btnRetry = new ButtonExtended
            {
                Style   = LabelStyles.ButtonStyle.FromResources <Style>(),
                Command = viewModel.RetryCommand,
                Text    = contentUI.BtnTxtRetry.ToUpper()
            };

            btnRetry.SetBinding(IsVisibleProperty, "IsRetry");
            AbsoluteLayout.SetLayoutFlags(btnRetry,
                                          AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional);
            AbsoluteLayout.SetLayoutBounds(btnRetry, new Rectangle(0.5, 0.7, 0.5f, AbsoluteLayout.AutoSize));
            layoutSplash.Children.Add(btnRetry);

            var btnSkip = new ButtonExtended
            {
                Style   = LabelStyles.ButtonStyle.FromResources <Style>(),
                Command = viewModel.SkipCommand,
                Text    = contentUI.BtnTxtSkip.ToUpper()
            };

            btnSkip.SetBinding(IsVisibleProperty, "IsRetry");
            AbsoluteLayout.SetLayoutFlags(btnSkip,
                                          AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional);
            AbsoluteLayout.SetLayoutBounds(btnSkip, new Rectangle(0.5, 0.8, 0.5f, AbsoluteLayout.AutoSize));
            layoutSplash.Children.Add(btnSkip);

            var txtProgress = new Label
            {
                Style                   = LabelStyles.DescriptionStyle.FromResources <Style>(),
                LineBreakMode           = LineBreakMode.WordWrap,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor               = Color.White
            };

            txtProgress.SetBinding(Label.TextProperty, "ProcessMessage");
            AbsoluteLayout.SetLayoutFlags(txtProgress,
                                          AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional);
            AbsoluteLayout.SetLayoutBounds(txtProgress, new Rectangle(0f, 0.9, 1f, AbsoluteLayout.AutoSize));
            layoutSplash.Children.Add(txtProgress);

            ContentLayout.Children.Add(layoutSplash);
        }
Exemple #3
0
        public SettingsPage()
            : base(typeof(SettingsViewModel), typeof(SettingsContentUI))
        {
            BackgroundColor         = MainStyles.StatusBarColor.FromResources <Color>();
            Content.BackgroundColor = MainStyles.MainBackgroundColor.FromResources <Color>();

            var loadingColor = MainStyles.LoadingColor.FromResources <Color>();

            LoadingActivityIndicator.Color = loadingColor;
            LoadingActivityText.TextColor  = loadingColor;

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor   = MainStyles.StatusBarColor.FromResources <Color>(),
                TitleStyle = LabelStyles.PageTitleStyle.FromResources <Style>(),
                BtnBack    =
                {
                    Source = contentUI.IconBack
                }
            };

            appBar.SetBinding(TitleBar.TitleProperty, "Title");

            #region Language setting

            var txtLangTitle = new Label
            {
                Style = LabelStyles.SettingStyle.FromResources <Style>()
            };
            txtLangTitle.SetBinding(Label.TextProperty, "CurrentLanguageTitle");

            var txtLangValue = new Label
            {
                Style = LabelStyles.SettingHintStyle.FromResources <Style>()
            };
            txtLangValue.SetBinding(Label.TextProperty, "CurrLanguageName");

            var stackLang = new StackLayout
            {
                Children =
                {
                    txtLangTitle,
                    txtLangValue
                }
            };

            var tapLang = new TapGestureRecognizer();
            tapLang.Tapped += viewModel.LangSetting_Click;
            stackLang.GestureRecognizers.Add(tapLang);

            #endregion

            #region Push notifications setting

            var txtPushNotifications = new Label
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                Style             = LabelStyles.SettingStyle.FromResources <Style>()
            };
            txtPushNotifications.SetBinding(Label.TextProperty, "PushNotificationsTitle");

            var switchPushNotifications = new Switch
            {
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Center,
                OnColor           = MainStyles.SwitchColor.FromResources <Color>()
            };
            switchPushNotifications.SetBinding(Switch.IsToggledProperty, "IsPushEnabled");

            var stackPushNotifications = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Spacing           = 0,
                Children          =
                {
                    txtPushNotifications,
                    switchPushNotifications
                }
            };

            var tapPushNotifications = new TapGestureRecognizer();
            tapPushNotifications.Tapped += viewModel.SwitchPushNotifications_Toggled;
            stackPushNotifications.GestureRecognizers.Add(tapPushNotifications);

            #endregion

            var btnUpdateDb = new ButtonExtended
            {
                Style = LabelStyles.ButtonStyle.FromResources <Style>()
            };
            btnUpdateDb.SetBinding(Button.TextProperty, "UpdateDbTitle");
            btnUpdateDb.SetBinding(IsEnabledProperty, "IsNotLoading");
            btnUpdateDb.Clicked += viewModel.BtnUpdateDb_Clicked;

            var activityIndicator = new ActivityIndicator
            {
                Color             = loadingColor,
                HorizontalOptions = LayoutOptions.Center
            };
            activityIndicator.SetBinding(IsVisibleProperty, "IsUpdating");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsUpdating");

            var txtProgress = new Label
            {
                Style = LabelStyles.DescriptionLightStyle.FromResources <Style>(),
                HorizontalTextAlignment = TextAlignment.Center
            };
            txtProgress.SetBinding(Label.TextProperty, "ProcessMessage");

            var layoutSettings = new StackLayout
            {
                Spacing  = 20,
                Padding  = 24,
                Children =
                {
                    stackLang,
                    stackPushNotifications,
                    btnUpdateDb,
                    activityIndicator,
                    txtProgress
                }
            };

            var safeAreaHelper = new SafeAreaHelper();
            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.Top);
            safeAreaHelper.UseSafeArea(appBar.BtnBack, SafeAreaHelper.CustomSafeAreaFlags.Left);
            safeAreaHelper.UseSafeArea(layoutSettings, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);

            ContentLayout.Children.Add(appBar);
            ContentLayout.Children.Add(layoutSettings);
        }
        public SettingsPage()
            : base(typeof(SettingsViewModel), typeof(SettingsContentUI))
        {
            BackgroundColor         = MainStyles.StatusBarColor.FromResources <Color>();
            Content.BackgroundColor = MainStyles.MainBackgroundColor.FromResources <Color>();

            var appBar = new TitleBar(this, TitleBar.BarBtnEnum.bbBack)
            {
                BarColor   = MainStyles.StatusBarColor.FromResources <Color>(),
                TitleStyle = LabelStyles.PageTitleStyle.FromResources <Style>(),
                BtnBack    =
                {
                    Source = contentUI.IconBack
                }
            };

            appBar.SetBinding(TitleBar.TitleProperty, "Title");

            #region Language setting

            var txtLangTitle = new Label
            {
                Style = LabelStyles.SettingStyle.FromResources <Style>()
            };
            txtLangTitle.SetBinding(Label.TextProperty, "CurrentLanguageTitle");

            var txtLangValue = new Label
            {
                Style = LabelStyles.SettingHintStyle.FromResources <Style>()
            };
            txtLangValue.SetBinding(Label.TextProperty, "CurrLanguageName");

            var stackLang = new StackLayout
            {
                Children =
                {
                    txtLangTitle,
                    txtLangValue
                }
            };

            var tapGestureRecognizer = new TapGestureRecognizer();
            tapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "TypeName");
            tapGestureRecognizer.Tapped += viewModel.LangSetting_Click;
            stackLang.GestureRecognizers.Add(tapGestureRecognizer);

            #endregion

            var btnUpdateDb = new ButtonExtended
            {
                Style = LabelStyles.ButtonStyle.FromResources <Style>()
            };
            btnUpdateDb.SetBinding(Button.TextProperty, "UpdateDbTitle");
            btnUpdateDb.SetBinding(IsEnabledProperty, "IsNotLoading");
            btnUpdateDb.Clicked += viewModel.BtnUpdateDb_Clicked;

            var activityIndicator = new ActivityIndicator
            {
                Color             = Color.White,
                HorizontalOptions = LayoutOptions.Center
            };
            activityIndicator.SetBinding(IsVisibleProperty, "IsLoading");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsLoading");

            var txtProgress = new Label
            {
                Style                   = LabelStyles.DescriptionStyle.FromResources <Style>(),
                LineBreakMode           = LineBreakMode.WordWrap,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor               = Color.White
            };
            txtProgress.SetBinding(Label.TextProperty, "ProcessMessage");

            var layoutSettings = new StackLayout
            {
                Spacing  = 20,
                Padding  = 24,
                Children =
                {
                    stackLang,
                    btnUpdateDb,
                    activityIndicator,
                    txtProgress
                }
            };

            var safeAreaHelper = new SafeAreaHelper();
            safeAreaHelper.UseSafeArea(this, SafeAreaHelper.CustomSafeAreaFlags.Top);
            safeAreaHelper.UseSafeArea(appBar.BtnBack, SafeAreaHelper.CustomSafeAreaFlags.Left);
            safeAreaHelper.UseSafeArea(layoutSettings, SafeAreaHelper.CustomSafeAreaFlags.Horizontal);

            ContentLayout.Children.Add(appBar);
            ContentLayout.Children.Add(layoutSettings);
        }