public override async Task NavigateTo(IVLCStorageItem storageItem) { var item = storageItem as VLCStorageFolder; if (item != null) { BackStack.Add(item); var _ = Task.Run(async() => await GetFiles()); } else { var vlcFile = storageItem as VLCStorageFile; if (vlcFile == null) { return; } var file = vlcFile.StorageItem as StorageFile; if (VLCFileExtensions.AudioExtensions.Contains(file.FileType)) { await Locator.MediaPlaybackViewModel.PlayAudioFile(file); } else if (VLCFileExtensions.VideoExtensions.Contains(file.FileType)) { await Locator.MediaPlaybackViewModel.PlayVideoFile(file); } } OnPropertyChanged(nameof(CurrentFolderName)); }
public bool TryGoBack() { if (!CanGoBack) { return(false); } var destination = BackStack.LastOrDefault(); if (destination == null) { return(false); } BackStack.Remove(destination); AddToForwardStack( CurrentViewModel, CurrentContent); SetCurrent( destination.ViewModel, destination.Content); return(true); }
private static void CloseNoAnimation(BaseView view) { if (view.VisibleState != VisibleState.Closed) { //close children foreach (var child in view.OpenedChildren.ToArray()) { CloseNoAnimation(child); } //remove from back stack while (BackStack.Remove(view)) { ; } //close try { view.gameObject.SetActive(false); OnViewClosed(view); if (Instance.DestroyDynamicViews && view.IsDynamicallyCreated) { GameObject.Destroy(view.gameObject); } } catch { // object destroyed? } //remove from owner list view.Owner?.OpenedChildren.Remove(view); } }
private static void AddToBackStack(BaseView view) { //remove if presented while (BackStack.Remove(view)) { ; } //add to end if (BackStack.Count == 0) { BackStack.AddLast(view); return; } //find by priority var node = BackStack.Last; while (node != null && node.Value.BackPrority > view.BackPrority) { node = node.Previous; } if (node == null) { BackStack.AddFirst(view); return; } else { BackStack.AddAfter(node, view); } }
public void LoadScene(bool overrideAddToStack) { if (overrideAddToStack) { BackStack.Push(sceneManager.data.LoadScene); } sceneManager.LoadScene(this, mode); }
public void ClearHistory(int level) { ForwardStack.Clear(); while (BackStack.Count > level) { BackStack.RemoveAt(level); } }
/// <summary>Do all state activation work here</summary> private static void OnStateActivating() { #if !MONODROID && !FRB_MDX && !SILVERLIGHT mBackStack = StateManager.Current.Get <BackStack <StackItem?> >("backstack"); ShouldActivateScreen = true; #endif }
public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferHeight = 600; Content.RootDirectory = "Content"; BackStack<string> bs = new BackStack<string>(); bs.Current = string.Empty; }
public LocalFileExplorerViewModel(StorageFolder root, RootFolderType ftype, string id = null) : base(root.DisplayName, ftype) { BackStack.Add(new VLCStorageFolder(root)); if (id != null) { Id = id; } }
//[IsKeepAlive() moved to NavigationService.IsContentKeepAlive()] internal void UpdateView() { BackStack.OnCollectionChanged(); ForwardStack.OnCollectionChanged(); if (_backForwardStateChange != null) { _backForwardStateChange(this, EventArgs.Empty); } }
public void GoTo(HelpItem item) { if (CurrentItem != null) { BackStack.Push(CurrentItem); } CurrentItem = item; OnStackChanged(); }
public static void RemoveBackEntry(Type pageType) { IList <PageStackEntry> entries = BackStack.Where(entry => entry.SourcePageType == pageType).ToList(); foreach (PageStackEntry entry in entries) { BackStack.Remove(entry); } }
private async Task GoBackAsync() { BackStack.Remove(CurrentItem); ForwardStack.Add(CurrentItem); if (BackStack.Count > 0) { CurrentItem = BackStack.Last(); } await ReloadAsync(); }
private async Task GoForwardAsync() { if (ForwardStack.Count > 0) { CurrentItem = ForwardStack.Last(); } ForwardStack.Remove(CurrentItem); BackStack.Add(CurrentItem); await ReloadAsync(); }
public static void NavigateTo(UserControl page) { if (Window.Current.Content != null) { BackStack.Add(Window.Current.Content); } Window.Current.Content = page; Window.Current.Activate(); }
private void AddToBackStack( IViewModel viewModel, FrameworkElement content) { var origin = new NavigationStackEntry( viewModel, content); BackStack.Add(origin); }
public Frame() { var backStack = new ObservableCollection <PageStackEntry>(); var forwardStack = new ObservableCollection <PageStackEntry>(); backStack.CollectionChanged += (s, e) => CanGoBack = BackStack.Any(); forwardStack.CollectionChanged += (s, e) => CanGoForward = ForwardStack.Any(); BackStack = backStack; ForwardStack = forwardStack; }
#pragma warning restore 0649 void Awake() { Instance = this; //get my components audioSource = GetComponent <AudioSource>(); //clear static lists StaticViews.Clear(); BackStack.Clear(); FullScreenFadeStack.Clear(); //init other objects dragger = new Dragger(); soundsManager = new SoundsManager(BackgroundSoundPrefab, FadeVolume, VolumeChangeSpeed); //find all views var views = SceneInfoGrabber <BaseView> .GetUIComponentsOnScene(scene : gameObject.scene); //grab components for views foreach (var view in views) { view.GrabComponents(); StaticViews[view.GetType().Name] = view; } //grab views for views foreach (var view in views) { view.GrabViews(StaticViews); } //init views foreach (var view in views) { view.Init(); } //subscribe views foreach (var view in views) { view.AutoSubscribe(); } //show views foreach (var view in views.Where(v => v.ShowAtStart)) { Show(view, null, noAnimation: true); } //init gestures InitGestures(); }
public void GoForward() { if (CurrentItem != null) { BackStack.Push(CurrentItem); } if (ForwardStack.Count > 0) { CurrentItem = ForwardStack.Pop(); } OnStackChanged(); }
private void NavigateToViewModel(object viewModel, object parameter) { _viewModel = viewModel; var viewType = ViewLocator.LocateTypeForModelType(_viewModel.GetType(), null, null); BackStack.Clear(); base.Navigate(viewType, parameter); _viewModel = null; }
public VLCFileExplorerViewModel(Media media, RootFolderType ftype) : base(media.meta(MediaMeta.Title), ftype) { BackStack.Add(new VLCStorageFolder(media)); var mrl = media.mrl(); var schemeEnd = mrl.IndexOf("://"); if (schemeEnd > -1) { var scheme = mrl.Substring(0, schemeEnd); base.RootMediaType = scheme; } }
private async void BtnForward_Click(object sender, RoutedEventArgs e) { var item = ForwardStack.Pop(); if (ForwardStack.Count == 0) { IsbtnForwardEnabled = false; } BackStack.Push(LastSearch); IsbtnBackEnabled = true; tbID.Text = item; await StartFinding(); }
public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferHeight = 600; Content.RootDirectory = "Content"; BackStack<string> bs = new BackStack<string>(); bs.Current = string.Empty; #if WINDOWS_PHONE // Frame rate is 30 fps by default for Windows Phone. TargetElapsedTime = TimeSpan.FromTicks(333333); graphics.IsFullScreen = true; #endif }
public override async Task GetFiles() { try { await DispatchHelper.InvokeInUIThread(CoreDispatcherPriority.Normal, () => { StorageItems.Clear(); IsFolderEmpty = false; IsLoadingFiles = true; }); var currentMedia = BackStack.Last().Media; if (currentMedia == null) { return; } var mediaList = await Locator.MediaLibrary.DiscoverMediaList(currentMedia); for (int i = 0; i < mediaList.count(); i++) { var media = mediaList.itemAtIndex(i); IVLCStorageItem storageItem = null; if (media.type() == MediaType.Directory) { storageItem = new VLCStorageFolder(media); } else if (media.type() == MediaType.File) { storageItem = new VLCStorageFile(media); } if (storageItem == null) { return; } await DispatchHelper.InvokeInUIThread(CoreDispatcherPriority.Normal, () => StorageItems.Add(storageItem)); } await DispatchHelper.InvokeInUIThread(CoreDispatcherPriority.Low, () => { OnPropertyChanged(nameof(StorageItems)); IsFolderEmpty = !StorageItems.Any(); IsLoadingFiles = false; }); } catch (Exception e) { Debug.WriteLine($"Exception when getting network files {e.ToString()}"); } }
public override async Task GetFiles() { try { await DispatchHelper.InvokeAsync(CoreDispatcherPriority.Normal, () => { StorageItems.Clear(); IsFolderEmpty = false; IsLoadingFiles = true; }); IReadOnlyList <IStorageItem> items = null; var queryOptions = new QueryOptions(CommonFileQuery.DefaultQuery, VLCFileExtensions.Supported); var fileQuery = (BackStack.Last().StorageItem as StorageFolder).CreateItemQueryWithOptions(queryOptions); items = await fileQuery.GetItemsAsync(); var vlcItems = new ObservableCollection <IVLCStorageItem>(); foreach (var storageItem in items) { if (storageItem.IsOfType(StorageItemTypes.File)) { var file = new VLCStorageFile(storageItem as StorageFile); vlcItems.Add(file); } else if (storageItem.IsOfType(StorageItemTypes.Folder)) { var folder = new VLCStorageFolder(storageItem as StorageFolder); vlcItems.Add(folder); } } await DispatchHelper.InvokeAsync(CoreDispatcherPriority.Low, () => { StorageItems = new ObservableCollection <IVLCStorageItem>(vlcItems); OnPropertyChanged(nameof(StorageItems)); IsFolderEmpty = !StorageItems.Any(); IsLoadingFiles = false; }); } catch (Exception exception) { LogHelper.Log("Failed to index folders and files in " + BackStack.Last().Name + "\n" + exception.ToString()); await DispatchHelper.InvokeAsync(CoreDispatcherPriority.Low, () => { IsFolderEmpty = !StorageItems.Any(); IsLoadingFiles = false; }); } }
public async Task ActiveStartFinding() { var id = tbID.Text; if (!string.IsNullOrWhiteSpace(id) && !IsRunning) { if (LastSearch != null) { BackStack.Push(LastSearch); ForwardStack.Clear(); IsbtnBackEnabled = true; IsbtnForwardEnabled = false; } await StartFinding(); } }
public void LoadScene() { if (sceneManager.data.addToStack) { BackStack.Push(sceneManager.data.LoadScene); } if (loadingScreen) { sceneManager.LoadWithSceneLoader(this); } else { sceneManager.LoadScene(this, mode); } }
public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferHeight = 600; Content.RootDirectory = "Content"; BackStack <string> bs = new BackStack <string>(); bs.Current = string.Empty; #if WINDOWS_PHONE // Frame rate is 30 fps by default for Windows Phone. TargetElapsedTime = TimeSpan.FromTicks(333333); graphics.IsFullScreen = true; #endif }
public void Resume(Stream stream, Navigator navigator) { var deserializer = new DataContractJsonSerializer(typeof(FrameStack), new DataContractJsonSerializerSettings()); var stack = (FrameStack)deserializer.ReadObject(stream); navigator.ToUrl(stack.Current); foreach (var item in stack.Back) { BackStack.Add(new PageStackEntry(typeof(MainPage), item, null)); } foreach (var item in stack.Forward) { ForwardStack.Add(new PageStackEntry(typeof(MainPage), item, null)); } }
public void GoBack(NavigationTransitionInfo transitionInfoOverride) { if (CanGoBack) { var entry = BackStack.Last(); if (transitionInfoOverride != null) { entry.NavigationTransitionInfo = transitionInfoOverride; } else { // Fallback to the page forward navigation transition info entry.NavigationTransitionInfo = CurrentEntry.NavigationTransitionInfo; } InnerNavigate(entry, NavigationMode.Back); } }
public Frame() { var backStack = new ObservableCollection <PageStackEntry>(); var forwardStack = new ObservableCollection <PageStackEntry>(); backStack.CollectionChanged += (s, e) => { CanGoBack = BackStack.Any(); BackStackDepth = BackStack.Count; }; forwardStack.CollectionChanged += (s, e) => CanGoForward = ForwardStack.Any(); BackStack = backStack; ForwardStack = forwardStack; DefaultStyleKey = typeof(Frame); }
/// <summary> /// Clears the Frame content and its navigation stack without any animation /// </summary> public void ResetFrame() { BackStack.Clear(); if (Content != null) { try { // This call causes the current page to execute the OnNavigatedFrom method GetNavigationState(); } catch { // Doesn't matter } } Content = null; EmptyContentStateChanged?.Invoke(this, true); }