示例#1
0
        } // ForceUiCulture

        private static void ForceUiCulture(string culture)
        {
            if (culture == null)
            {
                return;
            }
            culture = culture.Trim();
            if (culture == string.Empty)
            {
                return;
            }

            try
            {
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture);
            }
            catch (Exception ex)
            {
                MyApplication.HandleException(null, ex);
            } // try-catch
        }     // ForceUiCulture
示例#2
0
        } // checkDumpPayloads_CheckedChanged

        private void buttonStart_Click(object sender, EventArgs e)
        {
            string context = null;

            try
            {
                context = "IP Address";
                var input = textIpAddress.Text.Trim();
                MulticastIpAddress = IPAddress.Parse(input);

                context       = "Port";
                MulticastPort = Program.ParseNumber(textPort.Text);

                context = "Dump folder: segments";
                if (checkDumpSegments.Checked)
                {
                    DumpFolderSegments = Path.Combine(textBaseDumpFolder.Text, string.Format("DvbStpStream\\{0}~{1}\\{2:yyyy-MM-dd HH-mm-ss}", MulticastIpAddress, MulticastPort, DateTime.Now));
                    Directory.CreateDirectory(DumpFolderSegments);
                }
                else
                {
                    DumpFolderSegments = null;
                } // if-else

                context = "Dump folder: sections";
                if (checkDumpSections.Checked)
                {
                    DumpFolderSections = Path.Combine(textBaseDumpFolder.Text, string.Format("DvbStpStream\\{0}~{1}\\{2:yyyy-MM-dd HH-mm-ss}\\sections", MulticastIpAddress, MulticastPort, DateTime.Now));
                    Directory.CreateDirectory(DumpFolderSections);
                }
                else
                {
                    DumpFolderSections = null;
                } // if-else
            }
            catch (Exception ex)
            {
                MyApplication.HandleException(this, context, ex);
                return;
            } // try-catch

            buttonStart.Enabled = false;
            buttonStop.Enabled  = true;

            DatagramCount             = 0;
            DatagramByteCount         = 0;
            checkDumpSections.Enabled = false;

            statusLabelDatagramCount.Text = string.Format("{0:N0} datagrams received", DatagramCount);
            statusLabelByteCount.Text     = string.Format("{0:N0} bytes received", DatagramByteCount);
            listViewSections.Items.Clear();
            listViewRuns.Items.Clear();

            Explorer = new DvbStpExplorer(MulticastIpAddress, MulticastPort);
            statusLabelReceiving.Text = "Trying to connect...";

            Worker = new BackgroundWorker()
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = true
            };
            Worker.DoWork             += Worker_DoWork;
            Worker.ProgressChanged    += Worker_ProgressChanged;
            Worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
            Worker.RunWorkerAsync();
        } // buttonStart_Click