public async void SendResetPasswordLink()
        {
            if (String.IsNullOrEmpty(EmailAddress))
            {
                await Popups.ShowAsync(ClientResources.Register_Email_Required);

                return;
            }

            var emailRegEx = new Regex(EMAIL_REGEX);

            if (!emailRegEx.Match(EmailAddress).Success)
            {
                await Popups.ShowAsync(ClientResources.Register_Email_Invalid);

                return;
            }

            if ((await PerformNetworkOperation(CallSendInvite)).Successful)
            {
                await Popups.ShowAsync(ClientResources.SendResetPasswordLink_Message);

                await ViewModelNavigation.GoBackAsync();
            }
        }
Пример #2
0
        public App()
        {
            InitializeComponent();

            DependencyService.Register <MockDataStore>();
            _ = ViewModelNavigation.SetTabbedMainPage <MainPage>();
        }
Пример #3
0
        public async void LoginAsync()
        {
            var loginResult = await PerformNetworkOperation(PerformLoginAsync);

            if (loginResult.Successful)
            {
                if (AuthManager.User.EmailConfirmed && AuthManager.User.PhoneNumberConfirmed)
                {
                    // If no org, have them add an org....
                    if (EntityHeader.IsNullOrEmpty(AuthManager.User.CurrentOrganization))
                    {
                        await ViewModelNavigation.SetAsNewRootAsync <OrgEditorViewModel>();
                    }
                    else
                    {
                        // We are good, so show main screen.
                        await ViewModelNavigation.SetAsNewRootAsync(_clientAppInfo.MainViewModel);
                    }
                }
                else
                {
                    // Show verify user screen.
                    await ViewModelNavigation.SetAsNewRootAsync <VerifyUserViewModel>();
                }
            }
        }
Пример #4
0
 public MainViewModel()
 {
     MenuItems = new List <MenuItem>()
     {
         new MenuItem()
         {
             Command     = new RelayCommand(() => ViewModelNavigation.NavigateAsync <UserOrgsViewModel>(this)),
             Name        = ClientResources.MainMenu_SwitchOrgs,
             FontIconKey = "fa-users"
         },
         new MenuItem()
         {
             Command     = new RelayCommand(() => ViewModelNavigation.NavigateAsync <ChangePasswordViewModel>(this)),
             Name        = ClientResources.MainMenu_ChangePassword,
             FontIconKey = "fa-key"
         },
         new MenuItem()
         {
             Command     = new RelayCommand(() => ViewModelNavigation.NavigateAsync <InviteUserViewModel>(this)),
             Name        = ClientResources.MainMenu_InviteUser,
             FontIconKey = "fa-user"
         },
         new MenuItem()
         {
             Command     = new RelayCommand(() => Logout()),
             Name        = ClientResources.Common_Logout,
             FontIconKey = "fa-sign-out"
         }
     };
 }
Пример #5
0
        public override async Task InitAsync()
        {
            await AuthManager.LoadAsync();

            if (AuthManager.IsAuthenticated)
            {
                if (EntityHeader.IsNullOrEmpty(AuthManager.User.CurrentOrganization))
                {
                    Logger.AddKVPs(new KeyValuePair <string, string>("Email", AuthManager.User.Email));
                }
                else
                {
                    Logger.AddKVPs(new KeyValuePair <string, string>("Email", AuthManager.User.Email), new KeyValuePair <string, string>("OrgId", AuthManager.User.CurrentOrganization.Text));
                }

                if (!AuthManager.User.EmailConfirmed || !AuthManager.User.PhoneNumberConfirmed)
                {
                    await ViewModelNavigation.SetAsNewRootAsync <VerifyUserViewModel>();
                }
                else if (EntityHeader.IsNullOrEmpty(AuthManager.User.CurrentOrganization))
                {
                    await ViewModelNavigation.SetAsNewRootAsync <Orgs.OrgEditorViewModel>();
                }
                else
                {
                    await ViewModelNavigation.SetAsNewRootAsync(_clientAppInfo.MainViewModel);
                }
            }
            else
            {
                NotLoggedIn = true;
                IsLoading   = false;
            }
        }
Пример #6
0
 public async override void EHPickerTapped(string fieldName)
 {
     if (fieldName == nameof(Model.DeviceType))
     {
         await ViewModelNavigation.NavigateAndPickAsync <DeviceTypePickerViewModel>(this, DeviceTypePicked);
     }
 }
Пример #7
0
 public async void ResetPassword()
 {
     if (await Popups.ConfirmAsync(Resources.SimulatorCoreResources.UnlockPassword_ResetPassword_Title, Resources.SimulatorCoreResources.UnlockPassword_ResetPassword_Prompt))
     {
         await ViewModelNavigation.NavigateAndPickAsync <SetStoragePasswordViewModel>(this, StorageUnlocked, CancelCredentialsEntry);
     }
 }
Пример #8
0
        private void InitServices()
        {
#if ENV_MASTER
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_STAGE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCAL
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#endif

            /* Configuring he IoC is something like this...be warned
             *
             * https://www.youtube.com/watch?v=7-FbfkUD78w
             */

            DeviceInfo.Register();

            var clientAppInfo = new ClientAppInfo();

            _appConfig = new AppConfig();

            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(_appConfig);

            var navigation = new ViewModelNavigation(this);
            LagoVista.XPlat.Core.Startup.Init(this, navigation);
            LagoVista.Client.Core.Startup.Init(serverInfo);

            navigation.Add <MainViewModel, Views.MainView>();
            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Add <MonitorInstanceViewModel, Views.MonitorInstanceView>();
            navigation.Add <InstanceViewModel, Views.InstanceView>();
            navigation.Add <ListenerViewModel, Views.ListenerView>();
            navigation.Add <PipelineViewModel, Views.PipelineView>();
            navigation.Add <PlannerViewModel, Views.PlannerView>();
            navigation.Add <TelemetryViewModel, Views.TelemetryView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
 private void HandleItemSelected(object parameter)
 {
     ViewModelNavigation.PushAsync(new ItemPageViewModel()
     {
         Item = parameter as RssItem
     });
 }
Пример #10
0
        public override async void Save()
        {
            if (!FormAdapter.IsDirty && !HasDirtyChildren && LaunchArgs.LaunchType == LaunchTypes.Edit)
            {
                await ViewModelNavigation.GoBackAsync();
            }
            else if (FormAdapter.Validate())
            {
                ViewToModel(FormAdapter, Model);
                if (Model is IValidateable)
                {
                    var result = Validator.Validate(Model as IValidateable);
                    if (!result.Successful)
                    {
                        await ShowValidationErrorsAsync(result);

                        return;
                    }
                }

                var saveResult = await SaveRecordAsync();

                if (saveResult.Successful)
                {
                    //See notes on this method we allow the view model to override what happens when the record is saved.
                    HasDirtyChildren = false;
                    NotifyParentChildDirty();

                    await PostSaveAsync();
                }
            }
        }
 public LolLeaderboardViewModel(RestClient restClient, ViewModelNavigation viewModelNavigation) : base(restClient, viewModelNavigation)
 {
     SortOptions = new List <string> {
         "SoloWins", "FlexWins"
     };
     SelectedOption = SortOptions.FirstOrDefault();
     LoadAsync(CreateRestRequest());
 }
Пример #12
0
 public EliteLeaderboardViewModel(RestClient restClient, ViewModelNavigation viewModelNavigation) : base(restClient, viewModelNavigation)
 {
     SortOptions = new List <string> {
         "combat", "trade", "explore", "cqc"
     };
     SelectedOption = SortOptions.FirstOrDefault();
     LoadAsync(CreateRestRequest());
 }
 public FortniteLeaderboardViewModel(RestClient restClient, ViewModelNavigation viewModelNavigation) : base(restClient, viewModelNavigation)
 {
     SortOptions = new List <string> {
         "wins", "kills", "kd", "top1"
     };
     SelectedOption = SortOptions.FirstOrDefault();
     LoadAsync(CreateRestRequest());
 }
Пример #14
0
 public async void EditSimulator()
 {
     if (_isConnected)
     {
         await DisconnectAsync();
     }
     await ViewModelNavigation.NavigateAndEditAsync <SimulatorEditorViewModel>(this, Model.Id);
 }
 public Gw2LeaderboardViewModel(RestClient restClient, ViewModelNavigation viewModelNavigation) : base(restClient, viewModelNavigation)
 {
     SortOptions = new List <string> {
         "PvpRank", "PvpRankPoint", "PvpRankRollovers"
     };
     SelectedOption = SortOptions.FirstOrDefault();
     LoadAsync(CreateRestRequest());
 }
Пример #16
0
        public async void AcceptInvite()
        {
            if ((await PerformNetworkOperation(SendAcceptInvite)).Successful)
            {
                await Popups.ShowAsync(ClientResources.Accept_AcceptLoggedInSuccessful);

                await ViewModelNavigation.GoBackAsync();
            }
        }
Пример #17
0
        private void InitServices()
        {
#if ENV_PROD
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCAL
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#elif ENV_LIVE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#endif



            /* Configuring he IoC is something like this...be warned
             *
             * https://www.youtube.com/watch?v=7-FbfkUD78w
             */

            var clientAppInfo = new ClientAppInfo();

            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(new AppConfig());

            var navigation = new ViewModelNavigation(this);
            LagoVista.XPlat.Core.Startup.Init(this, navigation);
            LagoVista.Client.Core.Startup.Init(serverInfo);

            navigation.Add <MainViewModel, Views.MainView>();
            navigation.Add <DeviceExplorerViewModel, Views.DeviceExplorerView>();
            navigation.Add <ProvisionDeviceViewModel, Views.ProvisionDeviceView>();
            navigation.Add <DeviceTypePickerViewModel, Views.DeviceTypePickerView>();
            navigation.Add <MonitorDeviceViewModel, Views.MonitorDeviceView>();
            navigation.Add <ManageDeviceViewModel, Views.ManageDeviceView>();

            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
Пример #18
0
        public async void InviteUser()
        {
            if ((await PerformNetworkOperation(SendUserInvitation)).Successful)
            {
                await Popups.ShowAsync(ClientResources.InviteUser_InvitationSent);

                await ViewModelNavigation.GoBackAsync();
            }
        }
Пример #19
0
        public ResetPasswordViewModel(IRestClient rawRestClient)
        {
            _rawRestClient = rawRestClient;

            Model = new ResetPassword();

            ResetPasswordCommand = new RelayCommand(ResetPassword);
            CancelCommand        = new RelayCommand(() => ViewModelNavigation.GoBackAsync());
        }
Пример #20
0
 private void OnModalPopped(object sender, ModalPoppedEventArgs e)
 {
     if (e.Modal is YamvvmNavigationPage navPage)
     {
         if (navPage.CurrentPage is YamvvmPage page)
         {
             ViewModelNavigation.PagePopped(page);
         }
     }
 }
Пример #21
0
        public RegisterUserViewModel(IAppConfig appConfig, IDeviceInfo deviceInfo, IClientAppInfo clientAppInfo)
        {
            RegisterModel            = new RegisterUser();
            RegisterModel.AppId      = appConfig.AppName;
            RegisterModel.DeviceId   = deviceInfo.DeviceUniqueId;
            RegisterModel.ClientType = "mobileapp";
            RegisterCommand          = new RelayCommand(Register);

            CancelCommand = new RelayCommand(() => ViewModelNavigation.GoBackAsync());
        }
Пример #22
0
 public HudViewModel(IConnectedUasManager connectedUasManager, INavigation navigation, IFlightRecorder flightRecorder, INiVekFlightStickState flightStickState)
 {
     Navigation           = navigation;
     _connectedUasManager = connectedUasManager;
     Connections          = _connectedUasManager;
     LandingGear          = new LandingGearViewModel(connectedUasManager);
     EditMissionCommand   = new RelayCommand(() => ViewModelNavigation.NavigateAsync <Missions.MissionPlannerViewModel>(this));
     UasMgr           = connectedUasManager;
     FlightRecorder   = flightRecorder;
     FlightStickState = flightStickState;
 }
Пример #23
0
 public async void UnlockStorageAndGetAccessKey()
 {
     if (!SecureStorage.IsSetup)
     {
         await ViewModelNavigation.NavigateAndPickAsync <SetStoragePasswordViewModel>(this, StorageUnlocked, CancelCredentialsEntry);
     }
     else
     {
         await ViewModelNavigation.NavigateAndPickAsync <UnlockStorageViewModel>(this, StorageUnlocked, CancelCredentialsEntry);
     }
 }
Пример #24
0
        public void AcceptInviteAndRegister()
        {
            var args = new ViewModelLaunchArgs()
            {
                ViewModelType = typeof(RegisterUserViewModel),
                LaunchType    = LaunchTypes.Other
            };

            args.Parameters.Add("inviteId", _inviteid);
            ViewModelNavigation.NavigateAsync(args);
        }
Пример #25
0
        private void InitServices()
        {
#if ENV_STAGE
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#elif ENV_DEV
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "dev-api.nuviot.com",
            };
#elif ENV_LOCALDEV
            var serverInfo = new ServerInfo()
            {
                SSL     = false,
                RootUrl = "localhost:5001",
            };
#elif ENV_MASTER
            var serverInfo = new ServerInfo()
            {
                SSL     = true,
                RootUrl = "api.nuviot.com",
            };
#endif

            var clientAppInfo = new ClientAppInfo();

            _appConfig = new AppConfig();
            SLWIOC.RegisterSingleton <IClientAppInfo>(clientAppInfo);
            SLWIOC.RegisterSingleton <IAppConfig>(_appConfig);

            var navigation = new ViewModelNavigation(this);
            LagoVista.XPlat.Core.Startup.Init(this, navigation);
            LagoVista.Client.Core.Startup.Init(serverInfo, new AppStyle());

            navigation.Add <MainViewModel, Views.MainView>();
            navigation.Add <DeviceExplorerViewModel, Views.DeviceExplorerView>();
            navigation.Add <ProvisionDeviceViewModel, Views.ProvisionDeviceView>();
            navigation.Add <DeviceTypePickerViewModel, Views.DeviceTypePickerView>();
            navigation.Add <MonitorDeviceViewModel, Views.MonitorDeviceView>();
            navigation.Add <DeviceMapViewModel, Views.DeviceMapView>();
            navigation.Add <ManageDeviceViewModel, Views.ManageDeviceView>();

            navigation.Add <SplashViewModel, Views.SplashView>();

            navigation.Start <SplashViewModel>();

            SLWIOC.Register <IDeviceManagementClient, DeviceManagementClient>();
            SLWIOC.RegisterSingleton <IViewModelNavigation>(navigation);
        }
Пример #26
0
        protected Task NavigateAndViewAsync <TViewModel>(string id)
        {
            var launchArgs = new ViewModelLaunchArgs()
            {
                ViewModelType   = typeof(TViewModel),
                ParentViewModel = this,
                ChildId         = id,
                LaunchType      = LaunchTypes.View
            };

            return(ViewModelNavigation.NavigateAsync(launchArgs));
        }
Пример #27
0
        protected Task NavigateAndCreateAsync <TViewModel>(string parentId)
        {
            var launchArgs = new ViewModelLaunchArgs()
            {
                ViewModelType   = typeof(TViewModel),
                ParentViewModel = this,
                ParentId        = parentId,
                LaunchType      = LaunchTypes.Create
            };

            return(ViewModelNavigation.NavigateAsync(launchArgs));
        }
Пример #28
0
 public override void Save()
 {
     base.Save();
     if (FormAdapter.Validate())
     {
         ViewToModel(FormAdapter, Model);
         PerformNetworkOperation(async() =>
         {
             await ViewModelNavigation.SetAsNewRootAsync(_clientAppInfo.MainViewModel);
         });
     }
 }
Пример #29
0
        public void EditDevice()
        {
            var launchArgs = new ViewModelLaunchArgs()
            {
                ViewModelType = typeof(ManageDeviceViewModel),
                LaunchType    = LaunchTypes.Edit
            };

            launchArgs.Parameters.Add(MonitorDeviceViewModel.DeviceRepoId, _deviceRepoId);
            launchArgs.Parameters.Add(MonitorDeviceViewModel.DeviceId, _deviceId);

            ViewModelNavigation.NavigateAsync(launchArgs);
        }
        public async void ShowHostTelemetry()
        {
            var launchArgs = new ViewModelLaunchArgs()
            {
                ViewModelType = typeof(TelemetryViewModel),
                ChildId       = Instance.Id,
            };

            launchArgs.Parameters.Add(TelemetryViewModel.VIEW_TYPE, TelemetryViewModel.VIEW_TYPE_HOST);
            launchArgs.Parameters.Add(TelemetryViewModel.VIEW_NAME, Instance.Name);

            await ViewModelNavigation.NavigateAsync(launchArgs);
        }