Quantcast
Channel: About updating UI thread
Viewing all articles
Browse latest Browse all 2

About updating UI thread

$
0
0

Hi. Does the main.cs run on the UI thread. I mean when I add a method in Main.cs and update the UI from that method can I omit this.Dispatcher.BeginToInvoke(delegate()... or should I include it? Like the following method is in Main.cs

// Set the recording state: stop recording.
        private void StopVideoRecording()
        {
            try
            {
                // Stop recording.
                if (_cs.VideoCaptureDevice != null&& _cs.State == CaptureState.Started)
                {
                    _cs.Stop();
                    // Disconnect fileSink.
                    fileSink.CaptureSource = null;
                    fileSink.IsolatedStorageFileName = null;

                    // Set the button states and the message.
                    UpdateUI(ButtonState.Stopped, "Preparing viewfinder...");
                    StopTimer();
                    StartVideoPreview();
                }
            }
            // If stop fails, display an error.
            catch (Exception e)
            {
                this.Dispatcher.BeginInvoke(delegate()
                {
                    txtDebug.Text = "ERROR: " + e.Message.ToString();
                });
            }
        }

Thanks in advance


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images