private void LaunchMainPage() { var page = new HostPage { Language = ApplicationLanguages.Languages[0] }; // page.ContentFrame.NavigationFailed += OnNavigationFailed; if (ApplicationExecutionState.Terminated == PreviousExecutionState) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = page; // if (null == page.ContentFrame.Content) // { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (!PageNavigation.NavigateToPage(typeof(MainPage), LaunchArguments)) { throw new PageNavigationException(typeof(MainPage)); } // } }
private async Task OnRegister() { Message = string.Empty; if (string.IsNullOrEmpty(UserName)) { Message = "Please enter user name"; return; } if (UserName.Length < 6) { Message = "Please enter valid user name"; return; } if (string.IsNullOrEmpty(Password)) { Message = "Please enter Password"; return; } if (Password.Length < 4) { Message = "Please enter valid Password"; return; } await PageNavigation.NavigateBackAsync($"{UserName} is Registered Succesfully"); }
public void Execute(object parameter) { if (CanExecute(parameter)) { PageNavigation.NavigateToPage(TargetPage, parameter); } }
private async Task OnNavigationAsync(string page) { switch (page) { case "Profile": await PageNavigation.NavigateToAsync <ProfileViewModel>(UserName); break; case "Settings": await PageNavigation.NavigateToAsync <SettingsViewModel>(); break; case "History": await PageNavigation.NavigateToAsync <HistoryViewModel>(); break; case "Address": await PageNavigation.NavigateToAsync <AddressViewModel>(); break; case "Payments": await PageNavigation.NavigateToAsync <PaymentsViewModel>(); break; } }
public MainPageViewModel(INavigationService navigationService) { NavigationSectionListCommand = new DelegateCommand(() => navigationService.NavigateAsync <SectionListPageViewModel>()); //DeepLinkByLiteralCommand = // new DelegateCommand( // () => navigationService.NavigateAsync( // "/NavigationPage/MainPage/SectionListPage/SelectedSection?sectionId=5")); DeepLinkByLiteralCommand = new DelegateCommand( () => navigationService.NavigateAsync( "/NavigationPage/m/SectionListPage/SectionPage?sectionId=5")); DeepLinkByViewModelCommand = new DelegateCommand(() => { var sectionPageNavigation = new PageNavigation <SectionDetailPageViewModel>(); sectionPageNavigation.Parameters.Add(SectionPageViewModel.SectionIdKey, 9); navigationService.NavigateAsync( new PageNavigation("NavigationPage"), new PageNavigation <MainPageViewModel>(), new PageNavigation <SectionListPageViewModel>(), sectionPageNavigation); }); }
/// <summary> /// On tapped in visits data /// </summary> /// <param name="s"></param> /// <param name="e"></param> private async void Visits_Tapped(object s, ItemTappedEventArgs e) { try { if (_isExecute) { _isExecute = false; var data = e.Item as CreateVisitsList; AppData.PropertyModel.SelectedVisit = null; var iMap = AppData.PropertyModel.SelectedRecord.IndexMap; if (data != null) { iMap = new IndexMapping(iMap.Property, iMap.RequestGroup, iMap.Record, 0, data.VisitListIndex); var details = AppData.PropertyModel.SelectedRecord.Record.Record.Inspections[0].Visits[data.VisitListIndex]; //Details.Status = SyncStatus.New; AppData.PropertyModel.SelectedVisit = new SelectedVisit(details, iMap, false); } //await SplitView.Instace().Navigation.PushModalAsync(new VisitActionPage(),true); PageNavigation.PushMainPage(new VisitActionPage()); _isExecute = true; } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
static async Task Main(string[] args) { IConfiguration configuration = AppSettingsFactory.GetAppSettings(); ConsoleHelper.WriteLine("Starting client...", ConsoleColor.Yellow); var clientIpEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 0); var serverIpEndPoint = new IPEndPoint(IPAddress.Parse(configuration["ServerIpAddress"]), ProtocolSpecification.Port); TcpClient client = new TcpClient(clientIpEndPoint); ConsoleHelper.WriteLine("Attempting connection to server...", ConsoleColor.Yellow); client.Connect(serverIpEndPoint); NetworkStream stream = client.GetStream(); var protocolCommunication = new ProtocolCommunication(stream); IPageNavigation navigation = new PageNavigation(protocolCommunication); navigation.GoToPage(IPageNavigation.LandingPage); while (navigation.Top() != null) { ConsoleHelper.Clear(); await navigation.Top().RenderAsync(); } await protocolCommunication.SendRequestAsync(new LogoutRequest()); }
public PhotoDetailsPage( PageNavigation navigation, IDictionary <string, string> parameters ) { _navigation = navigation; parameters.TryGetValue("username", out _username); if (_username == null) { throw new Exception("Parameter \"username\" required"); } parameters.TryGetValue("photoName", out _photoName); if (_photoName == null) { throw new Exception("Parameter \"photoName\" required"); } _menu = new Menu( options: new List <(string, string)> { (ShowCommentsAction, "Show comments"), (CommentAction, "Comment photo") },
public UserListPage( PageNavigation navigation, IProtocolCommunication protocolCommunication ) { _navigation = navigation; _protocolCommunication = protocolCommunication; }
public void InititializeConfig(string browserName, string deviceName = "", bool realDevice = false) { Configurations.browserName = browserName; Configurations.deviceName = deviceName; Configurations.realDevice = realDevice; TestName = DriverManager.Instance.TestName; SuperUser = Configurations.userName; SuperPassword = Configurations.passWord; Page = UIAutomation.Page; }
private async Task OnProductDetails(Product product) { if (product == null) { return; } await PageNavigation.NavigateToAsync <ProductDetailsViewModel>(product); SelectedProduct = null; }
public void ZoomBy(int delta, Point relativeTo) { double ticks = delta / 120.0; Point adjust = relativeTo; double scaleStart = PageNavigation.Scale; PageNavigation.ZoomBy(ticks / 3.0); double scaleEnd = PageNavigation.Scale; double scalar = 1 / scaleEnd - 1 / scaleStart; PageNavigation.PanBy(new Point(adjust.X * scalar, adjust.Y * scalar)); }
public StandardPageMetadataRepository( PageMetadataSettings settings ) { _map = GenerateListOfPageMetadata( settings ); _nav = BuildPageNavigation( _map ); }
private async Task OnCategorySelectionAsync(Category category) { if (category == null) { return; } await PageNavigation.NavigateToAsync <ProductsViewModel>(category); SelectedCategory = null; }
public string GetGrid(PageNavigation pageNavigation) { using (DodoBirdEntities Db = new DodoBirdEntities()) { var gridSchema = DataService.GetGridSchema(pageNavigation.GridId); var tableSchema = DataService.GetTableSchema(gridSchema.AppDatabaseId, gridSchema.TableName); Db.Database.Connection.ConnectionString = SessionService.GetConnectionString(gridSchema.AppDatabaseId); StringBuilder sbRecords = new StringBuilder(); var selectColumns = ""; // Standard grid if (gridSchema.GridType == 0) { selectColumns = GetStandardGridSelect(gridSchema, tableSchema, ref pageNavigation); } else { selectColumns = GetCustomGridSelect(gridSchema, tableSchema, ref pageNavigation); } // set select statement get page of records in json format var selectStatment = "SELECT " + selectColumns + " FROM " + tableSchema.Owner + "." + tableSchema.TableName + " ORDER BY " + pageNavigation.OrderByColumn + " " + pageNavigation.SortDirection; // set paging in json format var numOfRecordsOnPage = 15; var offSet = " OFFSET " + ((pageNavigation.CurrentPage - 1) * numOfRecordsOnPage) + " ROWS "; var fetch = " FETCH NEXT " + numOfRecordsOnPage + " ROWS ONLY "; var exe = selectStatment + " " + offSet + fetch + " FOR JSON AUTO, INCLUDE_NULL_VALUES"; // loop for records var recs = Db.Database.SqlQuery <string>(exe).ToList(); foreach (var rec in recs) { sbRecords.Append(rec); } // get total count var exeCount = "SELECT COUNT(1) FROM " + tableSchema.Owner + "." + tableSchema.TableName; var recordCount = Db.Database.SqlQuery <int>(exeCount).FirstOrDefault(); var numOfPages = 0; if (recordCount > 0) { double totalPage_ = Convert.ToDouble(recordCount) / Convert.ToDouble(numOfRecordsOnPage); numOfPages = (int)Math.Ceiling(totalPage_); } return("{ \"imgSrc\" : \"\", \"RecordCount\" : " + recordCount + ", \"NumOfPages\" : " + numOfPages + ", \"OrderByColumn\" : \"" + pageNavigation.OrderByColumn + "\", \"SortDirection\" : \"" + pageNavigation.SortDirection + "\", \"Records\" : " + sbRecords.ToString() + " }"); } }
/// <summary> /// MainViewModel class constructor. /// </summary> /// <param name="properties">View model instance properties.</param> /// <param name="pageNavigation">Page navigation object.</param> public MainViewModel(IDictionary <string, object> properties, PageNavigation pageMavigation) { _properties = properties; AppPageNavigation = pageMavigation; GetStartedCommand = new Command(ExecuteGetStartedCommand); ToggleMeasurementCommand = new Command(ExecuteToggleMeasurementCommand); ShowSettingsCommand = new Command(ExecuteShowSettingsCommand, CanExecuteShowSettingsCommand); UpdateHeartRateLimitCommand = new Command(ExecuteUpdateHeartRateLimitCommand); PrivilegeDeniedConfirmedCommand = new Command(ExecutePrivilegeDeniedConfirmed); NotSupportedConfirmedCommand = new Command(ExecuteNotSupportedConfirmedCommand); }
/// <summary> /// CameraViewModel class constructor. /// </summary> /// <param name="pageNavigation">Instance of the PageNavigation class.</param> public CameraViewModel(PageNavigation pageNavigation) { _pageNavigation = pageNavigation; NavigateToPreviewPageCommand = new Command(ExecuteNavigateToPreviewPageCommand); StartCountdownCommand = new Command(ExecuteStartCountdownCommand); DeletePhotoCommand = new Command(ExecuteDeletePhotoCommand); CancelDeletePhotoCommand = new Command(ExecuteCancelDeletePhotoCommand); ConfirmDeletePhotoCommand = new Command(ExecuteConfirmDeletePhotoCommand); BackToPreviousPageCommand = new Command(ExecuteBackToPreviousPageCommand); _cameraModel = new CameraModel(); _cameraModel.CameraServicePhotoTaken += OnPhotoTaken; }
/// /// ------------------------------------------------------------------------------------------------ /// Name Cancel /// ------------------------------------------------------------------------------------------------ /// /// <summary> Set selected Action in property model to null /// Back to previous page /// </summary> /// ------------------------------------------------------------------------------------------------ /// private void Cancel() { try { //await SplitView.Instace().Navigation.PopModalAsync(); PageNavigation.PopMainPage(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); LogTracking.LogTrace(ex.ToString()); } }
/// ------------------------------------------------------------------------------------------------ /// Name CancelClick /// /// <summary> Executed when the cancel button is clicked. /// </summary> /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ private async Task CancelClick(object sender, EventArgs e) { try { Lbl_Cancel.IsVisible = Lbl_Cancel.IsEnabled = Boxvw_Cancel.IsVisible = Boxvw_Cancel.IsEnabled = false; PageNavigation.PopMainPage(); //Application.Current.MainPage = SplitView.VisitActionsInstace; } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
public List <PageNavigation> GetNavigation() { if (!File.Exists(navigationFile)) { StreamWriter sw = null; try { sw = new StreamWriter(navigationFile); var page = new PageNavigation { Id = 1, ParentId = null, Title = "Home", DateCreated = DateTime.Now, DateModified = DateTime.Now, Active = true }; var pages = new List <PageNavigation> { page }; var serializer = new JavaScriptSerializer(); var str = serializer.Serialize(pages); sw.Write(str); sw.Flush(); } finally { sw.Close(); sw.Dispose(); sw = null; } } PageNavigation[] navigation = null; StreamReader sr = null; try { sr = new StreamReader(navigationFile); var str = sr.ReadToEnd(); var serializer = new JavaScriptSerializer(); navigation = serializer.Deserialize <PageNavigation[]>(str); } finally { sr.Close(); sr.Dispose(); sr = null; } return(navigation.ToList()); }
/// ------------------------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------------------------ #region Public Functions /// ------------------------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------------------------ /// Name LoadActionForm /// ------------------------------------------------------------------------------------------------ /// <summary> /// Sets the selected action and displays the actions edit form. /// </summary> /// <param name="selectedAction">Selected action.</param> /// /// ------------------------------------------------------------------------------------------------ /// public async Task LoadActionsForm(SelectedAction selectedAction) { try { AppData.PropertyModel.SelectedAction = selectedAction; // Create the action edit view with a dismiss action // await Navigation.PushModalAsync(new VisitActionDetailsPage()); PageNavigation.PushMainPage(new VisitActionDetailsPage()); } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
/// <summary> /// Portable application part constructor method. The root page of application (creating MainPage object). /// </summary> public App() { PageNavigation pageNavigation = new PageNavigation(); if (DependencyService.Get <IPrivilegeService>().AllPermissionsGranted()) { AppMediaContentViewModel = new MediaContentViewModel(pageNavigation); pageNavigation.CreateMainPage(); } else { pageNavigation.NavigateToPrivilegeDeniedPage(); } }
/// <summary> /// The application constructor. /// Checks camera privileges. Shows pop-up if permissions are not granted. /// Sets application main page and view model. /// </summary> public Camera() { InitializeComponent(); PageNavigation pageNavigation = new PageNavigation(); if (!DependencyService.Get <IPrivilegeService>().AllPermissionsGranted()) { pageNavigation.NavigateToPrivilegeDeniedPage(); } else { AppMainViewModel = new CameraViewModel(pageNavigation); pageNavigation.CreateMainPage(); } }
public PhotoListPage( PageNavigation navigation, IDictionary <string, string> parameters, IProtocolCommunication protocolCommunication ) { _navigation = navigation; _protocolCommunication = protocolCommunication; parameters.TryGetValue("username", out _username); if (_username == null) { throw new Exception("Parameter \"username\" required"); } }
/// ------------------------------------------------------------------------------------------------ /// ------------------------------------------------------------------------------------------------ #region Private functions /// <summary> /// Item tapped in visits list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void ActionsItemTapped(object sender, ItemTappedEventArgs e) { try { if (_isExecute) { _isExecute = false; PopupContent.DismisPopup(); var items = (GroupedListModel)e.Item; SRiRecordMeta record; record = AppData.PropertyModel.SelectedRecord.Record; var entityKey = Guid.NewGuid().ToString(); AppData.PropertyModel.SelectedVisit = new SelectedVisit(new SRiVisitMeta() { Organisation = record.Organisation, EntityMeta = new SRiEntityMeta("entitykey", entityKey), Received = "2", ID = entityKey, Version = "", Visit = new SRiVisit() { EntityKey = entityKey, KeyVal = OnSiteSettings.NewTempKey, UVersion = "", InspectionKeyVal = record.Record.Inspections[0].KeyVal, MDKeyVal = record.Record.Inspections[0].MdKeyVal, MDSubSys = record.Record.Inspections[0].MdSubSys, IdoxID = AppData.MainModel.CurrentUser.IdoxId, RecordEntityKey = record.Record.EntityKey, VisitType = items.Code, //Officer= AppData.MainModel.Environment!=OnSiteEnvironments.Sales? AppData.MainModel.CurrentUser.OfficerCode(record.Organisation):"Demo", } }, AppData.PropertyModel.SelectedRecord.NewVisitMapping(0), true); AppData.PropertyModel.SelectedVisit.Visit.EntityMeta.StringFields.Add("str_idoxid", AppData.MainModel.CurrentUser.IdoxId); AppData.PropertyModel.SelectedVisit.Visit.Visit.Status = SyncStatus.New; //await SplitView.Instace().Navigation.PushModalAsync(new VisitActionPage(),true); //App.Current.MainPage = new VisitActionPage(); PageNavigation.PushMainPage(new VisitActionPage()); _isExecute = true; } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
/// <summary> /// MediaContentViewModel class constructor. /// </summary> /// <param name="pageNavigation">An instance of PageNavigation class.</param> public MediaContentViewModel(PageNavigation pageNavigation) { SelectedStorageItems = Enumerable.Empty <string>(); _databaseManager = new DatabaseManager(); _storageManager = new StorageManager(); AppPageNavigation = pageNavigation; FileInformationCommand = new Command(ShowFileInformation); UpdateFileItemsCommand = new Command <string>(UpdateFileItems, CanExecuteUpdateFileItems); _storageRootDirectories = new List <string>(); StorageItems = _storageManager.GetStorageItems(); foreach (var storage in StorageItems) { _storageRootDirectories.Add(storage.RootDirectory); } }
/// <summary> /// Displays the Lock screen if the app is idle. /// </summary> private void ShowLockScreen() { try { AppData.MainModel.CurrentUser.IsValidated = false; AppContext.AppContext.IsForLockScreen = true; AppContext.AppContext.LoginPage = new LoginPage(); if (Device.OS != TargetPlatform.iOS) { Application.Current.MainPage.Navigation.PushModalAsync(AppContext.AppContext.LoginPage); } else { PageNavigation.PushMainPage(AppContext.AppContext.LoginPage); } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
public async void NavigateApplication(PageNavigation page) { try { switch (page) { case PageNavigation.Profile: await Navigation.PushAsync(new Profile()); break; case PageNavigation.Settings: await Navigation.PushAsync(new Settings()); break; } } catch (Exception ex) { await PopupNavigation.Instance.PushAsync(new MessageBox(ex.StackTrace, MessageType.Regular, this), true); } }
/// /// ------------------------------------------------------------------------------------------------ /// Name ActionItemTapped /// ------------------------------------------------------------------------------------------------ /// /// <summary> Handles the event when action item is tapped /// </summary> /// ------------------------------------------------------------------------------------------------ /// private async void AddActionsItemTapped(object sender, ItemTappedEventArgs e) { try { if (_isExecute) { _isExecute = false; var selectedItem = ((VisitsActionData)e.Item); var selectedIndex = selectedItem.ActionIndex; AppData.PropertyModel.SelectedAction = new SelectedAction(AppData.PropertyModel.SelectedVisit.Visit.Visit.Actions[selectedIndex], AppData.PropertyModel.SelectedVisit.MappingForAction(selectedIndex), false); // await Navigation.PushModalAsync(new VisitActionDetailsPage(), true); //App.Current.MainPage = new VisitActionDetailsPage(); PageNavigation.PushMainPage(new VisitActionDetailsPage()); _isExecute = true; } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
/// ------------------------------------------------------------------------------------------------ /// Name SaveClick /// /// <summary> Executed when the save button is clicked. /// </summary> /// <remarks> /// </remarks> /// ------------------------------------------------------------------------------------------------ private async Task SaveClick(object sender, EventArgs e) { try { if (_isExecute) { Lbl_Save.IsVisible = Lbl_Save.IsEnabled = Boxvw_Save.IsEnabled = false; _isExecute = false; var sriAction = AppData.PropertyModel.SelectedAction.Action; if (Pkr_Status.IsVisible) { if (Pkr_Status.Items[Pkr_Status.SelectedIndex] == "Completed") { sriAction.ActualDateTime = Dtp_CompletedDate.Date + Tmp_CompletedDate.Time; } else { sriAction.ActualDate = null; } } else { sriAction.ActualDateTime = Dtp_CompletedDate.Date + Tmp_CompletedDate.Time; } sriAction.Hours = AppContext.AppContext.RevertHt(Pkr_TimeTakenHours.Items[Pkr_TimeTakenHours.SelectedIndex], Pkr_TimeTakenMinutes.Items[Pkr_TimeTakenMinutes.SelectedIndex]); if (Dtp_ScheduledDate.IsVisible || Tmp_ScheduledDate.IsVisible) { sriAction.DueDate = Dtp_ScheduledDate.Date + Tmp_ScheduledDate.Time; } var officeDetails = _groupedOffice?.SelectedValue?.Split('-'); if (officeDetails == null) { if (Lbl_Officer.Text != "Value") { var officerText = Lbl_Officer.Text?.Split('-'); if (officerText != null) { string officerCode = officerText[0].Remove(officerText[0].Length - 1); sriAction.Officer = officerCode; } } } else { var officer = officeDetails[0].Remove(officeDetails[0].Length - 1); sriAction.Officer = officer; } if (VisitActionDetailsViewCell.GroupedLegislation != null) { var legislationDetails = VisitActionDetailsViewCell.GroupedLegislation?.SelectedValue?.Split('-'); if (legislationDetails != null) { var legislation = legislationDetails[0].Remove(legislationDetails[0].Length - 1); sriAction.LegislationType = legislation; } } Exception error; AppData.PropertyModel.SaveAction(out error); // AppData.PropertyModel.SaveVisit(out error); if (error == null) { //await SplitView.Instace().Navigation.PopModalAsync(); PageNavigation.PopMainPage(); // Application.Current.MainPage = SplitView.VisitActionsInstace; AppContext.AppContext.RefreshList.Invoke(sender, e); } else { throw error; } _isExecute = true; Lbl_Save.IsVisible = Lbl_Save.IsEnabled = Boxvw_Save.IsEnabled = true; } } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }