コード例 #1
0
ファイル: GUIPresenter.cs プロジェクト: brownard/MyEmulators2
        void toggleDetails(ExtendedGUIListItem detailsItem, bool hide = false)
        {
            int controlId;

            setFacadeVisibility(hide);
            if (hide)
            {
                currentView = ViewState.Items;
                controlId   = facade.GetID;
                ExtendedGUIListItem item = (ExtendedGUIListItem)facade.SelectedListItem;
                if (this.detailsItem != null && item != null && item.AssociatedGame != null && this.detailsItem.AssociatedGame.GameID == item.AssociatedGame.GameID)
                {
                    item.UpdateGameInfo(this.detailsItem.AssociatedGame);
                }
                this.detailsItem = null;
                onFacadeItemSelected(facade.SelectedListItem, facade);
            }
            else
            {
                currentView      = ViewState.Details;
                controlId        = detailsDefaultControl;
                this.detailsItem = detailsItem;
                if (detailsItem != null)
                {
                    onFacadeItemSelected(detailsItem, facade, true);
                }
            }
            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SETFOCUS, Plugin.WINDOW_ID, 0, controlId, 0, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
コード例 #2
0
        public override void OnAction(Action action)
        {
            base.OnAction(action);
            GUIMessage message;

            if (Focus)
            {
                if (action.wID == Action.ActionType.ACTION_MOUSE_CLICK || action.wID == Action.ActionType.ACTION_SELECT_ITEM)
                {
                    _isSelected = !_isSelected;
                    if (_hyperLinkWindowId >= 0)
                    {
                        GUIWindowManager.ActivateWindow(_hyperLinkWindowId);
                        return;
                    }
                    // button selected.
                    // send a message
                    int iParam = 1;
                    if (!_isSelected)
                    {
                        iParam = 0;
                    }
                    message = new GUIMessage(GUIMessage.MessageType.GUI_MSG_CLICKED, WindowId, GetID, ParentID, iParam, 0, null);
                    GUIGraphicsContext.SendMessage(message);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// OnAction() method. This method gets called when there's a new action like a
        /// keypress or mousemove or... By overriding this method, the control can respond
        /// to any action
        /// </summary>
        /// <param name="action">action : contains the action</param>
        public override void OnAction(Action action)
        {
            base.OnAction(action);
            if (Focus)
            {
                if (action.wID == Action.ActionType.ACTION_MOUSE_CLICK || action.wID == Action.ActionType.ACTION_SELECT_ITEM)
                {
                    // If this control does not have a "selected" setting then toggle the value.  The value of _selected (when used) is
                    // determined and set in each render pass based on a condition (value of a property or skin setting).
                    if (_selected.Length == 0)
                    {
                        _isSelected = !_isSelected;
                    }

                    // Send a message that the checkbox was clicked.
                    GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_CLICKED, WindowId, GetID, ParentID,
                                                    (int)action.wID, 0, null);
                    GUIGraphicsContext.SendMessage(msg);

                    // If this button has a click setting then execute the setting.
                    if (_onclick.Length != 0)
                    {
                        GUIPropertyManager.Parse(_onclick, GUIExpressionManager.ExpressionOptions.EVALUATE_ALWAYS);
                    }
                }
            }
        }
コード例 #4
0
        protected virtual void SetVolume(bool isMuted)
        {
            try
            {
                _mixer.IsMuted = isMuted;


                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_AUDIOVOLUME_CHANGED, 0, 0, 0, 0, 0, 0);
                msg.Label  = Instance.Step.ToString();
                msg.Label2 = Instance.StepMax.ToString();
                msg.Label3 = Instance.IsMuted.ToString();
                GUIGraphicsContext.SendMessage(msg);


                if (GUIWindowManager.ActiveWindow == (int)GUIWindow.Window.WINDOW_TVFULLSCREEN && _showVolumeOSD ||
                    GUIWindowManager.ActiveWindow == (int)GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO && _showVolumeOSD)
                {
                    Action showVolume = new Action(Action.ActionType.ACTION_SHOW_VOLUME, 0, 0);
                    GUIWindowManager.OnAction(showVolume);
                }
            }
            catch (Exception e)
            {
                Log.Info("VolumeHandler.SetVolume: {0}", e.Message);
            }
        }
コード例 #5
0
        private void OnSkinChanged()
        {
            // Backup the buttons, needed later
            BackupButtons();

            // Set the skin to the selected skin and reload GUI
            GUIGraphicsContext.Skin = _btnSkin.Label;
            SaveSettings();
            GUITextureManager.Clear();
            GUITextureManager.Init();
            SkinSettings.Load();
            GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml"));
            GUIWindowManager.OnResize();
            GUIWindowManager.ActivateWindow(GetID);
            GUIControl.FocusControl(GetID, _btnSkin.GetID);

            // Apply the selected buttons again, since they are cleared when we reload
            RestoreButtons();
            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                if (!GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        var border = new Size(GUIGraphicsContext.form.Width - GUIGraphicsContext.form.ClientSize.Width,
                                              GUIGraphicsContext.form.Height - GUIGraphicsContext.form.ClientSize.Height);
                        if (GUIGraphicsContext.SkinSize.Width + border.Width <= GUIGraphicsContext.currentScreen.WorkingArea.Width &&
                            GUIGraphicsContext.SkinSize.Height + border.Height <= GUIGraphicsContext.currentScreen.WorkingArea.Height)
                        {
                            GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                        }
                        else
                        {
                            double ratio = Math.Min((double)(GUIGraphicsContext.currentScreen.WorkingArea.Width - border.Width) / GUIGraphicsContext.SkinSize.Width,
                                                    (double)(GUIGraphicsContext.currentScreen.WorkingArea.Height - border.Height) / GUIGraphicsContext.SkinSize.Height);
                            GUIGraphicsContext.form.ClientSize = new Size((int)(GUIGraphicsContext.SkinSize.Width * ratio), (int)(GUIGraphicsContext.SkinSize.Height * ratio));
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }
            if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null)
            {
                BassMusicPlayer.Player.VisualizationWindow.Reinit();
            }

            // Send a message that the skin has changed.
            var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SKIN_CHANGED, 0, 0, 0, 0, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
コード例 #6
0
        /// <summary>
        /// OnAction() method. This method gets called when there's a new action like a
        /// keypress or mousemove or... By overriding this method, the control can respond
        /// to any action
        /// </summary>
        /// <param name="action">action : contains the action</param>
        public override void OnAction(Action action)
        {
            GUIMessage message;

            if (Focus)
            {
                if (action.wID == Action.ActionType.ACTION_MOUSE_CLICK || action.wID == Action.ActionType.ACTION_SELECT_ITEM)
                {
                    // send a message to anyone interested
                    message = new GUIMessage(GUIMessage.MessageType.GUI_MSG_CLICKED, WindowId, GetID, ParentID, 0, 0, null);
                    GUIGraphicsContext.SendMessage(message);

                    // If this button has a click setting then execute the setting.
                    if (_onclick.Length != 0)
                    {
                        GUIPropertyManager.Parse(_onclick, GUIExpressionManager.ExpressionOptions.EVALUATE_ALWAYS);
                    }
                }
            }

            // Allow the spin control to handle actions first.
            _spinControl.OnAction(action);

            // If the spin control handled the action then avoid the base action handler.
            // In particular this avoids the move up,down,left,right actions from leaving this control too soon.
            if (!_spinControl.ActionHandled)
            {
                base.OnAction(action);
            }
        }
コード例 #7
0
        /// <summary>
        /// Extracts the Volume letter and sends a gui message with the extracted volume letter so that other plugins can add this drive out of there virtual directory
        /// </summary>
        /// <param name="volumeInformation">Volume Informations</param>
        /// <returns>true, if the message was handled; false otherwise</returns>
        private static bool DeviceNew(DEV_BROADCAST_VOLUME volumeInformation)
        {
            char   volumeLetter = GetVolumeLetter(volumeInformation.UnitMask);
            string path         = (volumeLetter + @":").ToUpperInvariant();
            string driveName    = Utils.GetDriveName(path);

            if (Utils.IsRemovable(path) || Utils.IsHD(path))
            {
                Log.Debug("Detected new device: {0}", volumeLetter);
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ADD_REMOVABLE_DRIVE, 0, 0, 0, 0, 0, 0);
                msg.Label  = path;
                msg.Label2 = String.Format("({0}) {1}", path, driveName);
                GUIGraphicsContext.SendMessage(msg);
                return(true);
            }
            else if (Utils.IsDVD(path))
            {
                Log.Debug("Detected new optical media: {0}", volumeLetter);
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VOLUME_INSERTED, 0, 0, 0, 0, 0, 0);
                msg.Label = path;
                GUIGraphicsContext.SendMessage(msg);
                return(true);
            }
            return(false);
        }
コード例 #8
0
        public override void OnAction(Action action)
        {
            base.OnAction(action);
            if (Focus)
            {
                if (action.wID == Action.ActionType.ACTION_MOUSE_CLICK || action.wID == Action.ActionType.ACTION_SELECT_ITEM)
                {
                    _isSelected = !_isSelected;

                    // If this button has a click setting then execute the setting.
                    if (_onclick.Length != 0)
                    {
                        GUIPropertyManager.Parse(_onclick, GUIExpressionManager.ExpressionOptions.EVALUATE_ALWAYS);
                    }

                    if (_hyperLinkWindowId >= 0)
                    {
                        GUIWindowManager.ActivateWindow(_hyperLinkWindowId);
                        return;
                    }
                    // button selected.
                    // send a message
                    int iParam = 1;
                    if (!_isSelected)
                    {
                        iParam = 0;
                    }
                    var message = new GUIMessage(GUIMessage.MessageType.GUI_MSG_CLICKED, WindowId, GetID, ParentID, iParam, 0, null);
                    GUIGraphicsContext.SendMessage(message);
                }
            }
        }
コード例 #9
0
            /// <summary>
            /// Function which will be called by the begininvoke() to
            /// start an asynchronous download
            /// </summary>
            /// <param name="ftp"></param>
            private void StartDownLoad(object sender, DoWorkEventArgs e)
            {
                try
                {
                    //Thread.CurrentThread.Priority = ThreadPriority.BelowNormal;
                    Thread.CurrentThread.Name = "FtpConnection";
                    BytesTransferred          = 0;
                    BytesOffset = 0;

                    Connection.TransferNotifyInterval = 65535; //send notify after receiving 64KB

                    Connection.CommandSent        += new FTPMessageHandler(Connection_CommandSent);
                    Connection.ReplyReceived      += new FTPMessageHandler(Connection_ReplyReceived);
                    Connection.TransferStartedEx  += new TransferHandler(Connection_TransferStartedEx);
                    Connection.TransferCompleteEx += new TransferHandler(Connection_TransferCompleteEx);
                    Connection.BytesTransferred   += new BytesTransferredHandler(OnBytesTransferred);
                    Connection.TransferType        = FTPTransferType.BINARY;

                    Log.Info("FTPConnection: Start download: {0}->{1}", RemoteFileName, LocalFileName);
                    if (System.IO.File.Exists(LocalFileName))
                    {
                        FileInfo info = new FileInfo(LocalFileName);
                        BytesOffset = info.Length;
                        Connection.Resume();
                    }


                    GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_FILE_DOWNLOADING, 0, 0, 0, 0, 0, null);
                    msg.Label  = OriginalRemoteFileName;
                    msg.Label2 = LocalFileName;
                    msg.Param1 = (int)(BytesTransferred + BytesOffset);
                    GUIGraphicsContext.SendMessage(msg);

                    Connection.Get(LocalFileName, RemoteFileName);
                    Connection.BytesTransferred -= new BytesTransferredHandler(OnBytesTransferred);
                    Log.Info("FTPConnection: Download finished: {0}->{1}", RemoteFileName, LocalFileName);
                }
                catch (Exception ex)
                {
                    Log.Warn("FTPConnection: Download of {0} stopped", LocalFileName);
                    Log.Error(ex);
                }
                finally
                {
                    Connection.TransferStartedEx -= new TransferHandler(Connection_TransferStartedEx);
                    Connection.CommandSent       -= new FTPMessageHandler(Connection_CommandSent);
                    Connection.ReplyReceived     -= new FTPMessageHandler(Connection_ReplyReceived);
                    Connection.BytesTransferred  -= new BytesTransferredHandler(OnBytesTransferred);
                    if (Connection.Connected)
                    {
                        Connection.QuitImmediately();
                    }
                    BytesTransferred = 0;
                    BytesOffset      = 0;
                    Busy             = false;
                }
            }
コード例 #10
0
        /// <summary>
        /// Extracts the Volume letter and sends a gui message with the extracted volume letter so that other plugins can remove this drive out of there virtual directory
        /// </summary>
        /// <param name="volumeInformation">Volume Informations</param>
        /// <returns>true, if the message was handled; false otherwise</returns>
        private static bool DeviceRemoved(DEV_BROADCAST_VOLUME volumeInformation)
        {
            char   volumeLetter = GetVolumeLetter(volumeInformation.UnitMask);
            string path         = (volumeLetter + @":").ToUpperInvariant();

            if (DaemonTools.GetLastVirtualDrive() == path)
            {
                Log.Debug("Ignoring Microsoft Virtual DVD-ROM device change event. Drive letter: {0}", path);
                return(true);
            }

            _volumeRemovalTime = DateTime.Now;
            TimeSpan tsMount;

            if (_mountTime == _mountDetectedTime) // Time not init
            {
                tsMount = DateTime.Now - _volumeInsertTime;
            }
            else
            {
                tsMount = DateTime.Now - _mountTime;
            }
            TimeSpan tsExamineCD    = DateTime.Now - _examineCDTime;
            TimeSpan tsVolumeInsert = DateTime.Now - _volumeInsertTime;

            if (!Utils.IsDVD(path))
            {
                Log.Debug("Detected device remove: {0}", volumeLetter);
                var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_REMOVE_REMOVABLE_DRIVE, 0, 0, 0, 0, 0, 0)
                {
                    Label  = path,
                    Label2 = String.Format("({0})", path)
                };
                GUIGraphicsContext.SendMessage(msg);
                return(true);
            }
            if (Utils.IsDVD(path))
            {
                // AnyDVD is causing media removed & inserted events when Mount/Unmount Volume
                // We need to filter out those as it could trigger false autoplay event
                if (tsExamineCD.TotalMilliseconds < _volumeRemovalDelay || tsMount.TotalMilliseconds < _volumeRemovalDelay || tsVolumeInsert.TotalMilliseconds < _volumeRemovalDelay)
                {
                    Log.Debug("Ignoring volume removed event - drive {0} - time after Mount {1} s", volumeLetter, tsMount.TotalMilliseconds / 1000);
                    return(false);
                }
                Log.Debug("Detected optical media removal: {0}", volumeLetter);
                Log.Debug("  time after ExamineCD {0} s", tsExamineCD.TotalMilliseconds / 1000);
                var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VOLUME_REMOVED, 0, 0, 0, 0, 0, 0)
                {
                    Label = path
                };
                GUIGraphicsContext.SendMessage(msg);
                return(true);
            }
            return(false);
        }
コード例 #11
0
        /// <summary>
        /// Extracts the Volume letter and sends a gui message with the extracted volume letter so that other plugins can add this drive out of there virtual directory
        /// </summary>
        /// <param name="volumeInformation">Volume Informations</param>
        /// <returns>true, if the message was handled; false otherwise</returns>
        private static bool DeviceNew(DEV_BROADCAST_VOLUME volumeInformation)
        {
            char   volumeLetter = GetVolumeLetter(volumeInformation.UnitMask);
            string path         = (volumeLetter + @":").ToUpperInvariant();
            string driveName    = Utils.GetDriveName(path);

            _volumeInsertTime = DateTime.Now;
            TimeSpan tsMount;

            if (_mountTime == _mountDetectedTime) // Time not init
            {
                tsMount = DateTime.Now - _volumeInsertTime;
            }
            else
            {
                tsMount = DateTime.Now - _mountTime;
            }

            TimeSpan tsExamineCD     = DateTime.Now - _examineCDTime;
            TimeSpan tsVolumeRemoval = DateTime.Now - _volumeRemovalTime;

            if (Utils.IsRemovable(path) || Utils.IsHD(path))
            {
                Log.Debug("Detected new device: {0}", volumeLetter);
                var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ADD_REMOVABLE_DRIVE, 0, 0, 0, 0, 0, 0)
                {
                    Label  = path,
                    Label2 = String.Format("({0}) {1}", path, driveName)
                };
                GUIGraphicsContext.SendMessage(msg);
                return(true);
            }
            if (Utils.IsDVD(path))
            {
                // AnyDVD is causing media removed & inserted events when waking up from S3/S4
                // We need to filter out those as it could trigger false autoplay event
                if (tsExamineCD.TotalMilliseconds < _volumeRemovalDelay ||
                    (tsVolumeRemoval.TotalMilliseconds < _volumeRemovalDelay || tsMount.TotalMilliseconds < _volumeRemovalDelay))
                {
                    Log.Debug("Ignoring volume inserted event - drive {0} - timespan mount {1} s",
                              volumeLetter, tsMount.TotalMilliseconds / 1000);
                    Log.Debug("   _volumeRemovalDelay = {0}", _volumeRemovalDelay);
                    return(false);
                }

                Log.Debug("Detected new optical media: {0}", volumeLetter);
                var msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VOLUME_INSERTED, 0, 0, 0, 0, 0, 0)
                {
                    Label = path
                };
                GUIGraphicsContext.SendMessage(msg);
                return(true);
            }
            return(false);
        }
コード例 #12
0
ファイル: NotifyManager.cs プロジェクト: rob-opsi/ARGUS-TV
 private bool NotifyProgram(UpcomingProgram program)
 {
     lock (this)
     {
         GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_NOTIFY_TV_PROGRAM, 0, 0, 0, 0, 0, null);
         msg.Object = program;
         GUIGraphicsContext.SendMessage(msg);
         msg = null;
         return(true);
     }
 }
コード例 #13
0
    private static void RefreshRateShowNotification(string msg, bool waitForFullscreen)
    {
      if (GUIGraphicsContext.IsFullScreenVideo == waitForFullscreen)
      {
        GUIMessage guiMsg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_REFRESHRATE_CHANGED, 0, 0, 0, 0, 0, null);
        guiMsg.Label = "Refreshrate";
        guiMsg.Label2 = msg;
        guiMsg.Param1 = 5;

        GUIGraphicsContext.SendMessage(guiMsg);
      }
    }
コード例 #14
0
        private bool Notify(string heading, string mainMsg, Channel channel)
        {
            Log.Info("send rec notify");
            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_NOTIFY_REC, 0, 0, 0, 0, 0, null);

            msg.Label  = heading;
            msg.Label2 = mainMsg;
            msg.Object = channel;
            GUIGraphicsContext.SendMessage(msg);
            msg = null;
            Log.Info("send rec notify done");
            return(true);
        }
コード例 #15
0
        /// <summary>
        /// Selects the specified item in the facade
        /// </summary>
        /// <param name="self"></param>
        /// <param name="index">index of the item</param>
        public static void SelectIndex(this GUIFacadeControl self, int index)
        {
            if (index > self.Count)
            {
                index = 0;
            }
            if (index == self.Count)
            {
                index--;
            }
            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECT, self.WindowId, 0, self.GetID, index, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
コード例 #16
0
        private void OnSkinChanged()
        {
            // Backup the buttons, needed later
            BackupButtons();

            // Set the skin to the selected skin and reload GUI
            GUIGraphicsContext.Skin = btnSkin.Label;
            SaveSettings();
            GUITextureManager.Clear();
            GUITextureManager.Init();
            SkinSettings.Load();
            GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
            GUIFontManager.InitializeDeviceObjects();
            GUIExpressionManager.ClearExpressionCache();
            GUIControlFactory.ClearReferences();
            GUIControlFactory.LoadReferences(GUIGraphicsContext.GetThemedSkinFile(@"\references.xml"));
            GUIWindowManager.OnResize();
            GUIWindowManager.ActivateWindow(GetID);
            GUIControl.FocusControl(GetID, btnSkin.GetID);

            // Apply the selected buttons again, since they are cleared when we reload
            RestoreButtons();
            using (Settings xmlreader = new MPSettings())
            {
                xmlreader.SetValue("general", "skinobsoletecount", 0);
                bool autosize = xmlreader.GetValueAsBool("gui", "autosize", true);
                if (autosize && !GUIGraphicsContext.Fullscreen)
                {
                    try
                    {
                        GUIGraphicsContext.form.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                        //Form.ActiveForm.ClientSize = new Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("OnSkinChanged exception:{0}", ex.ToString());
                        Log.Error(ex);
                    }
                }
            }
            if (BassMusicPlayer.Player != null && BassMusicPlayer.Player.VisualizationWindow != null)
            {
                BassMusicPlayer.Player.VisualizationWindow.Reinit();
            }

            // Send a message that the skin has changed.
            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SKIN_CHANGED, 0, 0, 0, 0, 0, null);

            GUIGraphicsContext.SendMessage(msg);
        }
コード例 #17
0
ファイル: GUIPresenter.cs プロジェクト: brownard/MyEmulators2
 void setFacadeIndex(int index)
 {
     facade.SelectedListItemIndex = index;
     if (facade.CurrentLayout == GUIFacadeControl.Layout.Filmstrip)
     {
         //Workaround for filmstrip selected index
         GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECT, facade.WindowId, 0, facade.FilmstripLayout.GetID, index, 0, null);
         GUIGraphicsContext.SendMessage(msg);
     }
     else if (facade.CurrentLayout == GUIFacadeControl.Layout.CoverFlow)
     {
         facade.CoverFlowLayout.SelectCard(index); //this is dizzying on large lists, is there a better way??
     }
 }
コード例 #18
0
        protected void OnUp()
        {
            Action action = new Action();

            action.wID = Action.ActionType.ACTION_MOVE_UP;
            _upDownControl.OnAction(action);
            if (!_upDownControl.Focus)
            {
                Focus = false;
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_SETFOCUS, WindowId, GetID, _upControlId,
                                                (int)action.wID, 0, null);
                GUIGraphicsContext.SendMessage(msg);
            }
        }
コード例 #19
0
        private void ProcessNotifies(DateTime preNotifySecs)
        {
            if (_notifiesListChanged)
            {
                LoadNotifies();
                _notifiesListChanged = false;
            }
            if (_notifiesList != null && _notifiesList.Count > 0)
            {
                foreach (Program program in _notifiesList)
                {
                    if (System.DateTime.Now > program.EndTime)
                    {
                        Log.Debug("Notify auto cancel old program {0} on {1} ended {2}", program.Title, program.ReferencedChannel().DisplayName,
                                  program.EndTime);
                        program.Notify = false;
                        program.Persist();

                        _notifiesList.Remove(program);

                        return;
                    }

                    if (preNotifySecs > program.StartTime)
                    {
                        Log.Info("Notify {0} on {1} start {2}", program.Title, program.ReferencedChannel().DisplayName,
                                 program.StartTime);
                        program.Notify = false;
                        program.Persist();
                        TVProgramDescription tvProg = new TVProgramDescription();
                        tvProg.Channel     = program.ReferencedChannel();
                        tvProg.Title       = program.Title;
                        tvProg.Description = program.Description;
                        tvProg.Genre       = program.Genre;
                        tvProg.StartTime   = program.StartTime;
                        tvProg.EndTime     = program.EndTime;

                        _notifiesList.Remove(program);
                        Log.Info("send notify");
                        GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_NOTIFY_TV_PROGRAM, 0, 0, 0, 0, 0, null);
                        msg.Object = tvProg;
                        GUIGraphicsContext.SendMessage(msg);
                        msg = null;
                        Log.Info("send notify done");
                        return;
                    }
                }
            }
        }
コード例 #20
0
 /// <summary>
 /// OnAction() method. This method gets called when there's a new action like a
 /// keypress or mousemove or... By overriding this method, the control can respond
 /// to any action
 /// </summary>
 /// <param name="action">action : contains the action</param>
 public override void OnAction(Action action)
 {
     base.OnAction(action);
     if (Focus)
     {
         if (action.wID == Action.ActionType.ACTION_MOUSE_CLICK || action.wID == Action.ActionType.ACTION_SELECT_ITEM)
         {
             // Send a message that the checkbox was clicked.
             _isSelected = !_isSelected;
             GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_CLICKED, WindowId, GetID, ParentID,
                                             (int)action.wID, 0, null);
             GUIGraphicsContext.SendMessage(msg);
         }
     }
 }
