예제 #1
0
    /// <summary>
    /// Broadcast window messages to each input device.
    /// </summary>
    /// <param name="msg"></param>
    /// <param name="action"></param>
    /// <param name="key"></param>
    /// <param name="keyCode"></param>
    /// <returns></returns>
    public static bool WndProc(ref Message msg, out Action action, out char key, out Keys keyCode)
    {
      action = null;
      key = (char)0;
      keyCode = Keys.A;

      foreach (var device in Devices)
      {
        try
        {
          if (device.WndProc(ref msg, out action, out key, out keyCode))
          {
            //First come, first served, stop message propagation then.
            return true;
          }
        }
        catch (Exception ex)
        {
          //Keep on propagating that message even if one of our input device crapped out.
          Log.Error("InputDevices - WndProc - exception caught from InputDevice: {0} {1}", device.ToString(), ex);
        }
      }

      return false;
    }
 public override void OnAction(Action action)
 {
   //needRefresh = true;
   if (action.wID == Action.ActionType.ACTION_CLOSE_DIALOG ||
       action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
   {
     m_DefaultStop = false;
     base.OnAction(action);
     return;
   }
   //
   // WARNING: Even if STOP is a semantic NO, as we look from the user point of view, here it's a YES
   //
   // es. "Do you really want to STOP play LiveTv ?" -> YES I want to STOP
   //
   if (action.wID == Action.ActionType.ACTION_STOP || (action.m_key != null) && (action.m_key.KeyChar == 'b'))
   {
     m_bConfirmed = true;
     PageDestroy();
     m_DefaultStop = false;
     return;
   }
   //
   // WARNING: See above comment to understand why PLAY, that is a semantic YES, here is a NO
   //
   if (action.wID == Action.ActionType.ACTION_PLAY || (action.m_key != null) && (action.m_key.KeyChar == 'p'))
   {
     m_bConfirmed = false;
     PageDestroy();
     m_DefaultStop = false;
     return;
   }
   base.OnAction(action);
 }
 public override void OnAction(Action action)
 {
     if (action.wID == Action.ActionType.ACTION_VOLUME_UP ||
         action.wID == Action.ActionType.ACTION_VOLUME_DOWN ||
         action.wID == Action.ActionType.ACTION_VOLUME_MUTE)
     {
         // MediaPortal core sends this message to the Fullscreenwindow, we need to do it ourselves to make the Volume OSD show up
         base.OnAction(new Action(Action.ActionType.ACTION_SHOW_VOLUME, 0, 0));
         return;
     }
     else
     {
         Action translatedAction = new Action();
         if (ActionTranslator.GetAction((int)Window.WINDOW_FULLSCREEN_VIDEO, action.m_key, ref translatedAction))
         {
             if (translatedAction.wID == Action.ActionType.ACTION_SHOW_OSD)
             {
                 base.OnAction(translatedAction);
                 if (GUIWindowManager.VisibleOsd == Window.WINDOW_OSD)
                 {
                     GUIWindowManager.VisibleOsd = (Window)GUIOnlineVideoOSD.WINDOW_ONLINEVIDEOS_OSD;
                 }
                 return;
             }
             if (translatedAction.wID == Action.ActionType.ACTION_ASPECT_RATIO)
             {
                 base.OnAction(translatedAction);
             }
         }
     }
     base.OnAction(action);
 }
예제 #4
0
    protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
      {
        bIsUsernameButtonPressed = false;
        bIsPasswordButtonPressed = false;

        if (control == btnEnterUsername)
        {
          bIsUsernameButtonPressed = true;
          PageDestroy();
        }

        if (control == btnEnterPassword)
        {
          bIsPasswordButtonPressed = true;
          PageDestroy();
        }

        if (control == btnOK)
        {
          HeadWeb hw = (HeadWeb)GUIWindowManager.GetWindow(HeadWeb.ID);
          HeadWebSettings.Instance.s_cc = new CookieContainer();
          bool loginresult = hw.loginUser(HeadWebSettings.Instance.s_username, HeadWebSettings.Instance.s_password);
          if (loginresult)
          {
            HeadWebSettings.Instance.s_loggedin = true;
            hw.getFavorites(true);
            PageDestroy();
          }
        }

        base.OnClicked(controlId, control, actionType);
      }
예제 #5
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            if (control.GetType() == typeof (GUIButtonControl))
            {
                if (controlId > 100 && controlId <= Settings.LocalPresetsNumber + 100 &&
                    _setting.PresetStations[controlId - 100 - 1] != null &&
                    _setting.PresetStations[controlId - 100 - 1].GuidId != null)
                {
                    DoPlay(_setting.PresetStations[controlId - 100 - 1]);
                    if (_setting.JumpNowPlaying)
                        GUIWindowManager.ActivateWindow(25652);
                }
            }
            if (control == homeButton)
            {
                GUIWindowManager.ActivateWindow(25650);
            }
            else if (control == folderButton)
            {
                var s = GetPresetFolder();
                if (s == noPresetFolders)
                {
                    ErrMessage(Translation.NoPresetFoldersFound);
                    GUIControl.DisableControl(GetID, folderButton.GetID);
                }
                else if (s != null)
                {
                    _setting.FolderId = s;
                    _setting.Save();
                    LoadLocalPresetStations();
                }
            }

            base.OnClicked(controlId, control, actionType);
        }
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
   if (control == btnSearch)
   {
     TvNewScheduleSearch.SearchFor = TvNewScheduleSearch.SearchType.Title;
     GUIWindowManager.ActivateWindow((int)Window.WINDOW_TV_SEARCH);
     return;
   }
   if (control == btnTvGuide)
   {
     TvNewScheduleSearch.SearchFor = TvNewScheduleSearch.SearchType.KeyWord;
     GUIWindowManager.ActivateWindow((int)Window.WINDOW_TVGUIDE);
     return;
   }
   if (control == btnQuickRecord)
   {
     OnQuickRecord();
     return;
   }
   if (control == btnAdvancedRecord)
   {
     OnAdvancedRecord();
     return;
   }
   base.OnClicked(controlId, control, actionType);
 }
        public override void OnAction(Action action)
        {
            switch (action.wID)
            {
                case Action.ActionType.REMOTE_1:
                    Rated = TraktAPI.TraktRateValue.love;
                    UpdateRating();
                    break;

                case Action.ActionType.REMOTE_2:
                    Rated = TraktAPI.TraktRateValue.hate;
                    UpdateRating();
                    break;

                case Action.ActionType.ACTION_SELECT_ITEM:
                    IsSubmitted = true;
                    PageDestroy();
                    return;

                case Action.ActionType.ACTION_PREVIOUS_MENU:
                case Action.ActionType.ACTION_CLOSE_DIALOG:
                case Action.ActionType.ACTION_CONTEXT_MENU:
                    IsSubmitted = false;
                    PageDestroy();
                    return;
            }

            base.OnAction(action);
        }
