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 7075821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:13:25+00:00 2026-05-28T06:13:25+00:00

My main MainWindow.xaml.cs has a lot of Task variables and as a consequence a

  • 0

My main MainWindow.xaml.cs has a lot of Task variables and as a consequence a lot of

 private void ContentManagerUpdateUI()
        {
            // ... UI update work here ... 
        }

        private void StartContentManager()
        {
            contentManager = Task.Factory.StartNew(() => { ContentManagerJob(); }, TaskCreationOptions.LongRunning);
            contentManager.ContinueWith((t) => { ContentManagerUpdateUI(); }, TaskScheduler.FromCurrentSynchronizationContext());
        }


 private void ContentManagerJob()
        {
...

}

My question is if there is any best way to take these methods away from the main file?

I just want to make code more logical and cleaner.

Thank you!

==================================

P.S. Hey… I use #region … #endregion 🙂 But I guess it must be implemented with some static classes or something that lives outside of MainWindow.xaml.cs…
Also I don’t think about MVVM because this application doesn’t have any user’s input at all.

May be I have to redefine my question… I mean what is the best way to arrange multiple variables and methods of Task class of MS TPL.

  • 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-28T06:13:25+00:00Added an answer on May 28, 2026 at 6:13 am

    I am not quite sure whether i understood your question but if you want to logically structure your code without altering its meaning try to think about partial classes.

    The .cs code-behind file of a XAML file is declared as partial by default so you can add as much additional partial classes as you want. Of course you have to meet the restrictions for using partial class e.g. all classes that are declared as partial have to be in the same namespace but you find plenty of information on that over the internet.

    Hope this helps 🙂

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

Sidebar

Related Questions

My Application's designed by MVVM. Main window is MainWindow.xaml as below. Main Window has
There is solution with two projects: WPFProject and WPFResources . WPFProject has MainWindow.xaml. WPFResources
My app's main UI is in MainWindow.xaml. Firstly - what is causing this to
In my WPF application, I have a main window (Branch.xaml) which has a button
I have 2 views (first view - custom user control, MainWindow view - main
I have a window(say main window) with a frame which has a page in
My swing app has a main window which has sever buttons. This JFrame is
I am working on an app whose main window has an NSDrawer. It is
I want to create an application which main window has canvas (or something where
I have a WPF application which has a main window composed from several custom

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.