コード例 #1
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            string taskId = taskInstance.InstanceId.ToString();

            MobileDebug.Service.SetIsBackground(taskId);
            MobileDebug.Service.WriteEventPair("Run", "task == null", task == null,
                                               "this.Hash", GetHashCode(), "PlayerHash", BackgroundMediaPlayer.Current.GetHashCode());

            deferral = taskInstance.GetDeferral();
            taskInstance.Canceled       += OnCanceled;
            taskInstance.Task.Completed += TaskCompleted;

            Unsubscribe(task);

            saveLoad = new AutoSaveLoad(completeFileName, backupFileName, simpleFileName);
            library  = await saveLoad.LoadSimple(false);

            lsh  = LibrarySubscriptionsHandler.GetInstance(library);
            smtc = SystemMediaTransportControls.GetForCurrentView();
            task = this;

            musicPlayer = new MusicPlayer(smtc, library);
            ringer      = new Ringer(this, library);

            await saveLoad.LoadComplete(library);

            saveLoad.Add(library);

            Subscribe(task);

            await BackgroundPlayer.SetCurrent();

            MobileDebug.Service.WriteEventPair("RunFinish", "This", GetHashCode(), "Lib", library.GetHashCode());
        }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: ShelbyBoss/FolderMusic
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            AutoSaveLoad asl     = new AutoSaveLoad(null, null, simpleFileName);
            ILibrary     library = await asl.LoadSimple(true);

            rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame           = new Frame();
                rootFrame.CacheSize = 1;
                rootFrame.Language  = Windows.Globalization.ApplicationLanguages.Languages[0];

                MobileDebug.Service.WriteEventPair("OnLaunched1", "PreviousExecutionState", e.PreviousExecutionState);
                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Zustand von zuvor angehaltener Anwendung laden
                    IEnumerable <HistoricFrame> frameHistory = await ReadHistoricFrames();

                    frameHistoryService = new FrameHistoryService(frameHistory, rootFrame, library);
                }
                else
                {
                    frameHistoryService = new FrameHistoryService(Enumerable.Empty <HistoricFrame>(), rootFrame, library);
                }

                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (Transition c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += this.RootFrame_FirstNavigated;

                if (!frameHistoryService.Restore() && !rootFrame.Navigate(typeof(MainPage), library))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            Window.Current.Activate();
            Window.Current.Activated += Window_Activated;
        }
コード例 #3
0
        private async void Library_Loaded(object sender, EventArgs args)
        {
            MobileDebug.Service.WriteEvent("MainPageLibLoaded");
            if (library.Playlists.Count > 0)
            {
                return;
            }

            StopOperationToken stopToken = new StopOperationToken();

            Frame.Navigate(typeof(LoadingPage), stopToken);
            await library.Reset(stopToken);

            Frame.GoBack();

            AutoSaveLoad.CheckLibrary(library, "ResetedOnLoaded");
        }
コード例 #4
0
 private void AbbTest1_Click(object sender, RoutedEventArgs e)
 {
     AutoSaveLoad.CheckLibrary(library, "Abb");
 }