Results 1 to 5 of 5

Thread: Threading issue Help Please

  1. #1

    Thread Starter
    Hyperactive Member Rattlerr's Avatar
    Join Date
    Jul 2005
    Location
    FloralCity,Florida
    Posts
    269

    Question 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
    Last edited by Rattlerr; Mar 2nd, 2006 at 04:59 PM. Reason: New Code Insertion

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    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?

  3. #3

    Thread Starter
    Hyperactive Member Rattlerr's Avatar
    Join Date
    Jul 2005
    Location
    FloralCity,Florida
    Posts
    269

    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...

  4. #4
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: Threading issue Help Please

    Then you might want to use the Thread class.

  5. #5
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: Threading issue Help Please

    but can i ask why you wish for the media player to be in a different thread?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width