Ejemplo n.º 1
0
        private void btnStartStop_Click(object sender, EventArgs e)
        {
            isSharing = !isSharing;

            btnStartStop.ImageIndex = isSharing ? 1 : 0;
            btnStartStop.Text = isSharing ? "Stop sharing" : "Start sharing";

            if (isSharing)
            {
                if (!Int32.TryParse(portTextBox.Text, out streamerPort))
                {
                    streamerPort = oldPort + 1;
                    portTextBox.Text = streamerPort.ToString();
                }

                if (streamerPort != oldPort)
                {
                    streamer = new Streamer(ip, streamerPort);
                    oldPort = streamerPort;
                }

                urlTextBox.Text = server.URL;
                portTextBox.Enabled = false;
                streamer.Play();
            }
            else
            {
                portTextBox.Enabled = true;
                streamer.Stop();
            }
        }
Ejemplo n.º 2
0
        public MainForm()
        {
            InitializeComponent();

            TopMost = true;

            StartPosition = FormStartPosition.Manual;
            int x = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
            int y = Screen.PrimaryScreen.WorkingArea.Height - this.Height;
            Bounds = new Rectangle(x, y, this.Width, this.Height);

            ip = Streamer.GetExternalIp();
            portTextBox.Text = serverPort.ToString();
            streamerPort = serverPort + 1;
            oldPort = serverPort;

            server = new WebServer(ip, serverPort, streamerPort);
            server.StartListening();

            streamer = new Streamer(ip, streamerPort);
        }