| @inject NavigationManager NavigationManager; | |||||
| @page "/caritas_services" | |||||
| @page "/caritas_services" | |||||
| <p>Caritas Dienste</p> | <p>Caritas Dienste</p> | ||||
| @code { | @code { | ||||
| protected override void OnInitialized() { | |||||
| NavigationManager.LocationChanged += LocationChanged; | |||||
| base.OnInitialized(); | |||||
| } | |||||
| public void Dispose() { | |||||
| NavigationManager.LocationChanged -= LocationChanged; | |||||
| } | |||||
| void LocationChanged(object sender, LocationChangedEventArgs e) { | |||||
| string navigationMethod = e.IsNavigationIntercepted ? "HTML" : "code"; | |||||
| System.Diagnostics.Debug.WriteLine($"Notified of navigation via {navigationMethod} to {e.Location}"); | |||||
| if (e.Location.Contains("caritas_services")) { | |||||
| } | |||||
| } | |||||
| } | } |
| @page "/counter" | @page "/counter" | ||||
| @inject NavigationManager NavigationManager | |||||
| <h1>Counter</h1> | <h1>Counter</h1> | ||||
| <p>Current count: @currentCount</p> | <p>Current count: @currentCount</p> | ||||
| @*<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>*@ | |||||
| <MatButton Raised="true" @onclick="IncrementCount">Click me!</MatButton> | |||||
| <MatList> | |||||
| <MatListItem> | |||||
| <MatButton Raised="true" @onclick="IncrementCount">Click me!</MatButton> | |||||
| </MatListItem> | |||||
| <MatListItem> | |||||
| <MatButton Raised="true" @onclick="ShowCaritasWebpage">Erfahre mehr!</MatButton> | |||||
| </MatListItem> | |||||
| </MatList> | |||||
| @code { | @code { | ||||
| private int currentCount = 0; | private int currentCount = 0; | ||||
| private void IncrementCount() | |||||
| { | |||||
| private void IncrementCount() { | |||||
| currentCount++; | currentCount++; | ||||
| } | } | ||||
| private void ShowCaritasWebpage() { | |||||
| NavigationManager.NavigateTo("http://www.caritas.ch"); | |||||
| } | |||||
| } | } | ||||
| @code { | @code { | ||||
| void ButtonClicked() { | void ButtonClicked() { | ||||
| NavigationManager.NavigateTo("caritas_services"); | |||||
| NavigationManager.NavigateTo("./caritas_services"); | |||||
| AppState.LoggedIn = true; | AppState.LoggedIn = true; | ||||
| } | } | ||||
| } | |||||
| @*<SurveyPrompt Title="How is Blazor working for you?" />*@ | |||||
| } |
| @inherits LayoutComponentBase | @inherits LayoutComponentBase | ||||
| <NavMenu /> | <NavMenu /> | ||||
| <div class="main vh-100"> | <div class="main vh-100"> | ||||
| <div class="content px-4 h-100"> | |||||
| @Body | |||||
| </div> | |||||
| <div class="content px-4 h-100"> | |||||
| @Body | |||||
| </div> | |||||
| </div> | </div> | ||||
| @inject NavigationManager NavigationManager; | @inject NavigationManager NavigationManager; | ||||
| @implements IDisposable; | @implements IDisposable; | ||||
| @if (AppState.LoggedIn) { | |||||
| @if (handleAppBarContainer()) { | |||||
| <div class="sidebar"> | <div class="sidebar"> | ||||
| <MatAppBarContainer> | <MatAppBarContainer> | ||||
| <MatAppBar Fixed="true"> | <MatAppBar Fixed="true"> | ||||
| { | { | ||||
| bool Opened = false; | bool Opened = false; | ||||
| int Index = 1; | |||||
| static int Index = 1; | |||||
| void ButtonClicked() { | void ButtonClicked() { | ||||
| Opened = !Opened; | Opened = !Opened; | ||||
| System.Diagnostics.Debug.WriteLine($"Notified of navigation via {navigationMethod} to {e.Location}"); | System.Diagnostics.Debug.WriteLine($"Notified of navigation via {navigationMethod} to {e.Location}"); | ||||
| if (e.Location.Contains("caritas_services")) { | if (e.Location.Contains("caritas_services")) { | ||||
| Index = 1; | Index = 1; | ||||
| } else if(e.Location.Contains("counter")) { | |||||
| Index = 2; | |||||
| } else if (e.Location.Contains("fetchdata")) { | |||||
| Index = 3; | |||||
| } else { | |||||
| Index = 4; | |||||
| } | } | ||||
| } | } | ||||
| bool handleAppBarContainer() { | |||||
| string uri = NavigationManager.Uri; | |||||
| string baseUri = NavigationManager.BaseUri; | |||||
| string delta = uri.Replace(baseUri, ""); | |||||
| if (delta == null || delta.Equals("")) { | |||||
| Index = 4; | |||||
| return false; | |||||
| } else { | |||||
| if (delta.Equals("caritas_services")) { | |||||
| Index = 1; | |||||
| } else if (delta.Equals("counter")) { | |||||
| Index = 2; | |||||
| } else if (delta.Equals("fetchdata")) { | |||||
| Index = 3; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | } |
| "theme_color": "#db001b", | "theme_color": "#db001b", | ||||
| "orientation": "portrait-primary", | "orientation": "portrait-primary", | ||||
| "icons": [ | "icons": [ | ||||
| { | |||||
| "src": "icon-48.png", | |||||
| "type": "image/png", | |||||
| "sizes": "48x48" | |||||
| }, | |||||
| { | |||||
| "src": "icon-72.png", | |||||
| "type": "image/png", | |||||
| "sizes": "72x72" | |||||
| }, | |||||
| { | |||||
| "src": "icon-96.png", | |||||
| "type": "image/png", | |||||
| "sizes": "96x96" | |||||
| }, | |||||
| { | |||||
| "src": "icon-120.png", | |||||
| "type": "image/png", | |||||
| "sizes": "120x120" | |||||
| }, | |||||
| { | |||||
| "src": "icon-144.png", | |||||
| "type": "image/png", | |||||
| "sizes": "144x144" | |||||
| }, | |||||
| { | |||||
| "src": "icon-192.png", | |||||
| "type": "image/png", | |||||
| "sizes": "192x192" | |||||
| }, | |||||
| { | { | ||||
| "src": "icon-512.png", | "src": "icon-512.png", | ||||
| "type": "image/png", | "type": "image/png", |