Click here to Skip to main content
15,888,803 members
Home / Discussions / C#
   

C#

 
AnswerRe: Get string in a function using Socket server Pin
lukeer22-Jul-13 23:39
lukeer22-Jul-13 23:39 
QuestionApplication Settings Pin
Midnight Ahri22-Jul-13 18:31
Midnight Ahri22-Jul-13 18:31 
QuestionRe: Application Settings Pin
Kenneth Haugland22-Jul-13 22:48
mvaKenneth Haugland22-Jul-13 22:48 
AnswerRe: Application Settings Pin
Midnight Ahri22-Jul-13 23:40
Midnight Ahri22-Jul-13 23:40 
AnswerRe: Application Settings Pin
lukeer22-Jul-13 23:09
lukeer22-Jul-13 23:09 
AnswerRe: Application Settings Pin
Midnight Ahri22-Jul-13 23:47
Midnight Ahri22-Jul-13 23:47 
GeneralRe: Application Settings Pin
Eddy Vluggen23-Jul-13 0:29
professionalEddy Vluggen23-Jul-13 0:29 
QuestionResponsive UI - WPF with Properties Pin
SynergiAios22-Jul-13 15:09
SynergiAios22-Jul-13 15:09 
I have the following Setup:

1) The WPF Thread itself (the MainWindow), which stores the Controls to Display my Content, and the Thread Safe Properties with the content to display.

2) The Update Thread (System.Threading.Thread, not BackgreoundWorker). This Thread updates the Properties of the WPF Thread.

3) The Draw Thread (System.Threading.Thread, not BackgreoundWorker), which actually manipulates the Controls of the WPF Thread (Adding Canvas, Removing Canvas, Setting Text, ...)

My Main problem is the thing, that the WPF Thread is storing the Thread Safe Properties. My Update Routine and Draw Routine are both called very very often (1000 Times a secound).

And thats exactly the problem. The WPF Thread is totally blocked due to the many Get, Set Operations of the other both Threads.

So my first Question is, does someone has an Idea where to store these Properties so the main WPF Thread isn't blocked?

My Secound Problem is the following:

The Update and Draw Thread are both working with the Dispatcher of the WPF thread. If they execute 1000 Times a secound the Dispatcher just runs out of mem (because of too many actions in queue). Is there a way to measure how many actions are in queue and to know if to store another or not. And Secound is there a way to say "Now execute the queue".

I know i can get the state of each dispatcher Object i add. But i don't want to wait till each action is e executed. I want to add as much as possible, so the Update and Draw Thread can run as fast as possible.

My Third side Question is, is my Concept to use WPF for this stupid, or not well planned? Shouldn't i use WPF for this, is there another way to achive my Goal?

My Goal explained:

via Update i have to draw content, very often to be exact, without getting the Part to display the content laggie aka responsive UI.

Please help me with any suggestions or sth else.

As a side Idea i have thought of taking the Thread safe properties into a third thread aka DataThread to store and change, but how can u store Properties into a thread? what is a good way to achive this?

thx in advance

sincerly Synergi

EDIT

Here is an example of one of my Thread Safe Properties. Maybe im loosing much time here. May there is a better Solution for this.

C#
private Nullable<Point> Offset
{
    get
    {
        Nullable<Point> returnValue = null;
        object lockObject = objectPool.Aquire();
        lockObject = this.offset;
        bool locked = false;
        bool aquired = false;
        System.Threading.Monitor.TryEnter(lockObject, ref locked);
        try
        {
            if (locked)
            {
                returnValue = this.offset;
                aquired = true;
            }
        }
        finally
        {
            if (locked && aquired)
            {
                System.Threading.Monitor.Exit(lockObject);
            }
        }

        objectPool.Release(lockObject);

        return returnValue;
    }

    set
    {
        object lockObject = objectPool.Aquire();
        lockObject = this.offset;
        bool locked = false;
        bool aquired = false;
        System.Threading.Monitor.TryEnter(lockObject, ref locked);
        try
        {
            if (locked)
            {
                if (value.HasValue)
                {

                    this.offset = value.Value;
                    aquired = true;
                }
            }
        }
        finally
        {
            if (locked && aquired)
            {
                System.Threading.Monitor.Exit(lockObject);
            }
        }

        objectPool.Release(lockObject);
    }
}


modified 22-Jul-13 21:16pm.

AnswerRe: Responsive UI - WPF with Properties Pin
Dave Kreskowiak22-Jul-13 16:32
mveDave Kreskowiak22-Jul-13 16:32 
GeneralRe: Responsive UI - WPF with Properties Pin
SynergiAios23-Jul-13 0:18
SynergiAios23-Jul-13 0:18 
QuestionOO Design for Specifc Problem Pin
KeithF22-Jul-13 6:17
KeithF22-Jul-13 6:17 
AnswerRe: OO Design for Specifc Problem Pin
KeithF22-Jul-13 21:41
KeithF22-Jul-13 21:41 
AnswerRe: OO Design for Specifc Problem Pin
Eddy Vluggen23-Jul-13 0:30
professionalEddy Vluggen23-Jul-13 0:30 
GeneralRe: OO Design for Specifc Problem Pin
KeithF30-Jul-13 22:49
KeithF30-Jul-13 22:49 
QuestionMicrosoft Expression Encoder with IIS Live Smooth Streaming Issue Pin
Member 1003572121-Jul-13 21:46
Member 1003572121-Jul-13 21:46 
AnswerRe: Microsoft Expression Encoder with IIS Live Smooth Streaming Issue Pin
Dave Kreskowiak22-Jul-13 1:46
mveDave Kreskowiak22-Jul-13 1:46 
QuestionGetGuiThreadInfo can not get the caret's position Pin
goldli8820-Jul-13 23:12
goldli8820-Jul-13 23:12 
QuestionHow to Create Dynamic Buttons With Students Roll No. on It From Database Pin
jackspero1820-Jul-13 1:38
jackspero1820-Jul-13 1:38 
AnswerRe: How to Create Dynamic Buttons With Students Roll No. on It From Database Pin
Garth J Lancaster20-Jul-13 2:05
professionalGarth J Lancaster20-Jul-13 2:05 
QuestionC# unmanage DLL export Pin
hijeenu19-Jul-13 10:32
hijeenu19-Jul-13 10:32 
QuestionUpdate Shorthand? Pin
eddieangel19-Jul-13 8:37
eddieangel19-Jul-13 8:37 
AnswerRe: Update Shorthand? Pin
Dave Kreskowiak19-Jul-13 9:50
mveDave Kreskowiak19-Jul-13 9:50 
AnswerRe: Update Shorthand? Pin
Abhinav S19-Jul-13 18:48
Abhinav S19-Jul-13 18:48 
AnswerRe: Update Shorthand? Pin
Jean A Brandelero22-Jul-13 3:59
Jean A Brandelero22-Jul-13 3:59 
QuestionCalling VB 6 OCX from C# EXE Pin
matinon2219-Jul-13 2:18
matinon2219-Jul-13 2:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.