public async Task <bool> EnterCompactOverlayAsync(double widthRequest = default(double), double heightRequest = default(double)) { if (!IsCompactOverlaySupported) { return(false); } Size desiredSize = new Size(widthRequest, heightRequest); ViewModePreferences compactOptions = ViewModePreferences.CreateDefault(ApplicationViewMode.CompactOverlay); if (desiredSize != default(Size)) { compactOptions.CustomSize = desiredSize; } bool modeSwitched = await ApplicationView.GetForCurrentView() .TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay, compactOptions); if (modeSwitched) { ViewModeChanged?.Invoke(ApplicationView.GetForCurrentView(), EventArgs.Empty); } return(modeSwitched); }
public void runViewingFactory() { view_factory = new ViewingViewModelFactory(); view_factory.runFactory(starting_factory, Part); ControlView = view_factory.getMainView(); ViewModeChanged?.Invoke(this, new ViewModeChangedEventArgs(ViewType.Viewing)); }
public async Task <bool> ExitCompactOverlayAsync() { if (!IsCompactOverlaySupported) { return(false); } SetLastWindowSize(); bool modeSwitched = await ApplicationView.GetForCurrentView() .TryEnterViewModeAsync(ApplicationViewMode.Default); if (modeSwitched) { ViewModeChanged?.Invoke(ApplicationView.GetForCurrentView(), EventArgs.Empty); } return(modeSwitched); }
private async void CompactOverlayModeButton_Click(object sender, RoutedEventArgs e) { var cancelEventArgs = new DeferrableCancelEventArgs(); var viewModeChanging = ViewModeChanging; if (viewModeChanging != null) { viewModeChanging(this, cancelEventArgs); await cancelEventArgs.WaitForDeferralsAsync(); } var applicationView = ApplicationView.GetForCurrentView(); if (cancelEventArgs.Cancel || await applicationView.TryEnterViewModeAsync( applicationView.ViewMode == ApplicationViewMode.CompactOverlay ? ApplicationViewMode.Default : ApplicationViewMode.CompactOverlay)) { if (!cancelEventArgs.Cancel) { ViewModeChanged?.Invoke(this, new RoutedEventArgs()); } UpdateCompactOverlayModeState(); Show(); StartTimer(); } }