예제 #8
0
    public static bool WndProc(ref Message msg, out Action action, out char key, out Keys keyCode)
    {
      action = null;
      key = (char)0;
      keyCode = Keys.A;

      if (CentareaRemote.WndProc(ref msg))
      {
        return true;
      }

      if (HidListener.WndProc(ref msg, out action, out key, out keyCode))
      {
        return true;
      }

      if (HCWRemote.WndProc(msg))
      {
        return true;
      }

      if (FireDTVRemote.WndProc(ref msg, out action, out key, out keyCode))
      {
        return true;
      }

      if (MCE2005Remote.WndProc(msg))
      {
        return true;
      }

      return false;
    }
        public override void OnAction(Action action)
        {
            if (action.wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_NEXT_ITEM || action.wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_NEXT_CHAPTER)
              {
            if (Youtube2MP.player.CurrentSong > -1)
            {
              Youtube2MP.player.PlayNext();
              return;
            }
            if (Youtube2MP.temp_player.CurrentSong > -1)
            {
              Youtube2MP.temp_player.PlayNext();
              return;
            }
              }

              if (action.wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_PREV_ITEM || action.wID == MediaPortal.GUI.Library.Action.ActionType.ACTION_PREV_CHAPTER)
              {
            if (Youtube2MP.player.CurrentSong > -1)
            {
              Youtube2MP.player.PlayPrevious();
              return;
            }
            if (Youtube2MP.temp_player.CurrentSong > -1)
            {
              Youtube2MP.temp_player.PlayPrevious();
              return;
            }
              }
              base.OnAction(action);
        }
예제 #10
0
 public override void OnAction(Action action)
 {
   /*switch (action.wID)
   {
   }*/
   base.OnAction(action);
 }
예제 #11
0
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
   if (control == this.btnDisableRemote)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnDisableRepeat)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnRepeatDelay)
   {
     this.SaveSettings();
   }
   if (control == this.btnRemoteMapping)
   {
     try
     {
       if (!File.Exists(VLSYS_Mplay.DefaultMappingPath))
       {
         VLSYS_Mplay.AdvancedSettings.CreateDefaultRemoteMapping();
       }
       new InputMappingForm("VLSYS_Mplay").ShowDialog();
     }
     catch (Exception exception)
     {
       Log.Info("VLSYS_AdvancedSetupForm.btnRemoteSetup_Click() CAUGHT EXCEPTION: {0}", new object[] {exception});
     }
   }
   base.OnClicked(controlId, control, actionType);
 }
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
   if (control == this.btnDisplayVideo)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnDisplayAction)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnDisplayActionTime)
   {
     this.SaveSettings();
   }
   if (control == this.btnDisplayIdle)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnIdleDelay)
   {
     this.SaveSettings();
   }
   base.OnClicked(controlId, control, actionType);
 }
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
   if (control == this.btnEnableKeyPad)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnEnableCustom)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnKeyPadMapping)
   {
     try
     {
       if (!File.Exists(MatrixMX.DefaultMappingPath))
       {
         MatrixMX.AdvancedSettings.CreateDefaultKeyPadMapping();
       }
       new InputMappingForm("MatrixMX_Keypad").ShowDialog();
     }
     catch (Exception exception)
     {
       Log.Info("VLSYS_AdvancedSetupForm.btnRemoteSetup_Click() CAUGHT EXCEPTION: {0}", new object[] {exception});
     }
   }
   base.OnClicked(controlId, control, actionType);
 }
예제 #14
0
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
   base.OnClicked(controlId, control, actionType);
   if (control == btnClose)
   {
     PageDestroy();
   }
 }
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
     if (control == btnCreateMovingPicturesCategories)
         CreateMovingPicturesCategoriesClicked();
     if (control == btnCreateMovingPicturesFilters)
         CreateMovingPicturesFiltersClicked();
     base.OnClicked(controlId, control, actionType);
 }
예제 #16
0
 public override void OnAction(Action action)
 {
   if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
   {
     // User canceled selection, deselect file
     m_iSelectedFile = -1;
   }
   base.OnAction(action);
 }
예제 #17
0
    protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
      {
        if (control == btnEnterCode)
        {
          bIsSMSCodeButtonPressed = true;
          PageDestroy();
        }
        base.OnClicked(controlId, control, actionType);
      }
예제 #18
0
    protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
    {
      base.OnClicked(controlId, control, actionType);
      int iYear, iMonth;
      if (control == spinStartMonth)
      {
        iYear = spinStartYear.Value;
        iMonth = spinStartMonth.Value;
        if (iMonth == 2 && DateTime.IsLeapYear(iYear))
        {
          spinStartDay.SetRange(1, 29);
        }
        else
        {
          spinStartDay.SetRange(1, months[iMonth]);
        }
      }
      if (control == spinEndMonth)
      {
        iYear = spinEndYear.Value;
        iMonth = spinEndMonth.Value;
        if (iMonth == 2 && DateTime.IsLeapYear(iYear))
        {
          spinEndDay.SetRange(1, 29);
        }
        else
        {
          spinEndDay.SetRange(1, months[iMonth]);
        }
      }
      if (control == btnOK)
      {
        int iHour;
        iHour = spinStartHour.Value;
        int iMin;
        iMin = spinStartMinute.Value;
        int iDay;
        iDay = spinStartDay.Value;
        iMonth = spinStartMonth.Value;
        iYear = spinStartYear.Value;
        channel = spinChannel.GetLabel();

        startDateTime = new DateTime(iYear, iMonth, iDay, iHour, iMin, 0, 0);
        iHour = spinEndHour.Value;
        iMin = spinEndMinute.Value;
        iDay = spinEndDay.Value;
        iMonth = spinEndMonth.Value;
        iYear = spinEndYear.Value;
        endDateTime = new DateTime(iYear, iMonth, iDay, iHour, iMin, 0, 0);

        _confirmed = true;
        PageDestroy();
        return;
      }
    }
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
   if (control == this.btnVolume)
   {
     this.SaveSettings();
   }
   if (control == this.btnProgress)
   {
     this.SaveSettings();
   }
   if (control == this.btnDiskIcon)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnMediaStatus)
   {
     this.SaveSettings();
   }
   if (control == this.btnDiskStatus)
   {
     this.SaveSettings();
   }
   if (control == this.btnCustomFont)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnLargeIcons)
   {
     this.SaveSettings();
     this.SetButtons();
   }
   if (control == this.btnCustomIcons)
   {
     this.SaveSettings();
   }
   if (control == this.btnInvertIcons)
   {
     this.SaveSettings();
   }
   if (control == this.btnFontEditor)
   {
     Form form = new iMONLCDg_FontEdit();
     form.ShowDialog();
     form.Dispose();
   }
   if (control == this.btnIconEditor)
   {
     Form form2 = new iMONLCDg_IconEdit();
     form2.ShowDialog();
     form2.Dispose();
   }
   base.OnClicked(controlId, control, actionType);
 }
예제 #20
0
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
     switch (controlId)
     {
         case (int)GUIControls.Style:
             break;
         case (int)GUIControls.ThumbViewMod:
             ShowThumbnailContextMenu();
             break;
     }
     base.OnClicked(controlId, control, actionType);
 }
예제 #21
0
    public override void OnAction(Action action)
      {
      switch (action.wID)
         {
        case Action.ActionType.ACTION_PREVIOUS_MENU:
        case Action.ActionType.ACTION_CLOSE_DIALOG:
        case Action.ActionType.ACTION_CONTEXT_MENU:
            PageDestroy();
            return;
         }
      base.OnAction(action);
      }
 public override void OnAction(Action action)
 {
   switch (action.wID)
   {
     case Action.ActionType.ACTION_PREVIOUS_MENU:
       {
         GUIWindowManager.ShowPreviousWindow();
         return;
       }
   }
   base.OnAction(action);
 }
 public override void OnAction(Action action)
 {
     switch (action.wID)
     {
         case Action.ActionType.ACTION_PLAY:
         case Action.ActionType.ACTION_MUSIC_PLAY:
             CheckAndPlayMovie(false);
             break;
         default:
             base.OnAction(action);
             break;
     }
 }
 public override void OnAction(Action action)
 {
     if (action.wID == Action.ActionType.ACTION_CONTEXT_MENU)
     {
         GUIOnlineVideoFullscreen videoWindow = (GUIOnlineVideoFullscreen)GUIWindowManager.GetWindow(GUIOnlineVideoFullscreen.WINDOW_FULLSCREEN_ONLINEVIDEO);
         videoWindow.OnAction(new Action(Action.ActionType.ACTION_SHOW_OSD, 0, 0));
         videoWindow.OnAction(action);
     }
     else
     {
         base.OnAction(action);
     }
 }
예제 #25
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            switch (controlId)
            {
                case (int)GUIControls.Style:
                    break;

                case (int)GUIControls.widebannerMod:
                    ShowWidebannerContextMenu();
                    break;

            }
            base.OnClicked(controlId, control, actionType);
        }
예제 #26
0
 public override void OnAction(Action action)
 {
   if (action.wID == Action.ActionType.ACTION_MOVE_DOWN)
   {
     // Frig the action to pretend its a page down
     action.wID = Action.ActionType.ACTION_PAGE_DOWN;
   }
   else if (action.wID == Action.ActionType.ACTION_MOVE_UP)
   {
     // Frig the action to pretend its a page up
     action.wID = Action.ActionType.ACTION_PAGE_UP;
   }
   base.OnAction(action);
 }
 public override void OnAction(Action action)
 {
   switch (action.wID)
   {
     case Action.ActionType.ACTION_SWITCH_TELETEXT_TRANSPARENT:
       // Switch tranparent mode
       _transparentMode = !_transparentMode;
       _renderer.TransparentMode = _transparentMode;
       // Rerender the image
       RequestUpdate(false);
       break;
   }
   base.OnAction(action);
 }
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
   if (control == this.btnMonitorPower)
   {
     XMLUTILS.SaveMonitorPowerState(this.btnMonitorPower.Selected);
   }
   if (control == this.btnContrast)
   {
     XMLUTILS.SaveContrast(this.btnContrast.SelectedItem);
   }
   if (control == this.btnBrightness)
   {
     XMLUTILS.SaveBrightness(this.btnBrightness.SelectedItem);
   }
 }
    protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
    {
      if (control == btnAdd)
      {
        string ext = string.Empty;
        GetStringFromKeyboard(ref ext);
        if (string.IsNullOrEmpty(ext))
        {
          return;
        }
        ext = "." + ext.Replace(".", string.Empty).ToLowerInvariant();

        foreach (var lItem in extensionsListcontrol.ListItems)
        {
          if (ext.Equals(lItem.Label,StringComparison.InvariantCultureIgnoreCase))
          {
            return;
          }
        }

        GUIListItem item = new GUIListItem();
        item.Label = ext.Trim();
        extensionsListcontrol.Add(item);
        SaveExtensions();
        OnExtensions();
      }
      if (control == btnRemove)
      {
        extensionsListcontrol.RemoveItem(extensionsListcontrol.SelectedListItemIndex);
        SaveExtensions();
        OnExtensions();
      }
      if (control == btnDefault)
      {
        using (Profile.Settings xmlwriter = new MPSettings())
        {
          xmlwriter.SetValue("movies", "extensions", Util.Utils.VideoExtensionsDefault);
        }
        // update internal plugins settings
        if (VirtualDirectories.Instance.Movies != null)
        {
          VirtualDirectories.Instance.Movies.LoadSettings(_section);
        }
        OnExtensions();
      }

      base.OnClicked(controlId, control, actionType);
    }
예제 #30
0
        private void DoOnEnded(g_Player.MediaType type, string filename)
        {
            if (GUIWindowManager.ActiveWindow == GetID)
            {
                Log.Debug("GUIMusicPlayingNow: g_Player_PlayBackEnded for {0}", filename);

                if (!g_Player.Playing && NextTrackTag == null && !_isStopped)
                {
                    _isStopped = true;
                    Log.Debug("GUIMusicPlayingNow: All playlist items played - returning to previous window");
                    Action action = new Action();
                    action.wID = Action.ActionType.ACTION_PREVIOUS_MENU;
                    GUIGraphicsContext.OnAction(action);
                }
            }
        }
예제 #31
0
        public static bool WndProc(ref Message msg, out Action action, out char key, out Keys keyCode)
        {
            action  = null;
            key     = (char)0;
            keyCode = Keys.A;

            foreach (var device in Devices)
            {
                if (device.WndProc(ref msg, out action, out key, out keyCode))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #32
0
 /// <summary>
 /// Overrides on action for deleting item
 /// </summary>
 /// <param name="action"></param>
 public override void OnAction(Action action)
 {
     if (action.wID == Action.ActionType.ACTION_DELETE_ITEM)
     {
         GUIListItem item = facadeView.SelectedListItem;
         if (item != null)
         {
             if (!item.IsFolder)
             {
                 OnDeleteItem(item);
                 return;
             }
         }
     }
     base.OnAction(action);
 }
 public override void OnAction(Action action)
 {
     switch (action.wID)
     {
         case Action.ActionType.ACTION_PLAY:
         case Action.ActionType.ACTION_MUSIC_PLAY:
             if (!GUIBackgroundTask.Instance.IsBusy)
             {
                 CheckAndPlayEpisode(false);
             };
             break;
         default:
             base.OnAction(action);
             break;
     }
 }
예제 #34
0
        private void OnPlayBackStopped(g_Player.MediaType type, int stoptime, string filename)
        {
            if (!ControlsInitialized || type != g_Player.MediaType.Music)
            {
                return;
            }

            if (GUIWindowManager.ActiveWindow == GetID && !_isStopped)
            {
                _isStopped = true;
                Log.Debug("GUIMusicPlayingNow: g_Player_PlayBackStopped for {0} - stoptime: {1}", filename, stoptime);
                Action action = new Action();
                action.wID = Action.ActionType.ACTION_PREVIOUS_MENU;
                GUIGraphicsContext.OnAction(action);
            }
        }
예제 #35
0
        // Make sure we get all of the ACTION_PLAY events (OnAction only receives the ACTION_PLAY event when
        // the player is not playing)...
        private void OnNewAction(Action action)
        {
            if ((action.wID == Action.ActionType.ACTION_PLAY ||
                 action.wID == Action.ActionType.ACTION_MUSIC_PLAY) &&
                GUIWindowManager.ActiveWindow == GetID)
            {
                GUIListItem item = facadeLayout.SelectedListItem;

                if (item == null || item.Label == "..")
                {
                    return;
                }

                OnClick(-1);
            }
        }
        public override void OnAction(Action action)
        {
            switch (action.wID)
            {
            case Action.ActionType.ACTION_PLAY:
            case Action.ActionType.ACTION_MUSIC_PLAY:
                if (!GUIBackgroundTask.Instance.IsBusy)
                {
                    CheckAndPlayMovie(false);
                }
                break;

            default:
                base.OnAction(action);
                break;
            }
        }
        public override void OnAction(Action action)
        {
            if (action.wID == Action.ActionType.ACTION_HOME || action.wID == Action.ActionType.ACTION_SWITCH_HOME)
            {
                return;
            }

            switch (action.wID)
            {
            case Action.ActionType.ACTION_PREVIOUS_MENU:
            {
                GUIWindowManager.ShowPreviousWindow();
                return;
            }
            }
            base.OnAction(action);
        }
예제 #38
0
파일: Main.cs 프로젝트: nubuntu/mychitchat
 public override void OnAction(MediaPortal.GUI.Library.Action action)
 {
     switch (action.wID)
     {
     case MediaPortal.GUI.Library.Action.ActionType.ACTION_KEY_PRESSED:
         if (ctrlListControlContacts.IsFocused && ctrlListControlContacts.SelectedListItem != null)
         {
             if (action.m_key.KeyChar != 13 && action.m_key.KeyChar != 27 && ctrlListControlContacts != null)
             {
                 History.Instance.GetSession(ctrlListControlContacts.SelectedListItem.Path).Reply(Dialog.Instance.GetKeyBoardInput(((char)action.m_key.KeyChar).ToString()));
                 return;
             }
         }
         break;
     }
     base.OnAction(action);
 }
 public override void OnAction(Action action)
 {
     switch (action.wID)
     {
     case Action.ActionType.ACTION_PREVIOUS_MENU:
         switch (CurrentViewLevel)
         {
         case ViewLevel.ActivityTypes:
             // go back one view level
             CurrentViewLevel = ViewLevel.Network;
             LoadView();
             return;
         }
         break;
     }
     base.OnAction(action);
 }
예제 #40
0
 public override void OnAction(Action action)
 {
     if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
     {
         if (m_wndTetris != null && m_wndTetris.Focus && m_wndTetris.State == State.Running)
         {
             m_wndTetris.State = State.Paused;
         }
         else
         {
             GUIWindowManager.ShowPreviousWindow();
         }
     }
     else
     {
         base.OnAction(action);
     }
 }
예제 #41
0
        public override void OnAction(Action action)
        {
            if (LastActionTime + 100 > Environment.TickCount && action == LastAction)
            {
                return;
                // don't do anything if the keypress is comes to soon after the previos one and the action is the same as before.
            }

            switch (action.wID)
            {
            case Action.ActionType.ACTION_PREVIOUS_MENU:
            {
                GUIWindowManager.ShowPreviousWindow();
                return;
            }
            }
            base.OnAction(action);
        }
예제 #42
0
        public bool WndProc(ref Message msg, out Action action, out char key, out Keys keyCode)
        {
            keyCode = Keys.A;
            key     = (char)0;
            action  = null;
            switch ((FireDTVConstants.FireDTVWindowMessages)msg.Msg)
            {
            case FireDTVConstants.FireDTVWindowMessages.DeviceAttached:
                Log.Info("FireDTVRemote: DeviceAttached");
                StartFireDTVComms();
                break;

            case FireDTVConstants.FireDTVWindowMessages.DeviceDetached:
                Log.Info("FireDTVRemote: DeviceDetached");
                _fireDTV.SourceFilters.RemoveByHandle((uint)msg.WParam);
                break;

            case FireDTVConstants.FireDTVWindowMessages.DeviceChanged:
                Log.Info("FireDTVRemote: DeviceChanged");
                StartFireDTVComms();
                break;

            case FireDTVConstants.FireDTVWindowMessages.RemoteControlEvent:
                if (_enabled)
                {
                    int remoteKeyCode = msg.LParam.ToInt32();
                    if (_logVerbose)
                    {
                        Log.Info("FireDTVRemote: RemoteControlEvent {0}", remoteKeyCode);
                    }

                    if (!_inputHandler.MapAction(remoteKeyCode))
                    {
                        return(false);
                    }

                    msg.Result = new IntPtr(1);
                    return(true);
                }
                break;
            }

            return(false);
        }
예제 #43
0
        public override void OnAction(Action action)
        {
            switch (action.wID)
            {
            case Action.ActionType.ACTION_SHOW_PLAYLIST:
                GUIWindowManager.ShowPreviousWindow();
                return;

            case Action.ActionType.ACTION_MOVE_SELECTED_ITEM_UP:
                MovePlayListItemUp();
                break;

            case Action.ActionType.ACTION_MOVE_SELECTED_ITEM_DOWN:
                MovePlayListItemDown();
                break;

            case Action.ActionType.ACTION_DELETE_SELECTED_ITEM:
                DeletePlayListItem();
                break;

            // Handle case where playlist has been stopped and we receive a player action.
            // This allows us to restart the playback proccess...
            case Action.ActionType.ACTION_MUSIC_PLAY:
            case Action.ActionType.ACTION_NEXT_ITEM:
            case Action.ActionType.ACTION_PAUSE:
            case Action.ActionType.ACTION_PREV_ITEM:
                if (playlistPlayer.CurrentPlaylistType != PlayListType.PLAYLIST_VIDEO)
                {
                    playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO;
                    if (g_Player.CurrentFile == "")
                    {
                        PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_VIDEO);
                        if (playList != null && playList.Count > 0)
                        {
                            playlistPlayer.Play(0);
                            UpdateButtonStates();
                        }
                    }
                }
                break;
            }

            base.OnAction(action);
        }
예제 #44
0
 public override void OnAction(Action action)
 {
     if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
     {
         if (_viewsList.Focus)
         {
             GUIListItem item = GetItem(0);
             if (item != null)
             {
                 if (item.IsFolder && item.Label == _parentDirectoryLabel)
                 {
                     ShowSearchResults(string.Empty);
                     return;
                 }
             }
         }
     }
     base.OnAction(action);
 }
예제 #45
0
        /// <summary>
        /// Make MediaPortal take a screenshot, take that and delete it
        /// from disk. First we need to check if the screenshot folder already exists.
        /// See https://github.com/MediaPortal/MediaPortal-1/blob/cae80bd6dd2241bd7182c39418373bee545bf464/mediaportal/MediaPortal.Application/MediaPortal.cs#L3611
        /// </summary>
        public void TakeScreenshot()
        {
            // Only take one screenshot at a time, all requests
            // will be served from that screenshot.
            if (takingScreenshot)
            {
                return;
            }

            takingScreenshot = true;

            // MediaPortal doesn't output events for new screenshots so we 'manually'
            // watch the screenshot folder
            setupFileSystemWatcher();

            if (watcher == null)
            {
                // Something went wrong creating the filesystem watcher
                takingScreenshot = false;
                OnScreenshotFailed(new ImageHelperError(ImageHelperError.ImageHelperErrorType.WatcherCreate));
                return;
            }

            if (!watcher.EnableRaisingEvents)
            {
                try
                {
                    watcher.EnableRaisingEvents = true;
                }
                catch (Exception e)
                {
                    WifiRemote.LogMessage(String.Format("Could not watch the screenshots folder: {0}", e.Message), WifiRemote.LogType.Error);
                    watcher          = null;
                    takingScreenshot = false;
                    OnScreenshotFailed(new ImageHelperError(ImageHelperError.ImageHelperErrorType.WatcherEnable));
                    return;
                }
            }

            // Take the screenshot
            MediaPortal.GUI.Library.Action action = new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_TAKE_SCREENSHOT, 0, 0);
            GUIGraphicsContext.OnAction(action);
        }
예제 #46
0
        /// <summary>
        /// Map a key press to an action
        /// </summary>
        /// <param name="keyPressed"></param>
        /// <returns></returns>
        public static Action MapToAction(int keyPressed)
        {
            var action = new Action();

            if (ActionTranslator.GetAction(-1, new Key(0, keyPressed), ref action))
            {
                return(action);
            }
            //See if it's mapped to KeyPressed instead
            if (keyPressed >= (int)Keys.A && keyPressed <= (int)Keys.Z)
            {
                keyPressed += 32; //convert to char code
            }
            if (ActionTranslator.GetAction(-1, new Key(keyPressed, 0), ref action))
            {
                return(action);
            }
            return(null);
        }
예제 #47
0
        /// <summary>
        /// Try and map a WndProc message to an action regardless of whether the remote is stopped or not (will still ignore if it's disabled)
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static Action MapToAction(Message msg)
        {
            Action result = null;

            Log.Info(string.Format("WndProc message to be processed {0}, appCommand {1}, LParam {2}, WParam {3}", msg.Msg, Win32.Macro.GET_APPCOMMAND_LPARAM(msg.LParam), msg.LParam, msg.WParam));
            foreach (var device in Devices)
            {
                var mapping = device.GetMapping(msg);
                if (mapping != null)
                {
                    switch (mapping.Command)
                    {
                    case "ACTION": // execute Action x
                        Key key = new Key(mapping.CmdKeyChar, mapping.CmdKeyCode);
                        Log.Info("MappingToAction: key {0} / {1} / Action: {2} / {3}", mapping.CmdKeyChar, mapping.CmdKeyCode,
                                 mapping.CmdProperty,
                                 ((Action.ActionType)Convert.ToInt32(mapping.CmdProperty)).ToString());
                        result = new Action(key, (Action.ActionType)Convert.ToInt32(mapping.CmdProperty), 0, 0);
                        break;

                    case "KEY": // Try and map the key to the Keys enum and process that way
                        var tmpKey = Keys.A;
                        if (Enum.TryParse <Keys>(mapping.CmdProperty, out tmpKey))
                        {
                            result = MapToAction((int)tmpKey);
                        }
                        break;
                    }
                    if (result != null)
                    {
                        break;
                    }
                }
            }

            if (result == null)
            {
                Log.Info("No mapping found");
            }

            return(result);
        }
