Multiple process

Discussion in 'C#' started by AnujAngural, Sep 18, 2010.

  1. #1
    I have created one class library in which i added one web form(ModuleTest.cs)

    then i build this class library and added reference to a website.

    Then i place one button on page of website and on button click it call methos of my classlibrary.



    BUTTON-->

    protected void Button1_Click(object sender, EventArgs e)
    {
    Thread thread = new Thread(new ThreadStart(STAOparation));
    thread.SetApartmentState(ApartmentState.STA);
    thread.Start();
    thread.Join();
    while (thread.IsAlive) System.Windows.Forms.Application.DoEvents();


    }
    public void STAOparation()
    {
    ModuleTest obj = new ModuleTest();

    List<CustumFields> objlist = new List<CustumFields>();
    obj.CheckModule("admin", "passsword", "Testing102", objlist);

    }



    MODULETEST.CS-->>



    public void CheckModule(String username, String password, String modulename, List<CustumFields> objList)

    {

    timer1.enable=true;

    }



    private void timer1_Tick(object sender, EventArgs e)
    {
    if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
    {
    if (count == 5)
    {
    OpenNewForm();
    }
    if (count == 4)
    {
    Deploy();
    }
    if (count == 3)
    {
    back();
    }
    if (count == 2)
    {
    AddTypeOfModule();
    }
    if (count == 1)
    {
    NewModule();
    }
    if (count == 0)
    {
    AddModule();
    }
    }
    }



    So now my problem is when i call the method the timer starts but it stops when the controls goes back to website calling method.What i want is to continue this timer in the background process. How to do that please help me????????????????
     
    AnujAngural, Sep 18, 2010 IP
  2. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    timer1.enable=true;

    timer1.enabled=true; ???
     
    camjohnson95, Sep 22, 2010 IP
  3. rachel.anthony12

    rachel.anthony12 Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes..I agree wit the above code..Try using timer1.enabled=true.
     
    rachel.anthony12, Sep 27, 2010 IP