コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: UIManager.cs プロジェクト: sthagen/pxWorks-MVP
        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);
            }
        }
コード例 #4
0
ファイル: UIManager.cs プロジェクト: sthagen/pxWorks-MVP
        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);
            }
        }
コード例 #5
0
 public void LoadScene(bool overrideAddToStack)
 {
     if (overrideAddToStack)
     {
         BackStack.Push(sceneManager.data.LoadScene);
     }
     sceneManager.LoadScene(this, mode);
 }
コード例 #6
0
 public void ClearHistory(int level)
 {
     ForwardStack.Clear();
     while (BackStack.Count > level)
     {
         BackStack.RemoveAt(level);
     }
 }
コード例 #7
0
        /// <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
        }
コード例 #8
0
ファイル: Game1.cs プロジェクト: JdGXII/EconoFight
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferHeight = 600;
            Content.RootDirectory = "Content";
			
			BackStack<string> bs = new BackStack<string>();
			bs.Current = string.Empty;
        }
コード例 #9
0
 public LocalFileExplorerViewModel(StorageFolder root, RootFolderType ftype, string id = null)
     : base(root.DisplayName, ftype)
 {
     BackStack.Add(new VLCStorageFolder(root));
     if (id != null)
     {
         Id = id;
     }
 }
コード例 #10
0
        //[IsKeepAlive() moved to NavigationService.IsContentKeepAlive()]

        internal void UpdateView()
        {
            BackStack.OnCollectionChanged();
            ForwardStack.OnCollectionChanged();
            if (_backForwardStateChange != null)
            {
                _backForwardStateChange(this, EventArgs.Empty);
            }
        }
コード例 #11
0
 public void GoTo(HelpItem item)
 {
     if (CurrentItem != null)
     {
         BackStack.Push(CurrentItem);
     }
     CurrentItem = item;
     OnStackChanged();
 }
コード例 #12
0
        public static void RemoveBackEntry(Type pageType)
        {
            IList <PageStackEntry> entries = BackStack.Where(entry => entry.SourcePageType == pageType).ToList();

            foreach (PageStackEntry entry in entries)
            {
                BackStack.Remove(entry);
            }
        }
コード例 #13
0
 private async Task GoBackAsync()
 {
     BackStack.Remove(CurrentItem);
     ForwardStack.Add(CurrentItem);
     if (BackStack.Count > 0)
     {
         CurrentItem = BackStack.Last();
     }
     await ReloadAsync();
 }
コード例 #14
0
 private async Task GoForwardAsync()
 {
     if (ForwardStack.Count > 0)
     {
         CurrentItem = ForwardStack.Last();
     }
     ForwardStack.Remove(CurrentItem);
     BackStack.Add(CurrentItem);
     await ReloadAsync();
 }
コード例 #15
0
        public static void NavigateTo(UserControl page)
        {
            if (Window.Current.Content != null)
            {
                BackStack.Add(Window.Current.Content);
            }

            Window.Current.Content = page;
            Window.Current.Activate();
        }
コード例 #16
0
        private void AddToBackStack(
            IViewModel viewModel,
            FrameworkElement content)
        {
            var origin = new NavigationStackEntry(
                viewModel,
                content);

            BackStack.Add(origin);
        }
コード例 #17
0
ファイル: Frame.cs プロジェクト: mohaider/Uno
        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;
        }
コード例 #18
0
ファイル: UIManager.cs プロジェクト: sthagen/pxWorks-MVP
#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();
        }
コード例 #19
0
 public void GoForward()
 {
     if (CurrentItem != null)
     {
         BackStack.Push(CurrentItem);
     }
     if (ForwardStack.Count > 0)
     {
         CurrentItem = ForwardStack.Pop();
     }
     OnStackChanged();
 }
コード例 #20
0
        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;
        }
コード例 #21
0
        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;
            }
        }
コード例 #22
0
        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();
        }
コード例 #23
0
ファイル: Game1.cs プロジェクト: Zephyr6/StackTracer2
        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
        }
コード例 #24
0
        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()}");
            }
        }
コード例 #25
0
        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;
                });
            }
        }
コード例 #26
0
        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();
            }
        }
コード例 #27
0
        public void LoadScene()
        {
            if (sceneManager.data.addToStack)
            {
                BackStack.Push(sceneManager.data.LoadScene);
            }

            if (loadingScreen)
            {
                sceneManager.LoadWithSceneLoader(this);
            }
            else
            {
                sceneManager.LoadScene(this, mode);
            }
        }
コード例 #28
0
        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
        }
コード例 #29
0
        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));
            }
        }
コード例 #30
0
ファイル: Frame.cs プロジェクト: mohaider/Uno
        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);
            }
        }
コード例 #31
0
ファイル: Frame.cs プロジェクト: x86/uno
        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);
        }
コード例 #32
0
ファイル: CustomFrame.cs プロジェクト: suwakowww/CodeHub
 /// <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);
 }