Example #1
0
        private void Build()
        {
            Content = new Frame
            {
                Content = new StackLayout
                {
                    // Dialog Content
                    Children =
                    {
                        new Image {
                            Source = Images.Minute
                        }.Center(),

                        new Frame {
                        }.FramedCustomEntry(out minuteNameEntry, Images.MinuteBlack)
                        .Invoke(c =>
                        {
                            minuteNameEntry.Placeholder = "Nome da Ata";
                            minuteNameEntry.Bind(CustomEntry.SaveCommandProperty, nameof(MinuteViewModel.RenameMinute));
                            minuteNameEntry.Bind(CustomEntry.TextProperty, nameof(MinuteViewModel.MinuteName));
                            minuteNameEntry.Bind(CustomEntry.IsSavingProperty, nameof(MinuteViewModel.IsSavingMinuteName), BindingMode.OneWayToSource);
                        }),
                    }
                }
            }.Standard().CenterExpandV();
        }
Example #2
0
        private void Build()
        {
            var app = App.Current;
            var vm  = ViewModel = App.Current.settingsViewModel;

            Title = "Configurações";

            // Main settings
            Children.Add(new BasePage
            {
                Title           = "Geral",
                IconImageSource = Images.Organization,

                Content = new ScrollView
                {
                    Content = new StackLayout
                    {
                        Padding = new Thickness(0, 5, 0, 0),
                        Spacing = 10,

                        Children =
                        {
                            new Frame
                            {
                                Content = new Frame{
                                }.FramedCustomEntry(out userEntry, Images.PersonBlack)
                                .Invoke(c =>
                                {
                                    userEntry.Placeholder = "Usuário";
                                    userEntry.Bind(CustomEntry.SaveCommandProperty, nameof(vm.SaveUser));
                                    userEntry.Bind(CustomEntry.TextProperty, nameof(vm.User));
                                    userEntry.Bind(CustomEntry.IsSavingEnabledProperty, nameof(vm.IsSavingEnabled));
                                }),
                            }.Standard(),

                            new Frame
                            {
                                Content = new Frame{
                                }.FramedCustomEntry(out organizationEntry, Images.OrganizationBlack)
                                .Invoke(c =>
                                {
                                    organizationEntry.Placeholder = "Organização";
                                    organizationEntry.Bind(CustomEntry.SaveCommandProperty, nameof(vm.SaveOrganization));
                                    organizationEntry.Bind(CustomEntry.TextProperty, nameof(vm.Organization));
                                    organizationEntry.Bind(CustomEntry.IsSavingEnabledProperty, nameof(vm.IsSavingEnabled));
                                }),
                            }.Standard(),

                            new Frame     {
                            }.FramedHorizontalLabelInput(Images.FontSize, "Tamanho", nameof(vm.FontSize), nameof(vm.ChangeFontSize)),

                            new Frame     {
                            }.FramedPicker(Images.FontSize, "Fonte", nameof(vm.FontFamily), nameof(vm.ChangeFontFamily), vm.FontList),

                            new AdMobView {
                                AdUnitId = Constants.AdOrganizacao, HeightRequest = 50
                            }.BottomExpand(),
                        }
                    }
                },
            });

            Children.Add(new BasePage
            {
                Title           = "Margem",
                IconImageSource = Images.Margin,

                Content = new Grid
                {
                    RowSpacing    = 0,
                    ColumnSpacing = 0,

                    RowDefinitions = Rows.Define(
                        (0, Star),
                        (1, Star),
                        (2, Star),
                        (3, 50)),

                    ColumnDefinitions = Columns.Define(
                        (0, Star),
                        (1, Star),
                        (2, Star)),

                    Children =
                    {
                        new Frame     {
                        }.FramedVerticalEntryInput(out topEntry, Images.MarginTop, nameof(vm.ChangeMarginTop)).Center()
                        .Row(0).Col(1)
                        .Invoke(c =>
                        {
                            topEntry.Placeholder = "0,00";
                            topEntry.Bind(CustomEntry.TextProperty, nameof(vm.MarginTop));
                            topEntry.Bind(CustomEntry.IsSavingEnabledProperty, nameof(vm.IsSavingEnabled));
                        }),

                        new Frame     {
                        }.FramedVerticalEntryInput(out leftEntry, Images.MarginLeft, nameof(vm.ChangeMarginLeft)).Center()
                        .Row(1).Col(0)
                        .Invoke(c =>
                        {
                            leftEntry.Placeholder = "0,00";
                            leftEntry.Bind(CustomEntry.TextProperty, nameof(vm.MarginLeft));
                            leftEntry.Bind(CustomEntry.IsSavingEnabledProperty, nameof(vm.IsSavingEnabled));
                        }),

                        new Frame     {
                        }.FramedVerticalEntryInput(out rightEntry, Images.MarginRight, nameof(vm.ChangeMarginRight)).Center()
                        .Row(1).Col(2)
                        .Invoke(c =>
                        {
                            rightEntry.Placeholder = "0,00";
                            rightEntry.Bind(CustomEntry.TextProperty, nameof(vm.MarginRight));
                            rightEntry.Bind(CustomEntry.IsSavingEnabledProperty, nameof(vm.IsSavingEnabled));
                        }),

                        new Frame     {
                        }.FramedVerticalEntryInput(out bottomEntry, Images.MarginBottom, nameof(vm.ChangeMarginBottom)).Center()
                        .Row(2).Col(1)
                        .Invoke(c =>
                        {
                            bottomEntry.Placeholder = "0,00";
                            bottomEntry.Bind(CustomEntry.TextProperty, nameof(vm.MarginBottom));
                            bottomEntry.Bind(CustomEntry.IsSavingEnabledProperty, nameof(vm.IsSavingEnabled));
                        }),

                        new AdMobView {
                            AdUnitId = Constants.AdMargem
                        }
                        .Row(3).ColSpan(3),
                    },
                }
            });
Example #3
0
        private void Build()
        {
            Shell.SetFlyoutBehavior(this, FlyoutBehavior.Disabled);

            Shell.SetBackButtonBehavior(this, new BackButtonBehavior
            {
                Command = new Command(async() =>
                {
                    if (ViewModel.IsSaving)
                    {
                        toastService.ShortAlert("Aguarde a operação de salvar!");
                    }
                    else
                    {
                        await Shell.Current.Navigation.PopAsync(true);
                    }
                }),
            });

            Title = "Ata";

            var app = App.Current;
            var vm  = ViewModel = app.minuteViewModel;

            Content = new AbsoluteLayout
            {
                Children =
                {
                    // Page Content
                    new Grid
                    {
                        RowDefinitions = Rows.Define(
                            (Row.Minute, Star),
                            (Row.Banner, 50)),

                        ColumnDefinitions = Columns.Define(
                            (Col.TopicList, 70),
                            (Col.Information, Star)),

                        Children =
                        {
                            // Topic Collection
                            new CollectionView
                            {
                                BackgroundColor = Colors.Primary,

                                GestureRecognizers =
                                {
                                    new TapGestureRecognizer   {
                                    }.Invoke(c => c.Tapped += (s, e) =>
                                    {
                                        topicEntry.Unfocus();
                                    }),
                                },

                                // BODY - List of topics
                                ItemTemplate = TopicTemplate.New(vm),

                                // FOOTER - Action
                                Footer = new ContentView
                                {
                                    Padding = 5,

                                    Content = new Button       {
                                        ImageSource = Images.Add
                                    }.Standard().Round(40).Center()
                                    .Bind(nameof(vm.CreateTopic)),
                                },
                            }.VerticalListStyle().SingleSelection()
                            .Row(Row.Minute).Col(Col.TopicList)
                            .Bind(CollectionView.ItemsSourceProperty, nameof(vm.Topics))
                            .Bind(CollectionView.SelectionChangedCommandProperty, nameof(vm.SelectTopic), source: vm)
                            .Invoke(c =>
                            {
                                c.Bind(CollectionView.SelectionChangedCommandParameterProperty, nameof(CollectionView.SelectedItem), source: c);
                            }),

                            // Information Collection
                            new CollectionView
                            {
                                // BODY - List of information
                                ItemTemplate = InformationTemplate.New(vm),
                                Behaviors    =
                                {
                                    new FadingBehavior         {
                                    }
                                    .BindBehavior(FadingBehavior.IsActiveProperty, nameof(vm.SelectedTopic), converter: new NullToBool()),
                                },

                                // HEADER - Topic title with a button to delete the topic
                                Header = new ContentView
                                {
                                    Padding = 5,

                                    Content = new Frame
                                    {
                                        Padding = 5, CornerRadius = 6, BackgroundColor = Colors.Accent,

                                        Behaviors =
                                        {
                                            new MovingBehavior {
                                                MoveTo = EMoveTo.Top
                                            }
                                            .BindBehavior(MovingBehavior.IsActiveProperty, nameof(vm.SelectedTopic), converter: new NullToBool())
                                        },

                                        Content = new StackLayout
                                        {
                                            Spacing = 10, Orientation = StackOrientation.Horizontal,

                                            Children =
                                            {
                                                new Frame      {
                                                }.FramedCustomEntry(out topicEntry, Images.TextBlack).FillExpandH()
                                                .Invoke(c =>
                                                {
                                                    topicEntry.Placeholder = "Nome do tópico";
                                                    topicEntry.Bind(CustomEntry.TextProperty, $"{nameof(vm.SelectedTopic)}.{nameof(vm.SelectedTopic.Text)}");
                                                    topicEntry.Bind(CustomEntry.SaveCommandProperty, nameof(vm.SaveTopicTitle));
                                                    topicEntry.Bind(CustomEntry.IsSavingProperty, nameof(vm.IsSavingTopic), BindingMode.OneWayToSource);
                                                    topicEntry.Bind(CustomEntry.IsSavingEnabledProperty, nameof(vm.IsSavingEnabled));
                                                }),

                                                new Button     {
                                                    ImageSource = Images.Delete
                                                }.Standard().Danger().Round(40).Center()
                                                .Bind(nameof(vm.DeleteTopic)),
                                            },
                                        }
                                    }.Padding(5).SetTranslationY(-100),
                                },

                                // FOOTER - Actions
                                Footer = new ContentView
                                {
                                    Padding = 5,

                                    Content = new Button
                                    {
                                        ImageSource = Images.Add,

                                        Behaviors =
                                        {
                                            new FadingBehavior {
                                            }
                                            .BindBehavior(FadingBehavior.IsActiveProperty, nameof(vm.SelectedTopic), converter: new NullToBool()),
                                            new MovingBehavior {
                                                MoveTo = EMoveTo.End
                                            }
                                            .BindBehavior(MovingBehavior.IsActiveProperty, nameof(vm.SelectedTopic), converter: new NullToBool()),
                                        },
                                    }.Standard().Round(40).SetTranslationX(50).Right()
                                    .Bind(nameof(vm.CreateInformation)),
                                }
                            }.VerticalListStyle().SingleSelection().FillExpandV()
                            .Row(Row.Minute).Col(Col.Information)
                            .Bind(CollectionView.ItemsSourceProperty, nameof(vm.Information)),

                            new AdMobView                      {
                                AdUnitId = Constants.AdMinute
                            }
                            .Row(Row.Banner).ColSpan(2),
                        }
                    }.Standard(),