private void Order_OrderViewRequested(object sender, Order e) { if (sender is IViewModel viewModel) { RequestNavigation?.Invoke(this, new AppNavigationEventArgs(viewModel)); } }
/// <summary> /// This is used to navigate to the Order Processing View /// </summary> private void NewOrder_OrderViewRequested(object sender, Order e) { //Get the view model associated with this order var orderViewModel = NewOrders.FirstOrDefault(m => m.Order.OrderId == e.OrderId); //Unsubscribe from the event & remove the view model from new orders if (orderViewModel != null) { orderViewModel.OrderViewRequested -= NewOrder_OrderViewRequested; NewOrders.Remove(orderViewModel); } //Navigate to the Order Ready to Process and pass this Order RequestNavigation?.Invoke(this, new AppNavigationEventArgs(new OrderReadyToProccessViewModel(_physicalStoreId, e))); }
/// <summary> /// Occurs when login page is done /// Sets basic Configuration for the Flipdish API and navigates to the Stores View /// </summary> private void _login_Done(object sender, AuthorizeResponse e) { //Set default API configuration base path Configuration.Default.BasePath = AppSettings.Settings.Endpoint; Configuration.Default.AccessToken = e.AccessToken; //In order to make the calls to the API we need to have a Bearer token associated with our request. //This creates or sets the bearer token required to get a reply from our API. if (Configuration.Default.DefaultHeader.ContainsKey("Authorization")) { Configuration.Default.DefaultHeader["Authorization"] = $"Bearer {e.AccessToken}"; } else { Configuration.Default.DefaultHeader.Add("Authorization", $"Bearer {e.AccessToken}"); } RequestNavigation?.Invoke(this, new AppNavigationEventArgs(new StoresViewModel())); }
/// <summary> /// Navigates back to store selection /// </summary> /// <param name="obj"></param> private void ExecuteBackButton(object obj) { RequestNavigation?.Invoke(this, new AppNavigationEventArgs(new StoresViewModel())); }
/// <summary> /// Occurs when logout is succsesful /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OauthServiceOnLogoutDone(object sender, EventArgs e) { RequestNavigation?.Invoke(this, new AppNavigationEventArgs(new LoginViewModel())); }