/// <summary> /// Set ShowAddActPage to custom settings ShowPanelAfterLeavePage /// </summary> /// <param name="pageState"></param> /// <param name="suspending"></param> /// <returns></returns> public override async Task OnNavigatedFromAsync(IDictionary <string, object> pageState, bool suspending) { //foreach (var Item in ShowSlaveActPage.ToList()) //{ // ShowSlaveActPage[Item.Key] = Services.SettingsServices.SettingsService.Instance.ShowPanelAfterLeavePage && Item.Value; //} if (!Services.SettingsServices.SettingsService.Instance.ShowPanelAfterLeavePage) { PivotPanes.Clear(); } await Task.CompletedTask; }
protected override void AddPane <TMessage>(string paneName, TMessage msg) { string header = ""; object content; switch (paneName) { case addPivotItemName: content = new AddItem(uiModule, typeof(ParkingAddViewModel), Messenger, modulePage); if (msg.GetType() == typeof(ItemAddNewMsg)) { header = "Add"; } else { header = "Edit"; } break; case detailPivotItemName: content = new DetailItem(uiModule, typeof(ParkingDetailViewModel), Messenger, modulePage); header = "Detail"; break; default: throw new NotImplementedException(); } try { if (PivotPanes.FirstOrDefault(x => x.Name == paneName) == null) { PivotPanes.Insert(0, new PivotItem() { Name = paneName, Header = header, Margin = new Thickness(0), Content = content }); } else { PivotPanes.FirstOrDefault(x => x.Name == paneName).Header = header; PivotPanes.FirstOrDefault(x => x.Name == paneName).Content = content; } } catch (Exception e) { PivotPanes.Clear(); PivotPanes.Insert(0, new PivotItem() { Name = paneName, Header = header, Content = content }); } finally { if (PivotPanes.FirstOrDefault(x => x.Name == paneName) != null) { //pivotPanes = PivotPanes; RaisePropertyChanged(nameof(PivotPanes)); PaneVisibility = true; double MinNormalWidth = (double)Application.Current.Resources["NormalMinWidth"]; if (MinNormalWidth > ApplicationView.GetForCurrentView().VisibleBounds.Width) { MasterFrame = new GridLength(0); } Messenger.Send(msg); } } }