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

C#

 
QuestionDetecting Webcam Pin
sarang_k29-Nov-12 19:51
sarang_k29-Nov-12 19:51 
AnswerRe: Detecting Webcam Pin
Pete O'Hanlon29-Nov-12 20:35
mvePete O'Hanlon29-Nov-12 20:35 
GeneralRe: Detecting Webcam Pin
sarang_k2-Dec-12 18:17
sarang_k2-Dec-12 18:17 
GeneralRe: Detecting Webcam Pin
Pete O'Hanlon2-Dec-12 19:23
mvePete O'Hanlon2-Dec-12 19:23 
GeneralRe: Detecting Webcam Pin
sarang_k9-Dec-12 22:41
sarang_k9-Dec-12 22:41 
QuestionResourceBundle class in C#? Pin
LAPEC29-Nov-12 12:17
LAPEC29-Nov-12 12:17 
AnswerRe: ResourceBundle class in C#? Pin
Pete O'Hanlon29-Nov-12 12:53
mvePete O'Hanlon29-Nov-12 12:53 
QuestionHow do you properly deal with ContextSwitchDeadlock or DisconnectedContext? Pin
turbosupramk329-Nov-12 11:13
turbosupramk329-Nov-12 11:13 
While debugging, I am seeing the following error messages from the code at the bottom. Do I need some sort of time out period for my this.invoke commands?

Thanks for reading!


DisconnectedContext was detected
Message: Context 0x3eb6e0' is disconnected.  Releasing the interfaces from the current context (context 0x3eb570).This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/apartments stay alive until the applicationis completely done with the RuntimeCallableWrappers that represent COM components that liveinside them.


ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x3eb570 to COM context 0x3eb6e0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.



C#
<pre>this.Invoke((MethodInvoker)delegate()
                            {
                                string uptime = GetUptime(server.TrimEnd()).ToString();
                                string days = "";
                                int firstPeriodIndex = uptime.IndexOf('.');
                                int firstColonIndex = uptime.IndexOf(':');
                                int daysIndex = 0;
                                if (firstPeriodIndex < firstColonIndex)
                                {
                                    daysIndex = uptime.IndexOf('.');
                                    if (daysIndex >= 0)
                                    {
                                        days = uptime.Remove(daysIndex);
                                    }
                                }
                                else
                                {
                                    days = "0";
                                }

                                string hours = uptime.Remove(0, daysIndex + 1);
                                int hoursIndex = hours.IndexOf(':');
                                if (hoursIndex >= 0)
                                {
                                    hours = hours.Remove(hoursIndex);
                                }

                                string minutes = uptime.Remove(0, daysIndex + 1);
                                minutes = minutes.Remove(0, hoursIndex + 1);
                                int minutesIndex = minutes.IndexOf(':');
                                if (minutesIndex >= 0)
                                {
                                    minutes = minutes.Remove(minutesIndex);
                                }

                                string seconds = uptime.Remove(0, daysIndex + 1);
                                seconds = seconds.Remove(0, hoursIndex + 1);
                                seconds = seconds.Remove(0, minutesIndex + 1);
                                int secondsIndex = seconds.IndexOf('.');
                                if (secondsIndex >= 0)
                                {
                                    seconds = seconds.Remove(secondsIndex);
                                }

                                if (_shouldStop == true) { return; }
                                lvwShutdown.BeginUpdate();
                                if (lvwShutdown.Items[selectedIndex].SubItems[2].Text != "")
                                {
                                    lvwShutdown.Items[selectedIndex].SubItems[2].Text = "";
                                }
                                lvwShutdown.Items[selectedIndex].SubItems[3].Text = days + " D, " + hours + " H, " + minutes + " M, " + seconds + " S"; //GetUptime(server).ToString();
                                lvwShutdown.EndUpdate();
                                lvwShutdown.Refresh();
                            });


QuestionSome ideas needed on the response part of a queued WCF example Pin
Ger Hayden29-Nov-12 10:28
Ger Hayden29-Nov-12 10:28 
QuestionI NEED YOUR HELP Pin
OğuzhanÇALIŞKAN29-Nov-12 10:08
OğuzhanÇALIŞKAN29-Nov-12 10:08 
AnswerRe: I NEED YOUR HELP Pin
OriginalGriff29-Nov-12 20:21
mveOriginalGriff29-Nov-12 20:21 
QuestionDebugger stepping into referenced class first and bypassing parent Pin
MichCl29-Nov-12 9:27
MichCl29-Nov-12 9:27 
AnswerRe: Debugger stepping into referenced class first and bypassing parent Pin
MichCl30-Nov-12 7:49
MichCl30-Nov-12 7:49 
QuestionIframes cross domain Exception Handling---PLEASE HELP Pin
Ved Yo29-Nov-12 8:46
Ved Yo29-Nov-12 8:46 
QuestionClient Side Crystal Report Error Pin
Taskeen Asif29-Nov-12 8:16
Taskeen Asif29-Nov-12 8:16 
QuestionError2 Build failed due to validation errors in *.dbml Pin
sc steinhayse29-Nov-12 4:43
sc steinhayse29-Nov-12 4:43 
AnswerRe: Error2 Build failed due to validation errors in *.dbml Pin
Pete O'Hanlon29-Nov-12 5:00
mvePete O'Hanlon29-Nov-12 5:00 
QuestionC# Problem adding datetime columns with data in gridview Pin
Blenni29-Nov-12 2:50
Blenni29-Nov-12 2:50 
AnswerRe: C# Problem adding datetime columns with data in gridview Pin
BobJanova29-Nov-12 3:21
BobJanova29-Nov-12 3:21 
GeneralRe: C# Problem adding datetime columns with data in gridview Pin
Blenni29-Nov-12 3:49
Blenni29-Nov-12 3:49 
GeneralRe: C# Problem adding datetime columns with data in gridview Pin
BobJanova29-Nov-12 6:05
BobJanova29-Nov-12 6:05 
GeneralRe: C# Problem adding datetime columns with data in gridview Pin
Blenni29-Nov-12 21:45
Blenni29-Nov-12 21:45 
GeneralRe: C# Problem adding datetime columns with data in gridview Pin
BobJanova29-Nov-12 23:26
BobJanova29-Nov-12 23:26 
QuestionGetting *all* controls of a form Pin
Dennis Bork28-Nov-12 23:04
Dennis Bork28-Nov-12 23:04 
AnswerRe: Getting *all* controls of a form Pin
BobJanova28-Nov-12 23:21
BobJanova28-Nov-12 23:21 

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.