public void PageStackDefault() { PageStack stack = new PageStack(); stack.RegisterDefaultRoute("home", () => new Page()); Assert.IsNull(stack.CurrentPage); stack.Navigate(""); Assert.IsNotNull(stack.CurrentPage); }
public AzureTableBrowserApp() { PageStack.RegisterDefaultRoute("accounts", () => new StorageAccountsPage()); PageStack.RegisterRoute("accounts/{account}", () => new ServicesPage()); PageStack.RegisterRoute("accounts/{account}/tables", () => new TablesPage()); PageStack.RegisterRoute("accounts/{account}/containers", () => new ContainersPage()); PageStack.RegisterRoute("accounts/{account}/tables/{table}", () => new TablePage()); PageStack.RegisterRoute("accounts/{account}/containers/{container}", () => new ContainerPage()); PageStack.Navigate("accounts"); }
public void PageStackBasic() { PageStack stack = new PageStack(); bool observableWorked = false; PropertyChangedEventHandler firstChecker = (sender, e) => { if (e.PropertyName != nameof(PageStack.CurrentPage)) { return; } Assert.IsNotNull(stack.CurrentPage); Assert.AreEqual(0, stack.CurrentPage.RouteVariables.Count); observableWorked = true; }; stack.PropertyChanged += firstChecker; stack.RegisterRoute("Home", () => new Page()); stack.Navigate("Home"); Assert.IsTrue(observableWorked); stack.PropertyChanged -= firstChecker; try { stack.Navigate("BadRoute"); Assert.Fail("An exception should have been thrown"); } catch (KeyNotFoundException) { } stack.RegisterRoute("Applications/{ApplicationId}/Components/{ComponentId}", () => new Page()); stack.Navigate("Applications/foo/Components/bar"); Assert.IsTrue(stack.CurrentPage.RouteVariables.Count == 2); Assert.AreEqual("foo", stack.CurrentPage.RouteVariables["ApplicationId"]); Assert.AreEqual("bar", stack.CurrentPage.RouteVariables["ComponentId"]); }
private void NavigateToContainer() { var containerName = (Grid.SelectedItem as ContainerRecord).Name; PageStack.Navigate("accounts/" + currentStorageAccount.Credentials.AccountName + "/containers/" + containerName); }
private void NavigateToStorageAccount() { var accountName = (Grid.SelectedItem as StorageAccountInfo).AccountName; PageStack.Navigate("accounts/" + accountName); }
private void NavigateToTable() { var tableName = (Grid.SelectedItem as CloudTable).Name; PageStack.Navigate("accounts/" + currentStorageAccount.Credentials.AccountName + "/tables/" + tableName); }