Exemplo n.º 1
0
        protected async override void OnAppearing()
        {
            var fl = firstLoad;

            App.Locator.DeviceService.IsNeedAlertDialogToClose = true;

            base.OnAppearing();

            App.Locator.DeviceService.setStausBarLight();

            if (fl)
            {
                await Utils.CheckPermissions(Plugin.Permissions.Abstractions.Permission.Location);
                await LoadPackages();

                await App.Locator.Wallet.Load();

                await App.Locator.ProfileModel.Load();

                var res = await App.Locator.RouteServiceClient.AddEvent(Constants.EVENT_APP_START);

                App.Locator.EventService.StartUseEvent();
            }
            else
            {
                UpdatePackages();
                AddressBookHelper.LoadCallSigns();
            }

            App.Locator.DeviceService.setStausBarLight();


            ViewModel.CurrentDisplayPackageId = "";
        }
Exemplo n.º 2
0
        public AddressBookPage(bool isCouirierSelect)
        {
            InitializeComponent();

            IsCourierSelect = isCouirierSelect;

#if __IOS__
            if (App.Locator.DeviceService.IsIphoneX() == true)
            {
                TitleLabel.TranslationY = 35;
                BackButton.TranslationY = 10;
            }
            else
            {
                TitleLabel.TranslationY = 24;
            }
#elif __ANDROID__
            TitleLabel.TranslationY = 5;
            BackButton.TranslationY = -18;
            BackButton.TranslationX = -30;
#endif

            Items = AddressBookHelper.GetItems();

            ItemsListView.ItemsSource = Items;

            if (isCouirierSelect)
            {
                TitleLabel.Text = AppResources.SelectCourier;
            }
            else
            {
                TitleLabel.Text = AppResources.SelectRecipient;
            }

            if (Items.Count == 0)
            {
                PlacholderLabel.IsVisible = true;
            }
        }
Exemplo n.º 3
0
        public PackagesPage()
        {
            InitializeComponent();

            AddressBookHelper.LoadCallSigns();

            BindingContext = App.Locator.Packages;

            FilterPackage.Radius = 20;

            PakagesView.RefreshCommand = RefreshListCommand;



#if __ANDROID__
            HeaderView.Spacing = 42;
#else
            HeaderView.Spacing = 30;

            if (App.Locator.DeviceService.ScreenWidth() == 320)
            {
                PakagesView.TranslationY = 20;
            }
            else if (App.Locator.DeviceService.IsIphoneX())
            {
                HeaderView.Padding = new Thickness(0, 60, 0, 0);
            }
            else
            {
                PakagesView.TranslationY = 3;
            }
#endif
            // AvailableButton.TextColor = Color.LightGray;

            App.Locator.DeviceService.setStausBarLight();

            MessagingCenter.Subscribe <NewPackageDetailPage, string>(this, Constants.PACKAGE_ASSIGN, (sender, arg) =>
            {
                AllClicked(SegmentView, EventArgs.Empty);
                SegmentView.SelectIndex(0);
            });

            MessagingCenter.Subscribe <string, string>(Constants.NOTIFICATION, Constants.OPEN_MINE_PACKAGES, (sender, arg) =>
            {
                AllClicked(SegmentView, EventArgs.Empty);
                SegmentView.SelectIndex(0);
            });


            MessagingCenter.Subscribe <string, string>(Constants.NOTIFICATION, Constants.REFRESH_PACKAGES, async(sender, arg) =>
            {
                if (Mode == PackagesMode.All)
                {
                    AllClicked(SegmentView, EventArgs.Empty);
                    SegmentView.SelectIndex(0);
                    UpdatePackages();
                }
                else
                {
                    AllClicked(SegmentView, EventArgs.Empty);
                    SegmentView.SelectIndex(0);
                }
            });
        }
