Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6996037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:06:21+00:00 2026-05-27T20:06:21+00:00

Complete C# newbie here, so cut me some slack. I have this application that

  • 0

Complete C# newbie here, so cut me some slack.

I have this application that will live on the tray. When I click the tray I want to access a “settings” form. This is all coded and working.

However, the main feature of this app is to connect to an application written in node.js and keep polling for things to do.

This is also coded and working, however there is a (horrible) caveat.

The main class does this:

static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Form1 form = new Form1();
        ApplicationContext applicationContext = new ApplicationContext();
        applicationContext.MainForm = form;
        Application.Run(applicationContext);
    }
}

In order to run with the form hidden. And the main app cycle is taking place in the form Load event:

    private void Form1_Load(object sender, EventArgs e)
    {
        string basePath = Path.Combine(
            Environment.GetFolderPath(Environment.SpecialFolder.Personal),
            "ArchSync"
        );

        if (!Directory.Exists(basePath)) {
            Directory.CreateDirectory(basePath);
        }

        WebClient client = new WebClient();
        Int64 timestamp = 0;
        while (true)
        {
            // main app loop
        }
    }

Needless to say, this application works but the tray icon does nothing, since the main Thread is busy doing HTTP interactions.

What is the correct way to execute the main application loop outside the UI thread?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:06:21+00:00Added an answer on May 27, 2026 at 8:06 pm

    You can use Thread.Start from the System.Threading namespace. But if you want to update UI from the worker thread, these easiest way to do it, is to use a BackgroudWorker from the System.ComponentModel namespace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

RSpec newbie here. I'm trying to test my models, which have methods that uses
I'm a complete jquery newbie, but I'm following this tutorial here to get me
I'm a complete rails newbie, so forgive me if this is trivial. I have
I'm a complete newbie in ruby but I can feel that this code can
First, fair warning: I am a complete newbie with C# and WPF. I have
Willing to admit I'm a complete .NET newbie, but I have extensive experience in
I’m writing an objective-c program that does some calculations based on time and will
I am a complete newbie in working with a Ruby on Rails (RoR) application.
VS2008/C# newbie here. If I open our project, have no code files open, and
I'm a complete newbie to C# so excuse me if this looks weird. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.