Пример #1
0
        /// <summary>
        /// Creates a page and a model depending on what the pageId is. To add new or different page/view model combinations, subclass and override this method.
        /// </summary>
        /// <param name="pageId"></param>
        /// <param name="authApi"></param>
        /// <param name="sessionStore"></param>
        /// <param name="bindContext"></param>
        /// <returns></returns>
        public virtual PageModelPair CreatePageModelPair(PageId pageId, IApiCognito authApi, ISessionStore sessionStore, bool bindContext = true)
        {
            PageModelPair pair = null;

            switch (pageId)
            {
            case PageId.SignIn:
                pair = new PageModelPair(new SignIn(), new SignInViewModel(sessionStore, authApi, this));
                break;

            case PageId.SignUp:
                pair = new PageModelPair(new SignUp(), new SignUpViewModel(sessionStore, authApi, this));
                break;

            case PageId.UpdatePassword:
                pair = new PageModelPair(new UpdatePassword(), new UpdatePasswordViewModel(sessionStore, authApi, this));
                break;

            case PageId.ValidateCode:
                pair = new PageModelPair(new ValidateCode(), new ValidateCodeViewModel(sessionStore, authApi, this));
                break;
            }

            if (pair != null && bindContext)
            {
                pair.Page.BindingContext = pair.ViewModel;
            }

            return(pair);
        }
Пример #2
0
        public App()
        {
            InitializeComponent();

            AuthApi = new ApiCognito();
            Session = new SessionStore {
                Settings = Plugin.Settings.CrossSettings.Current
            };

            ApiCognito.PoolId         = "us-west-2_CHjCveWGb";        // Change to <Your Pool Id>
            ApiCognito.ClientId       = "1sqm1euqob2uretl0jrc961gf3"; // Change to <Your Client Id>
            ApiCognito.RegionEndpoint = RegionEndpoint.USWest2;       // Change to <Your Region>

            InitializeMainPage();
        }
Пример #3
0
        public AddReservationViewModel(INavigationService navigationService, ISessionStore sessionStore, IApiCognito apiCognito, IPageDialogService dialogService) :
            base(navigationService, sessionStore, apiCognito, dialogService)
        {
            this.Title = "Ajouter une réservation";

            this.CmdNavigateToAddParticipant = new Command(NavitageToAddParticipant);
            this.CmdAddReservation           = new Command(AddReservation);

            this.ListSpaces = new List <Space>
            {
                new Space {
                    Id = 1, Capacity = 20, Name = "Salle 304"
                },
                new Space {
                    Id = 2, Capacity = 20, Name = "Salle 305"
                },
                new Space {
                    Id = 3, Capacity = 20, Name = "Salle 306"
                },
                new Space {
                    Id = 4, Capacity = 20, Name = "Salle 307"
                },
                new Space {
                    Id = 5, Capacity = 20, Name = "Salle 308"
                },
                new Space {
                    Id = 6, Capacity = 20, Name = "Salle 309"
                },
                new Space {
                    Id = 7, Capacity = 20, Name = "Salle 400"
                },
            };

            this.ListUsers = new List <User>();
        }
 public CognitoFormsViewModel(ISessionStore sessionStore, IApiCognito authApi, ICognitoFormsNavigator navigator)
 {
     SessionStore = sessionStore;
     AuthApi      = authApi;
     Navigator    = navigator;
 }
        public AddParticipantViewModel(INavigationService navigationService, ISessionStore sessionStore, IApiCognito apiCognito, IPageDialogService dialogService) :
            base(navigationService, sessionStore, apiCognito, dialogService)
        {
            this.Title           = "Ajouter un participant";
            this.ListViewVisible = false;

            this.CmdAddParticipant = new Command(ValidParticipant);

            this._tempListUser = new List <User>
            {
                new User {
                    Id = 1, Email = "*****@*****.**"
                },
                new User {
                    Id = 2, Email = "*****@*****.**"
                },
                new User {
                    Id = 3, Email = "*****@*****.**"
                },
                new User {
                    Id = 4, Email = "*****@*****.**"
                },
                new User {
                    Id = 5, Email = "*****@*****.**"
                },
                new User {
                    Id = 6, Email = "*****@*****.**"
                },
                new User {
                    Id = 7, Email = "*****@*****.**"
                }
            };
        }
Пример #6
0
 public SignInViewModel(ISessionStore sessionStore, IApiCognito authApi, ICognitoFormsNavigator navigator) : base(sessionStore, authApi, navigator)
 {
     CmdSignIn = new Command(DoSignIn);
     CmdSignUp = new Command(DoSignUp);
 }
        public ValidateCodeViewModel(ISessionStore sessionStore, IApiCognito authApi, ICognitoFormsNavigator navigator) : base(sessionStore, authApi, navigator)
        {
            CmdValidate = new Command(DoValidate);

            Email = SessionStore.UserName;
        }
 public UpdatePasswordViewModel(ISessionStore sessionStore, IApiCognito authApi, ICognitoFormsNavigator navigator) : base(sessionStore, authApi, navigator)
 {
     CmdUpdate = new Command(DoVerify);
 }
Пример #9
0
        public AddSpaceTypeViewModel(INavigationService navigationService, ISessionStore sessionStore, IApiCognito apiCognito, IPageDialogService dialogService) :
            base(navigationService, sessionStore, apiCognito, dialogService)
        {
            this.Title = "Ajouter un type d'espace";

            this.CmdAddSpaceType = new Command(AddSpaceType);
        }
Пример #10
0
 public AddCriterionViewModel(INavigationService navigationService, ISessionStore sessionStore, IApiCognito apiCognito, IPageDialogService dialogService) :
     base(navigationService, sessionStore, apiCognito, dialogService)
 {
     this.Title           = "Ajouter un critère";
     this.CmdAddCriterion = new MvvmHelpers.Commands.Command(ValidCriterion);
     this.Tools           = new List <Tool>()
     {
         new Tool()
         {
             Id    = 1,
             Label = "Cafetière"
         },
         new Tool()
         {
             Id    = 2,
             Label = "Chaise"
         },
         new Tool()
         {
             Id    = 3,
             Label = "Vidéo projecteur"
         },
         new Tool()
         {
             Id    = 4,
             Label = "Tableau"
         }
     };
 }