Exemplo n.º 4
0
        public LaunchPackagePage(Package package)
        {
            InitializeComponent();

            AddressBookHelper.LoadCallSigns();

            BindingContext = package;

            //set launcher phone
            var profile = App.Locator.ProfileModel;
            var number  = profile.StoredPhoneNumber;

            PhoneNumberUtil phoneUtil = PhoneNumberUtil.Instance;

            try
            {
                PhoneNumber numberProto = phoneUtil.Parse(number, "");
                package.LauncherPhoneCode   = "+" + Convert.ToString(numberProto.CountryCode);
                package.LauncherPhoneNumber = number.Replace(package.LauncherPhoneCode, "");
            }
            catch (NumberParseException)
            {
                package.LauncherPhoneNumber = number;
            }

#if __IOS__
            if (App.Locator.DeviceService.IsIphoneX() == true)
            {
                TitleLabel.TranslationY = 35;
                BackButton.TranslationY = 10;
            }
            else
            {
                TitleLabel.TranslationY = 24;
            }
#elif __ANDROID__
            TitleLabel.TranslationY = 5;
            BackButton.TranslationY = -18;
            BackButton.TranslationX = -30;
            EntryLauncherPhoneNumber.TranslationY  = 3;
            EntryRecipientPhoneNumber.TranslationY = 3;
#endif

            var selectMyCountryCommand = new Command(() =>
            {
                var picker          = new CountryPickerPage();
                picker.eventHandler = DidSelectMyCountryHandler;
                Navigation.PushAsync(picker, true);
            });

            var selectRecipientCountryCommand = new Command(() =>
            {
                var picker          = new CountryPickerPage();
                picker.eventHandler = DidSelectRecipientCountryHandler;
                Navigation.PushAsync(picker, true);
            });

            var selectFromLocation = new Command(() =>
            {
                GooglePlace place = null;

                if (ViewModel.FromLocationGPS != null)
                {
                    string location = ViewModel.FromLocationGPS;

                    place           = new GooglePlace();
                    place.Address   = ViewModel.FromLocationAddress;
                    place.Latitude  = Convert.ToDouble(location.Split(',')[0]);
                    place.Longitude = Convert.ToDouble(location.Split(',')[1]);
                }

                var picker          = new LocationPickerPage(LocationPickerType.From, place);
                picker.eventHandler = DidSelectLocationHandler;
                Navigation.PushAsync(picker, true);
            });

            var selectToLocation = new Command(() =>
            {
                GooglePlace place = null;

                if (ViewModel.ToLocationGPS != null)
                {
                    string location = ViewModel.ToLocationGPS;

                    place           = new GooglePlace();
                    place.Address   = ViewModel.ToLocationAddress;
                    place.Latitude  = Convert.ToDouble(location.Split(',')[0]);
                    place.Longitude = Convert.ToDouble(location.Split(',')[1]);
                }

                var picker          = new LocationPickerPage(LocationPickerType.To, place);
                picker.eventHandler = DidSelectLocationHandler;
                Navigation.PushAsync(picker, true);
            });

            var openFullScreeenPhotoCommand = new Command(() =>
            {
                OpenPhotoFullScreen();
            });
            XamEffects.Commands.SetTap(PhotoImage, openFullScreeenPhotoCommand);

            XamEffects.Commands.SetTap(LauncherCountryCodeLabel, selectMyCountryCommand);
            XamEffects.Commands.SetTap(RecipientCountryCodeLabel, selectRecipientCountryCommand);
            XamEffects.Commands.SetTap(FromLocationLabel, selectFromLocation);
            //  XamEffects.Commands.SetTap(FromLocationFrame, selectFromLocation);
            XamEffects.Commands.SetTap(FromLocationImage, selectFromLocation);
            XamEffects.Commands.SetTap(ToLocationLabel, selectToLocation);
            // XamEffects.Commands.SetTap(ToLocationFrame, selectToLocation);
            XamEffects.Commands.SetTap(ToLocationImage, selectToLocation);

            EntryRecepient.MakeCustomOffset();
        }