Esempio n. 1
0
 public BlankPage2()
 {
     curr                      = this;
     constants                 = new Constants();
     drequest                  = new DisplayRequest();
     dtimer                    = new DispatcherTimer();
     volumetimer               = new DispatcherTimer();
     volumeminustimer          = new DispatcherTimer();
     volumeminustimer.Tick    += volumeminustimer_Tick;
     forwardtimer              = new DispatcherTimer();
     forwardtimer.Tick        += forwardtimer_Tick;
     backwardtimer             = new DispatcherTimer();
     backwardtimer.Tick       += backwardtimer_Tick;
     volumetimer.Interval      = TimeSpan.FromSeconds(3);
     dtimer.Interval           = TimeSpan.FromMilliseconds(200);
     volumeminustimer.Interval = TimeSpan.FromSeconds(3);
     forwardtimer.Interval     = TimeSpan.FromSeconds(3);
     backwardtimer.Interval    = TimeSpan.FromSeconds(3);
     this.InitializeComponent();
     timer        = new DispatcherTimer();
     dtimer.Tick += dtimer_Tick;
     volume.Value = 50;
     Window.Current.SizeChanged       += Current_SizeChanged;
     Window.Current.VisibilityChanged += Current_VisibilityChanged;
 }
Esempio n. 2
0
        protected async override void OnFileActivated(FileActivatedEventArgs e)
        {
            Debug.WriteLine("In File Activated");
            int i = 0;

            StorageFile[] sfile = new StorageFile[e.Files.Count];
            music.Clear();
            playlist.Clear();
            List <StorageFile> video = new List <StorageFile>();

            if (e.Verb == "open")
            {
                if (e.Files.Count > 1)
                {
                    Constants.loadingtext = "Loading Files . . .";
                }
                else
                {
                    Constants.loadingtext = "Loading File . . .";
                }
                Constants.loadingactivated = true;
                foreach (IStorageItem sf in e.Files)
                {
                    if (ismediacenterextention((StorageFile)sf))
                    {
                        sfile[i] = (StorageFile)sf;
                        i++;
                    }
                }
                sortbyfileextention(sfile, ref music, ref video);
                foreach (StorageFile sf in sfile)
                {
                    if (isplaylist(sf))
                    {
                        try
                        {
                            playlist.Add(sf);
                        }
                        catch (Exception ex)
                        {
                            NotifyUser(ex);
                        }
                    }
                }

                if (!running)
                {
                    rootFrame = Window.Current.Content as Frame;
                    // Do not repeat app initialization when the Window already has content,
                    // just ensure that the window is active
                    if (rootFrame == null)
                    {
                        // Create a Frame to act as the navigation context and navigate to the first page
                        rootFrame = new Frame();
                        if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                        {
                            await SuspensionManager.RestoreAsync();
                        }
                        // Place the frame in the current Window
                        Window.Current.Content = rootFrame;
                    }
                    if (rootFrame.Content == null)
                    {
                        // When the navigation stack isn't restored navigate to the first page,
                        // configuring the new page by passing required information as a navigation
                        // parameter
                        if (!rootFrame.Navigate(typeof(MainPage)))
                        {
                            throw new Exception("Failed to create initial page");
                        }
                    }
                    // Ensure the current window is active
                    Window.Current.Activate();
                    running = true;
                }
                object[] mus = { playlist, music };
                if (music.Count > 0 || playlist.Count > 0)
                {
                    Constants.ismusicfileactivated = true;
                    if (FirstInstanceProperty.MusicPlayer.count > 0)
                    {
                        BlankPage1.RemoveHandles();
                    }
                    rootFrame.Navigate(typeof(BlankPage1), mus);
                }
                else
                if (video.Count > 0)
                {
                    Constants.isvideofileactivated = true;
                    if (FirstInstanceProperty.VideoPlayer.count > 0)
                    {
                        BlankPage2.RemoveHandles();
                    }
                    rootFrame.Navigate(typeof(BlankPage2), video);
                }
            }
        }