Ejemplo n.º 1
0
 private void windowClosing(Object sender, CancelEventArgs e)
 {
     if (!closeReally)
     {
         e.Cancel        = true; //don't close as such
         this.Visibility = Visibility.Hidden;
     }
     if (heardWindow != null)
     {
         heardWindow.Close();
         heardWindow = null;
     }
     if (keyWindow != null)
     {
         keyWindow.Close();
         keyWindow = null;
     }
 }
Ejemplo n.º 2
0
 private void windowClosing(Object sender, CancelEventArgs e)
 {
     //e.Cancel = true;  //if you wanted to stop it
     if (updateTimer != null)
     {
         updateTimer.Stop();
     }
     if (wplayer != null)
     {
         wplayer.controls.stop();
         wplayer.close();
     }
     if (configWindow != null)
     {
         configWindow.closeReally = true;
     }
     configWindow.Close();
     if (keyWindow != null)
     {
         keyWindow.Close();
         keyWindow = null;
     }
 }
Ejemplo n.º 3
0
 void setKeys(Object obj, RoutedEventArgs e)
 {
     keyWindow = new keySelectWindow(keyAction);
     keyWindow.ShowDialog();
     keyWindow.Focus();
 }
Ejemplo n.º 4
0
        private void keyPressed(object sender, System.Windows.Input.KeyEventArgs e)
        {
            Console.WriteLine("Key pressed:" + e.Key.ToString());
            String act = keyAction.getAction(e.Key);

            if (stopAtNext && act != "Exit")  // exit from stopAtNext mode
            {
                stopAtNext = false;
                updateNext();
            }
            switch (act)
            {
            case "Exit":
                if (!stopAtNext)
                {
                    stopAtNext              = true;
                    nextMediaLbl.Content    = "Program will exit at end of this track (or press ESC again to exit now)";
                    nextMediaLbl.Foreground = Brushes.Orange;
                }
                else
                {
                    wplayer.controls.stop();
                    configWindow.Close();
                    this.Close();
                }
                break;

            case "Pause":
                togglePlay();
                break;

            case "Full Screen":
                fullScreen(this.WindowState == WindowState.Normal);
                break;

            case "Fast Forward":
                wplayer.controls.currentPosition += wplayer.currentMedia.duration / 10;
                wplayer.controls.play();
                break;

            case "Restart":
                wplayer.controls.currentPosition = 0;
                wplayer.controls.play();
                break;

            case "Next":
                recordPodsHeard(wplayer.currentMedia.sourceURL, "SKIPPED_AT=" + wplayer.controls.currentPosition.ToString("F0") + "Sec");
                wplayer.controls.next();
                podMode = false;
                break;

            case "Delete":
                if (podMode)      // currently listening to a podcast
                {
                    recordPodsHeard(wplayer.currentMedia.sourceURL, "DELETE");
                    wplayer.controls.next();
                }
                else      //listening to music
                {
                    // really need to add DELETE to previous line
                }
                break;

            case "Keep":
                markAsKeep = true;
                break;

            case "Configure":
                showConfig(null, null);
                break;

            case "Test Heard":      // just to test the heard function
                if (podMode)
                {
                    lastMediaHeard = true;
                    wplayer.controls.next();
                }
                break;

            case "Vol+":
                if (volume < 50)
                {
                    volume += 1;
                }
                else if (volume < 100)
                {
                    volume += 5;
                }
                wplayer.settings.volume = volume;
                volLbl.Content          = "Volume = " + volume;
                volLbl.Opacity          = 1.0;
                break;

            case "Vol-":
                if (volume > 50)
                {
                    volume -= 5;
                }
                else if (volume > 10)
                {
                    volume -= 1;
                }
                if (wplayer.settings.volume > volume)
                {
                    wplayer.settings.volume = volume;
                }
                volLbl.Content = "Volume = " + wplayer.settings.volume;
                volLbl.Opacity = 1.0;
                break;

            case "Help":
                String path = System.IO.Path.GetDirectoryName(
                    System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                String fid = System.IO.Path.Combine(path, "help.html");
                Process.Start(fid);
                break;

            case "HotKeys":
                keyWindow = new keySelectWindow(keyAction, false);
                keyWindow.ShowDialog();
                keyWindow.Focus();
                break;

            case "Print Keys":
                keyAction.printKeys();
                break;
            }
        }
Ejemplo n.º 5
0
 private void windowClosing(Object sender, CancelEventArgs e)
 {
     //e.Cancel = true;  //if you wanted to stop it
     if (updateTimer != null)
         updateTimer.Stop();
     if (wplayer != null)
     {
         wplayer.controls.stop();
         wplayer.close();
     }
     if (configWindow != null)
         configWindow.closeReally = true;
     configWindow.Close();
     if (keyWindow != null)
     {
         keyWindow.Close();
         keyWindow = null;
     }
 }
Ejemplo n.º 6
0
 private void keyPressed(object sender, System.Windows.Input.KeyEventArgs e)
 {
     Console.WriteLine("Key pressed:" + e.Key.ToString());
     String act = keyAction.getAction(e.Key);
     if (stopAtNext && act != "Exit")  // exit from stopAtNext mode
     {
         stopAtNext = false;
         updateNext();
     }
     switch (act)
     {
         case "Exit":
             if (!stopAtNext)
             {
                 stopAtNext = true;
                 nextMediaLbl.Content = "Program will exit at end of this track (or press ESC again to exit now)";
                 nextMediaLbl.Foreground = Brushes.Orange;
             }
             else
             {
                 wplayer.controls.stop();
                 configWindow.Close();
                 this.Close();
             }
             break;
         case "Pause":
             togglePlay();
             break;
         case "Full Screen":
             fullScreen(this.WindowState == WindowState.Normal);
             break;
         case "Fast Forward":
             wplayer.controls.currentPosition += wplayer.currentMedia.duration / 10;
             wplayer.controls.play();
             break;
         case "Restart":
             wplayer.controls.currentPosition = 0;
             wplayer.controls.play();
             break;
         case "Next":
             recordPodsHeard(wplayer.currentMedia.sourceURL, "SKIPPED_AT=" + wplayer.controls.currentPosition.ToString("F0") + "Sec");
             wplayer.controls.next();
             podMode = false;
             break;
         case "Delete":
             if (podMode)  // currently listening to a podcast
             {
                 recordPodsHeard(wplayer.currentMedia.sourceURL, "DELETE");
                 wplayer.controls.next();
             }
             else  //listening to music
             {
                 // really need to add DELETE to previous line
             }
             break;
         case "Keep":
             markAsKeep = true;
             break;
         case "Configure":
             showConfig(null, null);
             break;
         case "Test Heard":  // just to test the heard function
             if (podMode)
             {
                 lastMediaHeard = true;
                 wplayer.controls.next();
             }
             break;
         case "Vol+":
             if (volume < 50)
                 volume += 1;
             else if (volume < 100)
                 volume += 5;
             wplayer.settings.volume = volume;
             volLbl.Content = "Volume = " + volume;
             volLbl.Opacity = 1.0;
             break;
         case "Vol-":
             if (volume > 50)
                 volume -= 5;
             else if (volume > 10)
                 volume -= 1;
             if (wplayer.settings.volume > volume)
                 wplayer.settings.volume = volume;
             volLbl.Content = "Volume = " + wplayer.settings.volume;
             volLbl.Opacity = 1.0;
             break;
         case "Help":
             String path = System.IO.Path.GetDirectoryName(
       System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
             String fid = System.IO.Path.Combine(path, "help.html");
             Process.Start(fid);
             break;
         case "HotKeys":
             keyWindow = new keySelectWindow(keyAction,false);
             keyWindow.ShowDialog();
             keyWindow.Focus();
             break;
         case "Print Keys":
             keyAction.printKeys();
             break;
     }
 }
Ejemplo n.º 7
0
 private void windowClosing(Object sender, CancelEventArgs e)
 {
     if (!closeReally)
     {
         e.Cancel = true;  //don't close as such
         this.Visibility = Visibility.Hidden;
     }
     if (heardWindow != null)
     {
         heardWindow.Close();
         heardWindow = null;
     }
     if (keyWindow != null)
     {
         keyWindow.Close();
         keyWindow = null;
     }
 }
Ejemplo n.º 8
0
 void setKeys(Object obj, RoutedEventArgs e)
 {
     keyWindow = new keySelectWindow(keyAction);
     keyWindow.ShowDialog();
     keyWindow.Focus();
 }