Esempio n. 1
0
        private async void MakeBooking()
        {
            using (LoadingManager.CreateLoadingScope())
            {
                var user = await _authenticationService.GetProfileAsync();

                var carBooking = new CarBooking()
                {
                    BookerName       = user.Name,
                    BookerId         = user.UserId,
                    BookingStartDate = bookingDate,
                    BookingEndDate   = bookingDate.AddDays(1),
                };

                var didMakeBooking = await _bookingApi.MakingBookingAsync(carBooking);

                if (didMakeBooking)
                {
                    _toastService.ShortAlert("Booking as been made");
                    ScheduleReminder();
                    _navigationService.GoBack();
                }
                else
                {
                    _toastService.ShortAlert("Failed to make the booking");
                }
            }
        }
Esempio n. 2
0
        private void run_script(object sender, System.EventArgs e)
        {
            var imgBut = sender as ImageButton;

            var stack = imgBut.Parent;
            var grid  = stack?.Parent;

            var label = grid?.FindByName <Label>("ScripeName");

            var luaLb = stack?.FindByName <Label>("LPath");

            if (label == null)
            {
                toastService.ShortAlert("发生未知错误");
                return;
            }

            if (luaLb == null)
            {
                toastService.ShortAlert("发生未知错误100");
                return;
            }

            if (string.IsNullOrWhiteSpace(luaLb.Text))
            {
                toastService.ShortAlert("脚本不存在");
                return;
            }

            LogEventDelegates.Instance.OnLog(new LogEventArgs("运行", $"运行 {label.Text ?? string.Empty} 脚本", Color.Blue));


            var obj = luaScriptService.RunFile(luaLb.Text);
        }
Esempio n. 3
0
        /// <summary>
        /// 弹出菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void PopupMenu(object sender, EventArgs e)
        {
            var fileName = await DisplayPromptAsync("名称", null, "确定", "取消");

            if (string.IsNullOrWhiteSpace(fileName))
            {
                return;
            }


            var file = $"{_fileService.GetPath()}/{fileName}.lua";

            if (File.Exists(file))
            {
                _toastService.ShortAlert("文件已存在");
                return;
            }

            File.Create(file);

            //刷新目录
            UpdateScript();
        }
        private async void CancelBooking()
        {
            var didAccept = await _dialogService.ShowMessageAsync("Warning!", "Do you want to cancel your booking?", "cancel", "cancel booking");

            if (didAccept)
            {
                using (LoadingManager.CreateLoadingScope())
                {
                    var user = await _authenticationService.GetProfileAsync();

                    var didRemove = await _bookingApi.RemoveBookingAsync(booking.ID);

                    if (didRemove)
                    {
                        _toastService.ShortAlert("Booking as been cancelled");
                        _navigationService.GoBack();
                    }
                    else
                    {
                        _toastService.ShortAlert("Failed to cancel the booking");
                    }
                }
            }
        }
Esempio n. 5
0
        protected override bool OnBackButtonPressed()
        {
            var result = DateTime.Now - backTimeOut;

            if (result.TotalMilliseconds < 2000)
            {
                return(base.OnBackButtonPressed());
            }
            else
            {
                backTimeOut = DateTime.Now;
                toastService.ShortAlert("双击退出 AutoLua");
            }

            return(true);
        }
Esempio n. 6
0
        /// <summary>
        /// 弹出菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void PopupMenu(object sender, EventArgs e)
        {
            var fileName = await DisplayPromptAsync("名称", null, "确定", "取消");

            if (string.IsNullOrWhiteSpace(fileName))
            {
                return;
            }

            var file = $"{dirService.GetPath()}/{fileName}/";

            if (Directory.Exists(file))
            {
                toastService.ShortAlert("项目已存在");
                return;
            }

            Directory.CreateDirectory(file);

            UpdateScript();
        }
Esempio n. 7
0
        private void Build()
        {
            var app = App.Current;

            Content = new AbsoluteLayout
            {
                Children =
                {
                    new Grid
                    {
                        Padding = new Thickness(10, 50, 10, 10),

                        RowDefinitions = Rows.Define(
                            (Row.Image, 128),
                            (Row.Description, Star),
                            (Row.Contact, 40),
                            (Row.Stores, 48)),

                        ColumnDefinitions = Columns.Define(
                            (Col.PlayStore, Star),
                            (Col.AppStore, Star)),

                        Children =
                        {
                            new Frame
                            {
                                Padding = 0, CornerRadius = 6, BackgroundColor = Colors.Divider,

                                Content = new Image{
                                    Source = "imgAuthor.jpg"
                                },
                            }.Center()
                            .Row(Row.Image).ColSpan(2),

                            new ScrollView
                            {
                                Content = new Label
                                {
                                    Text     = "Olá!\r\n\r\nEu me chamo Raelson. Sou Engenheiro Civil de formação e desenvolvedor de aplicativos (mobile ou desktop). Entrei no mercado do desenvolvimento 6 anos atrás, começando com projetos voltados para a engenharia. Hoje, atuo em qualquer mercado. Já criei CADs para desktop, trabalhei com sistemas administrativos, rastreadores GPS e outros ramos que a engenharia e o mercado comumente pedem. Caso tenha algum projeto em mente, só entrar em contato através do meu e-mail com orçamento, ideias e prazos. Tenho horários bastante flexíveis e pego todo tipo de projeto mobile.\r\n\r\nHoje sou Engenheiro sem Fronteiras e desenvolvedor freelancer.",
                                    FontSize = 12, TextColor = Colors.PrimaryText, Margin = new Thickness(20, 0, 20, 0), LineBreakMode = LineBreakMode.WordWrap
                                }
                                .LeftExpand(),
                            }.Row(Row.Description).ColSpan(2),

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

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

                                    Children =
                                    {
                                        new Image  {
                                            Source = Images.Email
                                        }.Center(),
                                        new Label  {
                                            Text = "*****@*****.**"
                                        }.LeftExpand().CenterV(),
                                        new Button {
                                            BackgroundColor = Colors.TextIcons, ImageSource = Images.Copy,
                                        }.Size(40)
                                        .Invoke(c => c.Clicked += (s, e) =>
                                        {
                                            Clipboard.SetTextAsync("*****@*****.**");
                                            toastService.ShortAlert("E-mail copiado! Cole onde precisar");
                                        }),
                                    },
                                },
                            }.Row(Row.Contact).ColSpan(2),

                            new Button             {
                                Text = "Play Store", ImageSource = Images.PlayStore
                            }
                            .Row(Row.Stores).Col(Col.PlayStore)
                            .Invoke(c => c.Clicked += async(s, e) =>
                            {
                                await Launcher.OpenAsync($"https://play.google.com/store/apps/developer?id=Raelson+Craftz");
                            }),

                            new Button             {
                                Text = "App Store", ImageSource = Images.AppStore, IsEnabled = false,
                            }
                            .Row(Row.Stores).Col(Col.AppStore),
                        },
                    }.Invoke(c =>
Esempio n. 8
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(),