Click here to Skip to main content
15,887,296 members
Home / Discussions / C#
   

C#

 
GeneralRe: Basic Question: Conversion Pin
Saksida Bojan30-Nov-09 8:06
Saksida Bojan30-Nov-09 8:06 
GeneralRe: Basic Question: Conversion Pin
Saksida Bojan30-Nov-09 8:14
Saksida Bojan30-Nov-09 8:14 
GeneralRe: Basic Question: Conversion Pin
PIEBALDconsult30-Nov-09 8:17
mvePIEBALDconsult30-Nov-09 8:17 
GeneralRe: Basic Question: Conversion Pin
Saksida Bojan30-Nov-09 8:44
Saksida Bojan30-Nov-09 8:44 
GeneralRe: Basic Question: Conversion Pin
PIEBALDconsult30-Nov-09 9:12
mvePIEBALDconsult30-Nov-09 9:12 
GeneralRe: Basic Question: Conversion Pin
Saksida Bojan30-Nov-09 10:05
Saksida Bojan30-Nov-09 10:05 
GeneralRe: Basic Question: Conversion Pin
ThatsAlok30-Nov-09 22:49
ThatsAlok30-Nov-09 22:49 
QuestionMCV Pattern in 2 threads for GUI and Worker ? Pin
User 260419330-Nov-09 6:33
User 260419330-Nov-09 6:33 
Hi!

I am trying to set up a generic framework for applications following the Model Controller View pattern with a (main) GUI thread and a worker thread actually handling the data. I want this to reliable prevent the GUI from freezing and to enforce strict GUI/data/algorithm separation.

My idea is to have one single Worker thread in order to rid me off the problem of having to make all data accesses thread safe(?!), since there is just this one thread accessing the data.

So I would have the main thread containing the GUI and a Worker Thread for Model/Controller. The worker thread would start up when the application starts and close down when the application closes.
For the general setup I could think of a Producer/Consumer pattern with a worker thread that has a ThreadedQueue, that is the GUI thread can dispatch jobs to the Controller in the worker thread wich are then processed in the order they have been enqueued.
For simplicity the Controller can have a state machine (simplest busy/idle) that could actually prevent jobs being enqueued while it's too busy.

Now the practical problem I have is how to set up communication across the threads as needed in the MCV pattern? The main issue I see is that the View might request data from the model while the controller is actually changing this data.

Thus my idea was to have the View issue a job to the controller that requests the data and supplying a callback/delegate to be called from the Controller/Model. Since the callback is called from the Model/Controller thread it is positively thread safe if the callback is blocking and does not return before the data has actually been read by the View (using Invoke() within the GUI Form/Control functions).

Could this work, or did I oversee something obvious here ?
Does anyone know about some good ideas on this or a hint to some article where something similar is described?

modified 2-Aug-18 21:02pm.

AnswerRe: MCV Pattern in 2 threads for GUI and Worker ? Pin
Luc Pattyn30-Nov-09 6:38
sitebuilderLuc Pattyn30-Nov-09 6:38 
QuestionI need help - problem with query builder in c# Pin
TGiril30-Nov-09 6:26
TGiril30-Nov-09 6:26 
QuestionPlease help. Printing datagridview issue... Pin
JollyMansArt30-Nov-09 5:11
JollyMansArt30-Nov-09 5:11 
AnswerRe: Please help. Printing datagridview issue... Pin
JollyMansArt30-Nov-09 11:23
JollyMansArt30-Nov-09 11:23 
QuestionRegex question Pin
kanchoette30-Nov-09 4:28
kanchoette30-Nov-09 4:28 
AnswerRe: Regex question Pin
OriginalGriff30-Nov-09 4:47
mveOriginalGriff30-Nov-09 4:47 
AnswerRe: Regex question PinPopular
PIEBALDconsult30-Nov-09 4:58
mvePIEBALDconsult30-Nov-09 4:58 
QuestionHow to Get the MSI installer Path Pin
coolpjmartin30-Nov-09 4:27
coolpjmartin30-Nov-09 4:27 
AnswerRe: How to Get the MSI installer Path Pin
The Man from U.N.C.L.E.30-Nov-09 7:43
The Man from U.N.C.L.E.30-Nov-09 7:43 
Questionregular expression in c# [modified] Pin
benjamin yap30-Nov-09 1:29
benjamin yap30-Nov-09 1:29 
AnswerRe: regular expression in c# Pin
vivasaayi30-Nov-09 2:07
vivasaayi30-Nov-09 2:07 
AnswerRe: regular expression in c# Pin
PIEBALDconsult30-Nov-09 5:06
mvePIEBALDconsult30-Nov-09 5:06 
QuestionPlay one or more files in single execution Pin
yesu prakash30-Nov-09 1:28
yesu prakash30-Nov-09 1:28 
AnswerRe: Play one or more files in single execution Pin
Covean30-Nov-09 1:52
Covean30-Nov-09 1:52 
AnswerRe: Play one or more files in single execution Pin
souidi abderrahman30-Nov-09 3:24
souidi abderrahman30-Nov-09 3:24 
QuestionSpeech Recognition using .net framework 3.5 Pin
krinaljariwala30-Nov-09 1:04
krinaljariwala30-Nov-09 1:04 
AnswerRe: Speech Recognition using .net framework 3.5 Pin
Abhishek Sur30-Nov-09 1:31
professionalAbhishek Sur30-Nov-09 1:31 

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.