예제 #1
0
        public void ClickBoton(object sender, EventArgs args)
        {
            IDeviceOrientationService orientationService = DependencyService.Get <IDeviceOrientationService>();

            Interfaces.DeviceOrientation orientation = orientationService.GetOrientation();
            lblOrientacion.Text = orientation.ToString();
        }
예제 #2
0
 public static IObservable <DeviceOrientations> ObserveDeviceIsInLandscape(this IDeviceOrientationService service)
 {
     return(Observable.FromEventPattern <EventHandler <DeviceOrientationChangedEventArgs>, DeviceOrientationChangedEventArgs>(
                handler => service.NotifyOrientationChanged += handler,
                handler => service.NotifyOrientationChanged -= handler
                )
            .Select(args => args.EventArgs.DeviceOrientation)
            .Where(deviceOrientation => deviceOrientation == DeviceOrientations.Left || deviceOrientation == DeviceOrientations.Right));
 }
예제 #3
0
        public BaseViewModel(INavigationService navigationService, IPageDialogService dialogService, IUserServices userServices, IDeviceOrientationService deviceOrientationService, IDependencyService dependencyService)
        {
            DeviceOrientation orientation = deviceOrientationService.GetOrientation();

            this.navigationService        = navigationService;
            this.dialogService            = dialogService;
            this.userServices             = userServices;
            this.deviceOrientationService = deviceOrientationService;
        }
예제 #4
0
 public OrientationViewModel()
 {
     ChangeOrientation = new Command(async() =>
     {
         IDeviceOrientationService service = DependencyService.Get <IDeviceOrientationService>();
         DeviceOrientation orientation     = service.GetOrientation();
         Result = orientation.ToString();
     });
 }
예제 #5
0
        public DeviceViewModelPage()
        {
            GetDeviceCommand = new Command(() =>
            {
                IDeviceOrientationService service = DependencyService.Get <IDeviceOrientationService>();
                DeviceOrientation orientation     = service.GetOrientation();

                ShowData = orientation.ToString();
            });
        }
예제 #6
0
        public DSPageViewModel(ITextToSpeechService textToSpeech, IDeviceOrientationService deviceOrientation, IPhotoPickerService photoPicker)
        {
            _textToSpeech      = textToSpeech;
            _deviceOrientation = deviceOrientation;
            _photoPicker       = photoPicker;

            OnSpeakCommandClicked       = new DelegateCommand(Speak);
            OnOrientationCommandClicked = new DelegateCommand(GetOrientation);
            OnPhotoPickerCommandClicked = new DelegateCommand(PickPhoto);
        }
예제 #7
0
        public HomeViewModel(IDeviceOrientationService deviceOrientarionService)
        {
            DeviceOrientationService = deviceOrientarionService;

            var orientation = DeviceOrientationService.GetOrientation();

            Orientation = orientation.ToString();

            GetOrientarionCommand = new Command(OnGetOrientarion);
        }
예제 #8
0
        public DevicePageViewModel()
        {
            //Comando para boton GetDeviceORientation, este dara la orientacion del dispositivo
            GetOrientationCommand = new Command(() =>
            {
                IDeviceOrientationService service = DependencyService.Get <IDeviceOrientationService>();
                DeviceOrientation orientation     = service.GetOrientation();

                App.Current.MainPage.DisplayAlert("Orientacion", orientation.ToString(), "ok");
            });
        }
예제 #9
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            Console.WriteLine("LOG: METHOD RAN");

            if (!nextMedia)
            {
                DependencyService.Get <IFullscreenService>().EnterFullscreen();
                IDeviceOrientationService service = DependencyService.Get <IDeviceOrientationService>();
                service.ForceLandscape();
            }
            nextMedia = false;
        }
예제 #10
0
        private void GetOrientationClicked(object sender, EventArgs e)
        {
            IDeviceOrientationService service     = DependencyService.Get <IDeviceOrientationService>();
            DeviceOrientation         orientation = service.GetOrientation();

            if (orientation == DeviceOrientation.Landscape)
            {
                DisplayAlert("Alert", "Its Landscape", "OK");
            }
            else if (orientation == DeviceOrientation.Portrait)
            {
                DisplayAlert("Alert", "Its Portrait", "OK");
            }
        }
예제 #11
0
 public HomePageViewModel()
 {
     GetDeviceOrientationCommand = new Command(async() =>
     {
         IDeviceOrientationService service = DependencyService.Get <IDeviceOrientationService>();
         DeviceOrientation orientation     = service.GetOrientation();
         if (orientation.IsLandscape())
         {
             await App.Current.MainPage.DisplayAlert("Orientation", "The device orientation is Landscape", "Ok");
         }
         else
         {
             await App.Current.MainPage.DisplayAlert("Orientation", "The device orientation is Portrait", "Ok");
         }
     });
 }