コード例 #21
0
        /// <summary>
        /// OnAction() method. This method gets called when there's a new action like a
        /// keypress or mousemove or... By overriding this method, the control can respond
        /// to any action
        /// </summary>
        /// <param name="action">action : contains the action</param>
        public override void OnAction(Action action)
        {
            if (!GUIGraphicsContext.MouseSupport)
            {
                IsVisible = false;
                return;
            }
            if (action.wID == Action.ActionType.ACTION_MOUSE_CLICK)
            {
                int  id;
                bool focus;
                if (HitTest((int)action.fAmount1, (int)action.fAmount2, out id, out focus))
                {
                    if (action.MouseButton == MouseButtons.Left)
                    {
                        float fHeight = (float)(_endPositionY - _startPositionY);
                        _percentage  = (action.fAmount2 - (float)_startPositionY);
                        _percentage /= fHeight;
                        _percentage *= 100.0f;

                        if (_sendNotifies)
                        {
                            GUIMessage message = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PERCENTAGE_CHANGED, WindowId, GetID,
                                                                GetID, (int)_percentage, 0, null);
                            GUIGraphicsContext.SendMessage(message);
                        }
                    }
                }
            }

            if (action.wID == Action.ActionType.ACTION_MOUSE_MOVE)
            {
                if (action.MouseButton == MouseButtons.Left)
                {
                    float fHeight = (float)(_endPositionY - _startPositionY);
                    _percentage  = (action.fAmount2 - (float)_startPositionY);
                    _percentage /= fHeight;
                    _percentage *= 100.0f;
                    if (_sendNotifies)
                    {
                        GUIMessage message = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PERCENTAGE_CHANGED, WindowId, GetID,
                                                            GetID, (int)_percentage, 0, null);
                        GUIGraphicsContext.SendMessage(message);
                    }
                }
            }
            base.OnAction(action);
        }
コード例 #22
0
            /// <summary>
            /// callback from the ftp library when some data has been transferred
            /// We just send a message to the current window so it can update its status
            /// </summary>
            /// <param name="ftpClient"></param>
            /// <param name="bytesTransferred"></param>
            private void OnBytesTransferred(object ftpClient, BytesTransferredEventArgs bytesTransferred)
            {
                try
                {
                    BytesTransferred = bytesTransferred.ByteCount;

                    GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_FILE_DOWNLOADING, 0, 0, 0, 0, 0, null);
                    msg.Label  = OriginalRemoteFileName;
                    msg.Label2 = LocalFileName;
                    msg.Param1 = (int)(BytesTransferred + BytesOffset);
                    GUIGraphicsContext.SendMessage(msg);
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                }
            }
コード例 #23
0
        public string GetNextSong()
        {
            PlayListItem item = GetNextItem();

            if (item == null)
            {
                return(string.Empty);
            }

            _currentItem++;

            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS, 0, 0, 0, _currentItem, 0, null);

            msg.Label = item.FileName;
            GUIGraphicsContext.SendMessage(msg);

            return(item.FileName);
        }
コード例 #24
0
        private void onStopExternal(Process proc, bool waitForExit)
        {
            if (!listenToExternalPlayerEvents)
            {
                return;
            }

            MPTVSeriesLog.Write("Playback Stopped in External Player");
            SetAsWatched();
            PlayNext();
            if (!g_Player.Playing)
            {
                g_Player.Release();

                // Clear focus when playback ended
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS, 0, 0, 0, -1, 0, null);
                GUIGraphicsContext.SendMessage(msg);
            }
        }
コード例 #25
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}");
            }
        }
コード例 #26
0
        public static void ShowAuto3DMessage(String msg, bool forceMPGUI, int seconds)
        {
            try
            {
                if (msg == null)
                {
                    return;
                }
                Form mainForm = Auto3DHelpers.GetMainForm();

                if (Auto3DHelpers.GetMainForm().IsDisposed)
                {
                    return;
                }

                if (mainForm.InvokeRequired)
                {
                    mainForm.Invoke(new ShowMessageDelegate(ShowAuto3DMessage), msg, forceMPGUI, seconds);
                    return;
                }

                if (GUIGraphicsContext.IsFullScreenVideo || forceMPGUI)
                {
                    GUIMessage guiMsg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_REFRESHRATE_CHANGED, 0, 0, 0, 0, 0, null);

                    guiMsg.Label  = "Auto3D";
                    guiMsg.Label2 = msg;
                    guiMsg.Param1 = seconds;

                    GUIGraphicsContext.SendMessage(guiMsg);
                }
                else
                {
                    MessageBox.Show(msg, "Auto3D");
                }
            }
            catch (Exception ex)
            {
                Log.Error("ShowAuto3DMessage failed: " + ex.Message);
            }
        }