예제 #48
0
        /// <summary>
        /// OnAction only receives ACTION_PLAY event when the player is not playing.  Ensure all actions are processed
        /// </summary>
        /// <param name="action">Action command</param>
        private void OnNewAction(Action action)
        {
            if ((action.wID != Action.ActionType.ACTION_PLAY) || GUIWindowManager.ActiveWindow != GetID)
            {
                return;
            }

            var item = facadeLayout.SelectedListItem;

            if (item == null || item.IsFolder)
            {
                return;
            }

            if (GetFocusControlId() == facadeLayout.GetID)
            {
                // only start something is facade is focused
                OnSelectedRecording(facadeLayout.SelectedListItemIndex);
            }
        }
예제 #49
0
        public override void OnAction(Action action)
        {
            // F3 key - IMDB info
            if (action.wID == Action.ActionType.ACTION_SHOW_INFO)
            {
                GUIListItem item = listActorMovies.SelectedListItem;

                if (!item.IsRemote)
                {
                    OnMovieInfo(item);
                }
            }

            if (action.wID == Action.ActionType.ACTION_PLAY || action.wID == Action.ActionType.ACTION_MUSIC_PLAY)
            {
                _playClicked = true;
            }

            base.OnAction(action);
        }
예제 #50
0
        /// <summary>
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="action"></param>
        /// <param name="key"></param>
        /// <param name="keyCode"></param>
        /// <returns></returns>
        public bool WndProc(ref Message msg, out Action action, out char key, out Keys keyCode)
        {
            action  = null;
            key     = (char)0;
            keyCode = Keys.A;

            if (!_controlEnabled)
            {
                return(false);
            }
            //We are only interested in WM_INPUT
            switch (msg.Msg)
            {
            case Const.WM_INPUT:
                return(WndProcInput(ref msg, out action, out key, out keyCode));

            default:
                return(false);
            }
        }
예제 #51
0
        public override void OnAction(Action action)
        {
            switch (action.wID)
            {
            case Action.ActionType.ACTION_PLAY:
            case Action.ActionType.ACTION_MUSIC_PLAY:
                base.OnAction(action);
                break;

            case Action.ActionType.ACTION_PREVIOUS_MENU:
                _loadParameter        = null;
                PreviousSelectedIndex = 0;
                base.OnAction(action);
                break;

            default:
                base.OnAction(action);
                break;
            }
        }
예제 #52
0
        private void HandleGUIOnControlChange()
        {
            try
            {
                var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_AUDIOVOLUME_CHANGED, 0, 0, 0, 0, 0, 0)
                {
                    Label  = Instance.Step.ToString(CultureInfo.InvariantCulture),
                    Label2 = Instance.StepMax.ToString(CultureInfo.InvariantCulture),
                    Label3 = Instance.IsMuted.ToString(CultureInfo.InvariantCulture)
                };
                GUIGraphicsContext.SendMessage(msg);

                var showVolume = new Action(Action.ActionType.ACTION_SHOW_VOLUME, 0, 0);
                GUIWindowManager.OnAction(showVolume);
            }
            catch (Exception ex)
            {
                Log.Error($"VolumeHandler: error occured in HandleGUIOnControlChange: {ex}");
            }
        }
        public override void OnAction(Action action)
        {
            switch (action.wID)
            {
            case Action.ActionType.ACTION_PREVIOUS_MENU:
                // restore current user
                CurrentUser = TraktSettings.Username;
                base.OnAction(action);
                break;

            case Action.ActionType.ACTION_PLAY:
            case Action.ActionType.ACTION_MUSIC_PLAY:
                CheckAndPlayMovie(false);
                break;

            default:
                base.OnAction(action);
                break;
            }
        }
        public override void OnAction(Action action)
        {
            switch (action.wID)
            {
            case Action.ActionType.ACTION_PREVIOUS_MENU:
                exitGUI();
                base.OnAction(action);
                break;

            case Action.ActionType.ACTION_STOP:
                exitGUI();
                //GUIWindowManager.CloseCurrentWindow();
                base.OnAction(action);
                break;

            default:
                base.OnAction(action);
                break;
            }
        }