예제 #12
0
 public DraftsPageViewModel(INavigationService inavigarionServices, IPageDialogService dialogService, IUserServices userServices, IDeviceOrientationService deviceOrientationService, IDependencyService dependencyService) : base(inavigarionServices, dialogService, userServices, deviceOrientationService, dependencyService)
 {
     deviceOrientationService = dependencyService.Get <IDeviceOrientationService>();
     IsPresentCommand         = new DelegateCommand(() =>
     {
         MessagingCenter.Send(this, "IsPresentKey", IsPresent);
     });
 }
 public NewMailPageViewModel(INavigationService inavigarionServices, IPageDialogService dialogService, IUserServices userServices, IDeviceOrientationService deviceOrientationService, IDependencyService dependencyService) : base(inavigarionServices, dialogService, userServices, deviceOrientationService, dependencyService)
 {
     deviceOrientationService.GetOrientation();
 }
 public WaitingCarLandscapeViewModel(IDeviceOrientationService deviceOrientationService)
 {
     _deviceOrientationService = deviceOrientationService;
 }
예제 #15
0
 public ReceivedPageViewModel(INavigationService inavigarionServices, IPageDialogService dialogService, IUserServices userServices, IDeviceOrientationService deviceOrientationService, IDependencyService dependencyService) : base(inavigarionServices, dialogService, userServices, deviceOrientationService, dependencyService)
 {
     LoadList();
     IsPresentCommand = new DelegateCommand(() =>
     {
         MessagingCenter.Send(this, "IsPresentKey", IsPresent);
     });
     NewMailCommand = new DelegateCommand(() =>
     {
         navigationService.NavigateAsync(new Uri($"{ConfigPage.MenuMasterDetailPage}{ConfigPage.NavigationPage}{ConfigPage.ReceivedPage}{ConfigPage.NewMailPage}"));
     });
 }
        public DeviceOrientationPageViewModel(IDeviceOrientationService deviceOrientationService)
        {
            DeviceOrientationService = deviceOrientationService;

            GetDeviceOrientationCommand = new DelegateCommand(ExecuteGetDeviceOrientationCommand);
        }
예제 #17
0
 public MenuMasterDetailPageViewModel(INavigationService navigationService, IPageDialogService dialogService, IUserServices userServices, IDeviceOrientationService deviceOrientationService, IDependencyService dependencyService) : base(navigationService, dialogService, userServices, deviceOrientationService, dependencyService)
 {
     ItemsMasters = new ObservableCollection <ItemMasters>()
     {
         new ItemMasters()
         {
             Image = "OutBoxImage",
             Title = "Inbox",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.ReceivedPage}"
         }, new ItemMasters()
         {
             Image = "ic_action_star_borderBlack.png",
             Title = "Featureds",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.FeaturedPage}"
         }, new ItemMasters()
         {
             Image = "ic_action_access_time",
             Title = "Postponeds",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.PostponedPage}"
         }, new ItemMasters()
         {
             Image = "ic_action_label_important",
             Title = "Importants",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.ImportantPage}"
         }, new ItemMasters()
         {
             Image = "ic_action_send",
             Title = "Sends",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.SendsPage}"
         }, new ItemMasters()
         {
             Image = "ic_action_access_time",
             Title = "Scheduled",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.ScheduledPage}"
         }, new ItemMasters()
         {
             Image = "UploadImage",
             Title = "OutBox",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.OutboxPage}"
         }, new ItemMasters()
         {
             Image = "paperImage",
             Title = "Drafts",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.DraftsPage}"
         }, new ItemMasters()
         {
             Image = "emailImage",
             Title = "Alls",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.AllMailPage}"
         }, new ItemMasters()
         {
             Image = "ic_action_error_outline",
             Title = "Spam",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.SpamPage}"
         }, new ItemMasters()
         {
             Image = "ic_action_delete_outline.png",
             Title = "Recycle Bin",
             Page  = $"{ConfigPage.NavigationPage}{ConfigPage.RecycleBinPage}"
         }
     };
     SelectPageCommand = new DelegateCommand <string>(NavigateAsync);
     MessagingCenter.Subscribe <ReceivedPageViewModel, bool>(this, "IsPresentKey", (param, sender) =>
     {
         IsPresent = sender;
     });
 }
예제 #18
0
 public OrientationViewModel(INavigationService navigationService, IPageDialogService pageDialogService,
                             IDeviceOrientationService deviceOrientationService) : base(navigationService, pageDialogService)
 {
     _deviceOrientationService = deviceOrientationService;
     GetDeviceOrientation      = new DelegateCommand(GetOrientation);
 }