public HamburgerBarPageEntryViewModel(ApplicationFrame frame, Type pageType, string title, FontFamily iconFontFamily, double iconFontSize, string icon) { Frame = frame; PageType = pageType; Title = title; Icon = icon; IconFontFamily = iconFontFamily; IconFontSize = iconFontSize; Frame.Navigated += Frame_Navigated; NavigateCommand = new RelayCommand(TryNavigate); }
public TransitMapPageViewModel(MemoryCache cache) { StopsClickedCommand = new WeakRelayCommand(StopsClickedCommand_Execute); NavigateToStopPageCommand = new RelayCommand(NavigateToStopPageCommand_Execute); CenterOnCurrentLocationCommand = new RelayCommand(CenterOnCurrentLocation_Execute); RefreshCommand = new RelayCommand(Refresh_Execute); SearchCommand = new RelayCommand(Search_Execute, obj => (obj?.ToString()?.Length ?? 0) > 4); GoToLocationCommand = new RelayCommand(GoToLocation_Execute); NavigatedToCommand = new RelayCommand(OnNavigatedTo); CancelRefreshCommand = new RelayCommand((obj) => { TokenSource.Cancel(); TokenSource = new CancellationTokenSource(); }); Cache = cache; SelectedStops.CollectionChanged += SelectedStops_CollectionChanged; NetworkManagerBase.Instance.NetworkTypeChanged += (s, e) => LoadFromSettings(); //*MemoryLeak*!!! Temporary LoadFromSettings(); }
public OuterFrameViewModel(App currentApp, ApplicationFrame frame) { CurrentApp = currentApp; GoBackCommand = new RelayCommand(obj => GoBack(), obj => Frame.CanGoBack || (Page != null && Page.CanGoBack)); ToggleMenuCommand = new RelayCommand(obj => IsMenuOpen = !IsMenuOpen); NavigateBackCommand = new RelayCommand(obj => Frame.GoBack(), obj => Frame.CanGoBack); NavigateForwardCommand = new RelayCommand(obj => Frame.GoForward(), obj => Frame.CanGoForward); Frame = frame; RegisterFrameEvents(); RefreshPage(); RefreshWindowWidth(); Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; var titleBar = Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar; titleBar.LayoutMetricsChanged += TitleBar_LayoutMetricsChanged; RightControlsInset = titleBar.SystemOverlayRightInset; CurrentApp.ContentWidthChanged += CurrentApp_ContentSizeChanged; //RefreshTitleElementSizes(); PageEntries.Add(new HamburgerBarPageEntryViewModel(Frame, typeof(TransitMapPage), "Map", new FontFamily("Segoe UI Symbol"), 20, "")); }
public ArrivalsControlInTransitPageViewModel() { ExpandCommand = new RelayCommand((obj) => { NumColsRequested += .5; SetSize(MapWidth, MapHeight); }, (obj) => IsExpandEnabled); CompressCommand = new RelayCommand((obj) => { do { NumColsRequested -= .5; } while (NumColsRequested >= MaxColsVisible && NumColsRequested > 1); SetSize(MapWidth, MapHeight); }, (obj) => IsCompressEnabled); CloseCommand = new RelayCommand((obj) => { Stop = null; SetVisibility(); Closed?.Invoke(this, EventArgs.Empty); }); }