コード例 #27
0
        public override void OnAction(Action action)
        {
            base.OnAction(action);
            GUIMessage message;

            if (Focus)
            {
                if (action.wID == Action.ActionType.ACTION_MOUSE_CLICK || action.wID == Action.ActionType.ACTION_SELECT_ITEM)
                {
                    // If this button corresponds to an action generate that action.
                    if (ActionID >= 0)
                    {
                        Action newaction = new Action((Action.ActionType)ActionID, 0, 0);
                        GUIGraphicsContext.OnAction(newaction);
                        return;
                    }

                    message = new GUIMessage(GUIMessage.MessageType.GUI_MSG_CLICKED, WindowId, GetID, ParentID, 0, 0, null);
                    GUIGraphicsContext.SendMessage(message);
                }
            }
        }
        internal void PlayRecording(int index)
        {
            RecordingSummary recSummary = (RecordingSummary)latestArgusRecordings[index];
            Recording        rec        = null;

            rec = Proxies.ControlService.GetRecordingById(recSummary.RecordingId).Result;

            int jumpToTime = 0;

            if (rec.LastWatchedPosition.HasValue)
            {
                if (rec.LastWatchedPosition.Value > 10)
                {
                    jumpToTime = rec.LastWatchedPosition.Value;
                }
            }
            if (jumpToTime == 0)
            {
                DateTime startTime = DateTime.Now.AddSeconds(-10);
                if (rec.ProgramStartTime < startTime)
                {
                    startTime = rec.ProgramStartTime;
                }
                TimeSpan preRecordSpan = startTime - rec.RecordingStartTime;
                jumpToTime = (int)preRecordSpan.TotalSeconds;
            }


            //send a message to the Argus plugin, to start playing the recording
            //I use this "GUI_MSG_RECORDER_VIEW_CHANNEL" event because it's a save one to use(no other components in mediaportal listen to this event)
            GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_RECORDER_VIEW_CHANNEL, 0, 0, 0, 0, 0, null);

            msg.Object = rec;
            msg.Param2 = jumpToTime;
            msg.Param1 = 5577; //just some indentification
            GUIGraphicsContext.SendMessage(msg);
            msg = null;
        }
コード例 #29
0
        protected override void OnDefaultAction(Action action)
        {
            if (currentSelection == Selection.Down || currentSelection == Selection.Up)
            {
                // don't send the messages to a dialog menu
                if ((WindowId != (int)GUIWindow.Window.WINDOW_DIALOG_MENU) ||
                    (action.wID == Action.ActionType.ACTION_SELECT_ITEM))
                {
                    GUIMessage.MessageType msgType = GUIMessage.MessageType.GUI_MSG_CLICKED_UP;
                    if (currentSelection == Selection.Down)
                    {
                        msgType = GUIMessage.MessageType.GUI_MSG_CLICKED_DOWN;
                    }

                    GUIMessage msg = new GUIMessage(msgType, WindowId, GetID, ParentID, (int)action.wID, 0, null);
                    GUIGraphicsContext.SendMessage(msg);
                }
            }
            else
            {
                base.OnDefaultAction(action);
            }
        }
コード例 #30
0
 /// <summary>
 /// Callback from the FTP client. This is called when a file has been downloaded
 /// We're just sending a message to the current window so it can update its view
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void Connection_TransferCompleteEx(object sender, TransferEventArgs e)
 {
     Log.Info("FTPConnection: Transfer completed: {0}->{1}", e.RemoteFilename, e.LocalFilePath);
     try
     {
         FTPClient ftpclient = sender as FTPClient;
         foreach (FtpConnection client in ftpConnections)
         {
             if (client.Connection == ftpclient)
             {
                 GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_FILE_DOWNLOADED, 0, 0, 0, 0, 0, null);
                 msg.Label  = client.OriginalRemoteFileName;
                 msg.Label2 = client.LocalFileName;
                 GUIGraphicsContext.SendMessage(msg);
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex);
     }
 }