示例#1
0
        private async void buttonScreen_Click(object sender, EventArgs e)
        {
            try
            {
                Client cl = listBoxClients.SelectedItem as Client;
                if (cl == null)
                {
                    MessageBox.Show("Пожалуйста выберите пользователя");
                }
                else
                {
                    await cl.GetScreenshot();

                    pictureBoxScreenshot.Image = cl.screen;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#2
0
        private async void buttonVideo_Click(object sender, EventArgs e)
        {
            try
            {
                Task t;
                for (int i = 0; i < 100; i++)
                {
                    if (!isVideo)
                    {
                        isVideo = true;
                        break;
                    }

                    Client cl = listBoxClients.SelectedItem as Client;
                    if (cl == null)
                    {
                        MessageBox.Show("Пожалуйста выберите пользователя");
                    }
                    else
                    {
                        t = cl.GetScreenshot();
                        await t;
                        t.Wait();
                        if (t.IsCompleted)
                        {
                            pictureBoxScreenshot.Image = cl.screen;
                        }
                        Thread.Sleep(1000);
                    }
                }
                //t.Dispose();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }