From: <lk...@us...> - 2008-01-30 06:47:31
|
Revision: 1326 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1326&view=rev Author: lkuech Date: 2008-01-29 22:47:24 -0800 (Tue, 29 Jan 2008) Log Message: ----------- ViewModeSwitcher: To give the TVPlugin time to load, the start of the reflection routine is delayed by 10secs now. Modified Paths: -------------- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs Removed Paths: ------------- trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV02/ trunk/plugins/ViewModeSwitcher/ViewModeSwitcherHelperTV03/ Modified: trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs 2008-01-29 16:51:41 UTC (rev 1325) +++ trunk/plugins/ViewModeSwitcher/TVPluginReflection.cs 2008-01-30 06:47:24 UTC (rev 1326) @@ -29,7 +29,7 @@ { get { - if (CurrentChannelPropInfo == null && State == States.notstarted) Start(); + if (CurrentChannelPropInfo == null && State == States.notstarted) DelayedStart(10000); if (CurrentChannelPropInfo == null && State == States.finished) return string.Empty; return GetCurrentChannelViaReflection(); } @@ -52,32 +52,10 @@ Log.Debug("ViewModeSwitcher: TVPluginReflection: Try to read CurrentTVChannel property"); CurrentChannelPropInfo = AssemblyType.GetProperty("CurrentChannel"); + if (CurrentChannelPropInfo!=null) TVPluginFound = true; + string tmpCurrentTVChannel = GetCurrentChannelViaReflection(); Log.Debug("ViewModeSwitcher: TVPluginReflection: Value was: {0}", tmpCurrentTVChannel); - - //foreach (Type AssemblyType in assembly.GetTypes()) - //{ - // // Wait for the TvPlugin.ChannelNavigator class - // if (AssemblyType.IsClass == true && AssemblyType.FullName == "TvPlugin.ChannelNavigator") - // { - // Log.Debug("ViewModeSwitcher: TVPluginReflection: ...Found Class : {0}", AssemblyType.FullName); - - // // wait for the CurrentChannel property - // foreach (PropertyInfo PropInfo in AssemblyType.GetProperties()) - // { - // if (PropInfo.Name == "CurrentChannel") - // { - // Log.Debug("ViewModeSwitcher: TVPluginReflection: Found Property: {0}", PropInfo.Name); - // CurrentTVChannel = (string)AssemblyType.GetValue(PropInfo); - // Log.Debug("ViewModeSwitcher: TVPluginReflection: Value was: {0}", CurrentTVChannel); - // break; // leave the Properties foreach loop - // } - // } - - // break; // leave the Assembly foreach loop - //} - //} - } catch (Exception e) { @@ -87,6 +65,15 @@ State = States.finished; } + string GetCurrentChannelViaReflection() + { + if (CurrentChannelPropInfo == null || oAssembly == null) + { + return string.Empty; + } + return (string)CurrentChannelPropInfo.GetValue(oAssembly, null); + } + public void DelayedStart(int timeout) { State = States.delayed; @@ -97,17 +84,6 @@ delayTimer.Start(); } - string GetCurrentChannelViaReflection() - { - if (CurrentChannelPropInfo == null || oAssembly == null) - { - TVPluginFound = false; - return string.Empty; - } - TVPluginFound = true; - return (string)CurrentChannelPropInfo.GetValue(oAssembly, null); - } - void delayTimer_Tick(object sender, EventArgs e) { Timer tmpTimer = (Timer)sender; Modified: trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-01-29 16:51:41 UTC (rev 1325) +++ trunk/plugins/ViewModeSwitcher/TVstatusWrapper.cs 2008-01-30 06:47:24 UTC (rev 1326) @@ -19,6 +19,8 @@ { get { + if (TVPluginReference.State == TVPluginReflection.States.delayed) return string.Empty; + if (TVPluginReference.State == TVPluginReflection.States.notstarted) // make sure tvplug is searched via reflection { return TVPluginReference.CurrentTVChannel; Modified: trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs =================================================================== --- trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-01-29 16:51:41 UTC (rev 1325) +++ trunk/plugins/ViewModeSwitcher/ViewModeSwitcher.cs 2008-01-30 06:47:24 UTC (rev 1326) @@ -106,30 +106,35 @@ //GUIGraphicsContext.OnNewAction += new OnActionHandler(OnAction); TvStatus = new TVstatusWrapper(); + Log.Debug("ViewModeSwitcher: test the channel: {0}", TvStatus.CurrentChannelName); } //public void OnAction(Action action) //{ // switch (action.wID) // { - // case Action.ActionType.ACTION_VIEWMODESWITCHER_MENU: + // // case Action.ActionType.ACTION_VIEWMODESWITCHER_MENU: + // // { + // // ShowMenu(); + // // } + // // break; + // // case Action.ActionType.ACTION_VIEWMODESWITCHER_DOWN: + // // { + // // MoveVisibleWindow(MoveDirection.Down); + // // } + // // break; + // // case Action.ActionType.ACTION_VIEWMODESWITCHER_UP: + // // { + // // MoveVisibleWindow(MoveDirection.UP); + // // } + // // break; + // case Action.ActionType.ACTION_SWITCH_HOME: // { - // ShowMenu(); + // Log.Debug("ViewModeSwitcher: test the channel: {0}", TvStatus.CurrentChannelName); // } // break; - // case Action.ActionType.ACTION_VIEWMODESWITCHER_DOWN: - // { - // MoveVisibleWindow(MoveDirection.Down); - // } - // break; - // case Action.ActionType.ACTION_VIEWMODESWITCHER_UP: - // { - // MoveVisibleWindow(MoveDirection.UP); - // } - // break; // } //} - public void ShowMenu_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |