Threading issue Help Please
I'v put in a Media Player that i made into my current project and working on using the System.Threading;
My First time really applying the Threading so i need some help with assigning a toolStripButton for the MediaPlayer using Threading and BackgroundWorker this is what i have so far..
Code:
using System;
using System.Threading;
using System.Runtime;
// didnt put in all the Using..
namespace MediaViewer
{
using WMPLib;
using MediaPlayer;
public partial class Form1 : Form
{
private Thread MediaThread = null;
private BackgroundWorker BackgroundWorker1;
{
public Form1()
{
InitializeComponent();
}
private toolStripButton2_Click(object sender, EventArgs e)
{
MediaThread = new Thread(new ThreadStart(this.RunMethod));
if (sender == toolStripButton2)
{
Application.Exit();
if (MediaThread.IsAlive)
MediaThread.Abort();
if (Thread.CurrentThread.IsAlive)
Thread.CurrentThread.Abort();
}
}
private void RunMethod
{
Thread.CurrentThread.IsBackground.GetType();
MediaThread.Start()
// this is where i want too MediaPlayer to run using the toolStripButton2_Click
while using the Thread & BackgroundWorker
}
So any help with this is greatly appreciated i always give out Reputation Points, My 1st time using Threading and BackgroundWorker
Re: Threading issue Help Please
you need help to start the MediaPlayer.exe by clicking on the button? Or you need help to create the striptoolbutton?
Re: Threading issue Help Please
I want the MediaPlayer to have its own Thread..But yes i need the MediaPlayer to Run using the ToolStripButton2 that i already have....
Using Windows Media Player SDK 10 dotnet sample for C#...I'v imported it into my current project...
Re: Threading issue Help Please
Then you might want to use the Thread class.
Re: Threading issue Help Please
but can i ask why you wish for the media player to be in a different thread?