2006-09-19, 05:54 PM
I'm about to post some code. Just build it, stick it in the plugin directly, and run config to initialize it or whatever. It doesn't need a skin file.
So anyway, here are some steps to take to demonstrate the problem:
Oh, I almost forgot.
So anyway, here are some steps to take to demonstrate the problem:
- From the main men, select Interference (this is the new plugin).
- Black screen. Alternates between "true" and "false." About every second. What we'd expect.
- Press [back/exit] (or escape). Now you're back at the main menu.
- Select Live TV. Wait for it.
- Now press [menu] (not sure what the keyboard equivalent is). Now you're back at the main menu, with the Live TV playing "in the background."
- Now select the Interference plugin. The screen never refreshes. Stays the same. And yet, render() is called.
- Press [back/exit] to return to the Main Menu, close Live TV, then go back into the Main Menu and run the Interference plugin again. It alternates, as expected.
Oh, I almost forgot.
Code:
public class Interference_Task : IMenuTask
{
private string m_Message = "Hiya.";
private string m_Name = "Interference";
private bool m_TickTock = false;
public Interference_Task()
{
}
#region IMenuTask Members
void IMenuTask.Activate()
{
}
void IMenuTask.Deactivate()
{
}
System.Windows.Forms.Form IMenuTask.GetConfigFormInstance(System.Xml.XmlDocument document)
{
return null;
}
void IMenuTask.OnClick(System.Drawing.Point location)
{
}
void IMenuTask.OnDoubleClick(System.Drawing.Point location)
{
}
bool IMenuTask.OnKeyDown(System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == System.Windows.Forms.Keys.Escape)
PluginHelperFactory.getPluginHelper().ReturnToMainMenu();
return true;
}
void IMenuTask.OnMouseWheel(System.Windows.Forms.MouseEventArgs e)
{
}
string IMenuTask.getDescription()
{
return "Smell the purple concrete";
}
string IMenuTask.getName()
{
return m_Name;
}
string IMenuTask.getSkinSubdirectory()
{
return m_Name;
}
System.Drawing.Image IMenuTask.getTaskImage()
{
return null;
}
bool IMenuTask.needsRendering()
{
return true;
}
System.Drawing.Image IMenuTask.render(out bool requiresMoreRendering)
{
requiresMoreRendering = false;
m_TickTock = !m_TickTock;
m_Message = m_TickTock.ToString();
Bitmap canvas = new Bitmap(720, 480);
Graphics g = Graphics.FromImage(canvas);
g.Clear(Color.Black);
RectangleF textArea = new RectangleF(0, 0, canvas.Width, canvas.Height);
StringFormat strFormat = new StringFormat();
strFormat.Alignment = StringAlignment.Center;
strFormat.LineAlignment = StringAlignment.Center;
g.DrawString(m_Message, new Font("Tahoma", 18), Brushes.White,
textArea, strFormat);
return canvas;
}
#endregion
}
WinTV PVR-150 / ATI X1600 512 / 3GHz P4 / 2GB RAM