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" } }; }
public void AcceptInviteAndRegister() { var args = new ViewModelLaunchArgs() { ViewModelType = typeof(RegisterUserViewModel), LaunchType = LaunchTypes.Other }; args.Parameters.Add("inviteId", _inviteid); ViewModelNavigation.NavigateAsync(args); }
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; }
protected Task NavigateAndCreateAsync <TViewModel>(string parentId) { var launchArgs = new ViewModelLaunchArgs() { ViewModelType = typeof(TViewModel), ParentViewModel = this, ParentId = parentId, LaunchType = LaunchTypes.Create }; return(ViewModelNavigation.NavigateAsync(launchArgs)); }
protected Task NavigateAndViewAsync <TViewModel>(string id) { var launchArgs = new ViewModelLaunchArgs() { ViewModelType = typeof(TViewModel), ParentViewModel = this, ChildId = id, LaunchType = LaunchTypes.View }; return(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); }
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); }
protected override void ItemSelected(DeviceSummary model) { base.ItemSelected(model); var launchArgs = new ViewModelLaunchArgs() { ViewModelType = typeof(MonitorDeviceViewModel), LaunchType = LaunchTypes.View }; launchArgs.Parameters.Add(MonitorDeviceViewModel.DeviceRepoId, LaunchArgs.ChildId); launchArgs.Parameters.Add(MonitorDeviceViewModel.DeviceId, model.Id); ViewModelNavigation.NavigateAsync(launchArgs); }
public FlightViewModel(IConnectedUasManager connectedUasManager, INavigation navigation, IFlightRecorder flightRecorder, INiVekFlightStick flightStick) { Navigation = navigation; _connectedUasManager = connectedUasManager; Connections = _connectedUasManager; LandingGear = new LandingGearViewModel(connectedUasManager); EditMissionCommand = new RelayCommand(() => ViewModelNavigation.NavigateAsync <Missions.MissionPlannerViewModel>(this)); CalibrateGimbleCommand = new RelayCommand(() => UasMgr.Active.Uas.Camera.Calibrate()); UasMgr = connectedUasManager; FlightRecorder = flightRecorder; FlightStickState = flightStick.State; flightStick.StateUpdated += FlightStick_StateUpdated; flightStick.TakeOff += FlightStick_TakeOff; flightStick.Land += FlightStick_Land; }
public DeviceExplorerViewModel(IDeviceManagementClient client) { AddNewDeviceCommand = new RelayCommand(AddNewDevice); SeachNowCommand = new RelayCommand(SearchNow); SelectDeviceTypeCommand = new RelayCommand(SelectDeviceType); _client = client; MenuItems = new List <MenuItem>() { new MenuItem() { Command = new RelayCommand(() => ViewModelNavigation.NavigateAsync <DeviceMapViewModel>(this)), Name = DeviceManagerResources.MainVIew_Menu_MapView, FontIconKey = "fa-users" }, }; }
public MainViewModel() { AddNewSimulatorCommand = new RelayCommand(AddNewSimulator); SettingsCommand = new RelayCommand(ToggleSettings); DeleteSimulatorCommand = new RelayCommand(DeleteSimulator); 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(() => ViewModelNavigation.NavigateAsync <AboutViewModel>(this)), Name = "About", FontIconKey = "fa-info" }, new MenuItem() { Command = new RelayCommand(() => Logout()), Name = ClientResources.Common_Logout, FontIconKey = "fa-sign-out" } }; }
public MainViewModel() { MapDeviceRepoCommand = new RelayCommand(MapRepo); 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(() => ViewModelNavigation.NavigateAsync <AboutViewModel>(this)), Name = "About", FontIconKey = "fa-info" }, new MenuItem() { Command = new RelayCommand(() => Logout()), Name = ClientResources.Common_Logout, FontIconKey = "fa-sign-out" } }; ShowIoTAppStudioCommand = new RelayCommand(() => NetworkService.OpenURI(new Uri("https://www.IoTAppStudio.com"))); }
public async Task <InvokeResult> SendRegistrationAsync() { var result = await RestClient.PostAsync <RegisterUser, AuthResponse>("/api/user/register", RegisterModel); if (!result.Successful) { return(result.ToInvokeResult()); } var authResult = result.Result; /* Make sure our Access Token is saved so the REST service can use it */ AuthManager.AccessToken = authResult.AccessToken; AuthManager.AccessTokenExpirationUTC = authResult.AccessTokenExpiresUTC; AuthManager.RefreshToken = authResult.RefreshToken; AuthManager.RefreshTokenExpirationUTC = authResult.RefreshTokenExpiresUTC; AuthManager.AppInstanceId = authResult.AppInstanceId; AuthManager.IsAuthenticated = true; var refrehResult = await RefreshUserFromServerAsync(); if (!refrehResult.Successful) { return(refrehResult); } Logger.AddKVPs(new KeyValuePair <string, string>("Email", AuthManager.User.Email)); if (LaunchArgs.Parameters.ContainsKey("inviteid")) { return((await RestClient.GetAsync <InvokeResult>($"/api/org/inviteuser/accept/{LaunchArgs.Parameters["inviteId"]}")).Result); } await ViewModelNavigation.NavigateAsync <VerifyUserViewModel>(this); return(InvokeResult.Success); }
public virtual void HandleURIActivation(Uri uri, Dictionary <string, string> kvps) { Logger.AddCustomEvent(LagoVista.Core.PlatformSupport.LogLevel.Message, "HandleURIActivation", uri.Host, uri.Query.ToKVP("queryString")); if (uri.Host == "resetpassword") { if (!kvps.ContainsKey("code")) { Logger.AddCustomEvent(LagoVista.Core.PlatformSupport.LogLevel.Error, "ResetPassword_HandleURIActivation", "Missing Code", uri.Query.ToKVP("queryString"), uri.Host.ToKVP("action")); } else { var launchArgs = new ViewModelLaunchArgs { ViewModelType = typeof(ResetPasswordViewModel) }; launchArgs.Parameters.Add("code", kvps["code"]); ViewModelNavigation.NavigateAsync(launchArgs); } } else if (uri.Host == "acceptinvite") { if (!kvps.ContainsKey("inviteid")) { Logger.AddCustomEvent(LagoVista.Core.PlatformSupport.LogLevel.Error, "AcceptInvite_HandleURIActivation", "Missing Inviteid", uri.Query.ToKVP("queryString"), uri.Host.ToKVP("action")); } else { var launchArgs = new ViewModelLaunchArgs { ViewModelType = typeof(AcceptInviteViewModel) }; launchArgs.Parameters.Add("inviteId", kvps["inviteid"]); ViewModelNavigation.NavigateAsync(launchArgs); } } }
public MainViewModel() { MenuItems = new List <MenuItem>() { new MenuItem() { Command = new RelayCommand(() => ViewModelNavigation.NavigateAsync <ServicesViewModel>(this)), Name = "Services", FontIconKey = "fa-gear" }, new MenuItem() { Command = new RelayCommand(() => ViewModelNavigation.NavigateAsync <SecureStorageViewModel>(this)), Name = "Secure Storage", FontIconKey = "fa-gear" }, new MenuItem() { Command = new RelayCommand(() => ViewModelNavigation.NavigateAsync <LoginViewModel>(this)), Name = "Login Page", FontIconKey = "fa-gear" }, new MenuItem() { Command = new RelayCommand(() => ViewModelNavigation.NavigateAsync <AboutViewModel>(this)), Name = "About", FontIconKey = "fa-gear" }, new MenuItem() { Command = new RelayCommand(() => ViewModelNavigation.NavigateAsync <ControlSampleViewModel>(this)), Name = "Control Sample", FontIconKey = "fa-gear" }, }; }
public async override Task <InvokeResult> SaveRecordAsync() { if (IsCreate) { if (LaunchArgs.ParentViewModel is MainViewModel parent) { if (parent.ListItems.Where(sim => sim.Key == this.Model.Key).Any()) { await this.Popups.ShowAsync(ClientResources.Common_KeyInUse); return(InvokeResult.FromErrors(ClientResources.Common_KeyInUse.ToErrorMessage())); } } } if (!SecureStorage.IsUnlocked && !EntityHeader.IsNullOrEmpty(Model.CredentialStorage) && Model.CredentialStorage.Value == CredentialsStorage.OnDevice) { if (SecureStorage.IsSetup) { await ViewModelNavigation.NavigateAsync <UnlockStorageViewModel>(this); } else { await ViewModelNavigation.NavigateAsync <SetStoragePasswordViewModel>(this); } return(InvokeResult.FromErrors(Resources.SimulatorCoreResources.SimulatorEdit_UnlockRequired.ToErrorMessage())); } var validationResult = Validator.Validate(this.Model); if (!validationResult.Successful) { await this.ShowValidationErrorsAsync(validationResult); return(InvokeResult.FromError("Please correct errors")); } return(await PerformNetworkOperation(async() => { if (!EntityHeader.IsNullOrEmpty(this.Model.CredentialStorage)) { switch (this.Model.CredentialStorage.Value) { case CredentialsStorage.InCloud: /* NOP */ break; case CredentialsStorage.OnDevice: switch (this.Model.DefaultTransport.Value) { case TransportTypes.RestHttp: if (!this.Model.Anonymous) { _secureStorage.Store(this.Model.Id, this.Model.Password); } break; case TransportTypes.MQTT: if (!this.Model.Anonymous) { _secureStorage.Store(this.Model.Id, this.Model.Password); } break; case TransportTypes.AzureIoTHub: case TransportTypes.AzureServiceBus: case TransportTypes.AzureEventHub: _secureStorage.Store(this.Model.Id, this.Model.AccessKey); break; } /* If we store locally or on the device set to null so they won't be sent to the server */ this.Model.Password = null; this.Model.AccessKey = null; break; case CredentialsStorage.Prompt: /* If we prompt the user each time for the access key password, set to null so won't send to server */ this.Model.Password = null; this.Model.AccessKey = null; break; } } if (LaunchArgs.LaunchType == LaunchTypes.Create) { return await FormRestClient.AddAsync("/api/simulator", this.Model); } else { return await FormRestClient.UpdateAsync("/api/simulator", this.Model); } })); }
public async void ForgotPassword() { await ViewModelNavigation.NavigateAsync <SendResetPasswordLinkViewModel>(this); }
public MainViewModel(IMissionPlanner planner, IHeartBeatManager heartBeatManager, ITelemetryService telemetryService, IConnectedUasManager connectedUasManager) { _telemetryService = telemetryService; _heartBeatManager = heartBeatManager; Connections = connectedUasManager; Connections.ActiveDroneChanged += Connections_ActiveDroneChanged; var transport = new SerialPortTransport(DispatcherServices); //Connections.Active = new ConnectedUas(new APM(null), transport); //Connections.All.Add(Connections.Active); //Connections.Active.Transport.OnMessageReceived += _telemeteryLink_MessageParsed; //TelemetryLink.MessageParsed += _telemeteryLink_MessageParsed; OpenSerialPortCommand = new RelayCommand(HandleConnectClick, CanPressConnect); ShowMissionPlannerCommand = new RelayCommand(() => ViewModelNavigation.NavigateAsync <Missions.MissionPlannerViewModel>(this), CanDoConnectedStuff); StartDataStreamsCommand = new RelayCommand(() => _telemetryService.Start(Connections.Active.Uas, Connections.Active.Transport), CanDoConnectedStuff); StopDataStreamsCommand = new RelayCommand(() => _telemetryService.Stop(Connections.Active.Transport), CanDoConnectedStuff); BeginCalibrationCommand = new RelayCommand(() => ViewModelNavigation.NavigateAsync <Calibration.AccCalibrationViewModel>(this), CanDoConnectedStuff); FlyNowCommand = new RelayCommand(() => ViewModelNavigation.NavigateAsync <HudViewModel>(this), CanDoConnectedStuff); MotorTestCommand = new RelayCommand(() => ViewModelNavigation.NavigateAsync <Testing.MotorsTestViewModel>(this), CanDoConnectedStuff); Title = "UAS NuvIoT Connector"; _planner = planner; MenuItems = new List <MenuItem>() { new MenuItem() { Command = new RelayCommand(() => ViewModelNavigation.NavigateAsync <UasTypeManagerViewModel>(this)), Name = "Settings", FontIconKey = "fa-users" }, 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(() => ViewModelNavigation.NavigateAsync <AboutViewModel>(this)), Name = "About", FontIconKey = "fa-info" }, new MenuItem() { Command = new RelayCommand(() => Logout()), Name = ClientResources.Common_Logout, FontIconKey = "fa-sign-out" } }; this.RefreshUI(); }
public async void Register() { await ViewModelNavigation.NavigateAsync <RegisterUserViewModel>(this); }