예제 #55
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="action"></param>
        /// <param name="key"></param>
        /// <param name="keyCode"></param>
        /// <returns></returns>
        public bool WndProc(ref Message msg, out Action action, out char key, out Keys keyCode)
        {
            action  = null;
            key     = (char)0;
            keyCode = Keys.A;

            if (!controlEnabled)
            {
                return(false);
            }
            // we are only interested in WM_APPCOMMAND
            switch (msg.Msg)
            {
            case Win32.Const.WM_APPCOMMAND:
                return(WndProcAppCommand(ref msg, out action, out key, out keyCode));

            default:
                return(false);
            }
        }
        /// <summary>
        /// When the browser has a key press, try and map it to an action and fire the on action
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void _callback_OnBrowserKeyPress(int keyPressed)
        {
            var action = new Action();

            if (ActionTranslator.GetAction(-1, new Key(0, keyPressed), ref action))
            {
                GUIWindowManager_OnNewAction(action);
            }
            else
            {
                //See if it's mapped to KeyPressed instead
                if (keyPressed >= (int)Keys.A && keyPressed <= (int)Keys.Z)
                {
                    keyPressed += 32; //convert to char code
                }
                if (ActionTranslator.GetAction(-1, new Key(keyPressed, 0), ref action))
                {
                    GUIWindowManager_OnNewAction(action);
                }
            }
        }
예제 #57
0
        void GUIWindowManager_OnNewAction(MediaPortal.GUI.Library.Action action)
        {
            if (Playing)
            {
                // IPlayer.Volume Property is never set by MediaPortal -> need to trap volume changes this way
                switch (action.wID)
                {
                case MediaPortal.GUI.Library.Action.ActionType.ACTION_VOLUME_MUTE:
                    wmpCtrl.settings.mute = VolumeHandler.Instance.IsMuted;
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_VOLUME_DOWN:
                    wmpCtrl.settings.volume = (int)((double)MediaPortal.Player.VolumeHandler.Instance.Previous / MediaPortal.Player.VolumeHandler.Instance.Maximum * 100);
                    break;

                case MediaPortal.GUI.Library.Action.ActionType.ACTION_VOLUME_UP:
                    wmpCtrl.settings.volume = (int)((double)VolumeHandler.Instance.Next / MediaPortal.Player.VolumeHandler.Instance.Maximum * 100);
                    break;
                }
            }
        }
 public void OnNewAction(Action action)
 {
     // Remote Key to open Menu
     if ((action.wID == Action.ActionType.ACTION_REMOTE_RED_BUTTON && Settings.RemoteToggleKey == 1) ||
         (action.wID == Action.ActionType.ACTION_REMOTE_GREEN_BUTTON && Settings.RemoteToggleKey == 2) ||
         (action.wID == Action.ActionType.ACTION_REMOTE_BLUE_BUTTON && Settings.RemoteToggleKey == 3) ||
         (action.wID == Action.ActionType.ACTION_REMOTE_YELLOW_BUTTON && Settings.RemoteToggleKey == 4) ||
         (action.wID == Action.ActionType.ACTION_DVD_MENU && Settings.RemoteToggleKey == 5) ||
         (action.wID == Action.ActionType.ACTION_REMOTE_SUBPAGE_DOWN && Settings.RemoteToggleKey == 6) ||
         (action.wID == Action.ActionType.ACTION_REMOTE_SUBPAGE_UP && Settings.RemoteToggleKey == 7))
     {
         if (HyperionScreenCaptureEnabled())
         {
             ToggleHyperionScreenCapture(false, true);
         }
         else
         {
             ToggleHyperionScreenCapture(true, true);
         }
     }
 }
예제 #59
0
        public override void OnAction(Action action)
        {
            switch (action.wID)
            {
            case Action.ActionType.ACTION_PLAY:
            case Action.ActionType.ACTION_MUSIC_PLAY:
                base.OnAction(action);
                break;

            case Action.ActionType.ACTION_PREVIOUS_MENU:
                // clear search criteria if going back
                SearchTerm = string.Empty;
                Users      = null;
                base.OnAction(action);
                break;

            default:
                base.OnAction(action);
                break;
            }
        }
예제 #60
0
        public override void OnAction(Action action)
        {
            if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU)
            {
                if (facadeLayout.Focus)
                {
                    GUIListItem item = facadeLayout[0];

                    if ((item != null) && item.IsFolder && (item.Label == ".."))
                    {
                        if (handler.CurrentLevel < 0)
                        {
                            handler.CurrentLevel = 0;
                        }
                        else
                        {
                            handler.CurrentLevel--;
                            m_iItemSelected = -1;
                            LoadDirectory("db_view");
                            return;
                        }
                    }
                }
            }

            if (action.wID == Action.ActionType.ACTION_PARENT_DIR)
            {
                GUIListItem item = facadeLayout[0];

                if ((item != null) && item.IsFolder && (item.Label == ".."))
                {
                    handler.CurrentLevel--;
                    m_iItemSelected = -1;
                    LoadDirectory("db_view");
                    return;
                }
            }

            base.OnAction(action);
        }