Click here to Skip to main content
15,885,767 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: A better way to do it? Pin
Cee Ann16-Apr-14 16:09
Cee Ann16-Apr-14 16:09 
AnswerRe: A better way to do it? Pin
Eddy Vluggen16-Apr-14 22:29
professionalEddy Vluggen16-Apr-14 22:29 
JokeRe: A better way to do it? Pin
Wayne Gaylard16-Apr-14 23:09
professionalWayne Gaylard16-Apr-14 23:09 
GeneralRe: A better way to do it? Pin
Cee Ann17-Apr-14 22:03
Cee Ann17-Apr-14 22:03 
GeneralRe: A better way to do it? Pin
Eddy Vluggen18-Apr-14 0:32
professionalEddy Vluggen18-Apr-14 0:32 
GeneralRe: A better way to do it? Pin
Cee Ann20-Apr-14 19:28
Cee Ann20-Apr-14 19:28 
GeneralRe: A better way to do it? Pin
Eddy Vluggen21-Apr-14 2:15
professionalEddy Vluggen21-Apr-14 2:15 
QuestionC# threading with a child Pin
tomnmillie@yahoo.com14-Apr-14 8:15
tomnmillie@yahoo.com14-Apr-14 8:15 
Howdy,

I've a program that receives GPS through a serial port. The GPS class is child to the main form. When the user calls to open the port, the GPS class creates a thread and runs it, firing off a dataReceived event to the main form, the eventArgs class contains the location data and can be read by main form. This program runs constantly for up to a week at a time and interacts with user input the whole time. Usually, once or twice in a week, the program coughs up an error that can freeze the laptop, but at the very least requires a program restart. Because it happens so seldom, I cannot track this sneaky jerk down.

The enventArg data is stored writ to a listArray, which can be polled by the user to get locations at appropriate times for their task. When requested, the form posts a median location, empties the listArray and waits until the array is full again before the user can make their next request.

If the event fires at the same time as a user request, would this cause a problem? If so, how should I approach a fix?

Should I run the GPS class on a thread from the main form?

When a connection to the GPS is closed, should I kill the thread that the dataStream came in on? The stream is disposed of, but I never put closed parenthesis on the thread itself.

C#
public void GpsOpen()
        {

            if (_gpsStatus.Equals(GpsStatus.Disconnected) || _gpsStatus.Equals(GpsStatus.NoGpsDetected))
            {

                _gpsStatus = GpsStatus.Connecting;
                FireStatusChangedEvent(_gpsStatus);

                ThreadStart ts = new ThreadStart(openGps);
                gpsThread = new Thread(ts);
                gpsThread.Start();

            } // close if (_gpsStatus.Equals(GpsStatus.Disconnected))
        
        } // close public void Open()


Suggestions are definitely appreciated!

TnM
If you're not sure you're in a cult, you are.
-- Stephen Colbert

AnswerRe: C# threading with a child Pin
jschell14-Apr-14 11:35
jschell14-Apr-14 11:35 
AnswerRe: C# threading with a child Pin
Bernhard Hiller14-Apr-14 22:50
Bernhard Hiller14-Apr-14 22:50 
GeneralRe: C# threading with a child Pin
tomnmillie@yahoo.com15-Apr-14 4:55
tomnmillie@yahoo.com15-Apr-14 4:55 
QuestionBest way to Design of Desktop Application Pin
Member 1042005429-Mar-14 14:53
Member 1042005429-Mar-14 14:53 
AnswerRe: Best way to Design of Desktop Application Pin
Peter Leow29-Mar-14 16:01
professionalPeter Leow29-Mar-14 16:01 
GeneralRe: Best way to Design a Desktop Application Pin
Member 1042005429-Mar-14 20:03
Member 1042005429-Mar-14 20:03 
GeneralRe: Best way to Design a Desktop Application Pin
Peter Leow29-Mar-14 20:34
professionalPeter Leow29-Mar-14 20:34 
AnswerRe: Best way to Design of Desktop Application Pin
Eddy Vluggen30-Mar-14 1:28
professionalEddy Vluggen30-Mar-14 1:28 
AnswerRe: Best way to Design of Desktop Application Pin
Vivi Chellappa7-Apr-14 21:08
professionalVivi Chellappa7-Apr-14 21:08 
AnswerRe: Best way to Design of Desktop Application Pin
jschell31-Mar-14 8:44
jschell31-Mar-14 8:44 
Questionweb server design Pin
Trulite23-Mar-14 21:39
Trulite23-Mar-14 21:39 
AnswerRe: web server design Pin
Richard MacCutchan23-Mar-14 23:02
mveRichard MacCutchan23-Mar-14 23:02 
AnswerRe: web server design Pin
Vivi Chellappa26-Mar-14 16:26
professionalVivi Chellappa26-Mar-14 16:26 
QuestionFeedback on my article? Pin
John D. Sanders10-Mar-14 13:17
John D. Sanders10-Mar-14 13:17 
AnswerRe: Feedback on my article? Pin
Bernhard Hiller11-Mar-14 0:20
Bernhard Hiller11-Mar-14 0:20 
AnswerRe: Feedback on my article? Pin
Kornfeld Eliyahu Peter11-Mar-14 1:00
professionalKornfeld Eliyahu Peter11-Mar-14 1:00 
AnswerRe: Feedback on my article? Pin
Richard MacCutchan11-Mar-14 1:08
mveRichard MacCutchan11-Mar-14 1:08 

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.