private void textBox1_TextChanged(object sender, EventArgs e)
        {
            SingleConnection.send("%" + textBox1.Text);
            string message = SingleConnection.recv();

            this.change_list_view(message);
        }
        private void download()
        {
            string str = SingleConnection.recv();

            Console.WriteLine(str);
            this.with_for = true;
        }
        private void FormHandler1()
        {
            SingleConnection.send("close the wait for commands thread in client");
            Console.WriteLine("hide");
            this.Hide();
            Rate_Form f2 = new Rate_Form();

            f2.ShowDialog();
        }
Beispiel #4
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (counter != 0)
     {
         SingleConnection.send(counter.ToString());
         this.Hide();
         Select_Video_Form f1 = new Select_Video_Form();
         f1.ShowDialog();
     }
     else
     {
         MessageBox.Show("You must rate the video");
     }
 }
        private void FormHandler()
        {
            string s = SingleConnection.recv();

            Console.WriteLine(s);
            string[] movie_time_rate_download = s.Split('$');
            string   movie_time_str           = movie_time_rate_download[0];
            string   movies_rates             = movie_time_rate_download[1];
            string   download_videos          = movie_time_rate_download[2];

            this.movie_time_dict       = convert_movie_time_str_to_dict(movie_time_str);
            this.movie_rate_dict       = convert_movies_rates_str_to_dict(movies_rates);
            this.download_videos_array = download_videos.Split('&');
            Array.Resize(ref this.download_videos_array, this.download_videos_array.Length - 1);
        }
        void menuItem_Click(object sender, EventArgs e)
        {
            ToolStripItem menuItem = (ToolStripItem)sender;
            string        name     = listView1.SelectedItems[0].Text;

            if (menuItem.Name == "play")
            {
                SingleConnection.send(name); // send the name of the song that pressed
                this.Hide();
                Buttons_Form bf = new Buttons_Form();
                bf.ShowDialog();
            }
            if (menuItem.Name == "Play from the last viewing point")
            {
                SingleConnection.send(name + "#" + this.movie_time_dict[name]);
                this.Hide();
                this.time = (this.movie_time_dict[name] / 3) + 1;
                Console.WriteLine(this.time);
                this.with_for = true;
                using (Loading_Form f_load = new Loading_Form(SaveData))
                {
                    f_load.ShowDialog(this);
                }
                Buttons_Form bf = new Buttons_Form();
                bf.ShowDialog();
            }
            if (menuItem.Name == "Download for later viewing")
            {
                this.Hide();
                SingleConnection.send("Download@" + name);
                this.with_for = false;
                Thread download_thread = new Thread(new ThreadStart(this.download));
                download_thread.Start();
                using (Loading_Form f_load = new Loading_Form(SaveData))
                {
                    f_load.ShowDialog(this);
                }
                Select_Video_Form f1 = new Select_Video_Form();
                f1.ShowDialog();
            }
            if (menuItem.Name == "Play without connection")
            {
                SingleConnection.send("play_without_connection!" + name);
                this.Hide();
                Buttons_Form bf = new Buttons_Form();
                bf.ShowDialog();
            }
        }
 private void ButtonsForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     SingleConnection.send("close");
     Console.WriteLine("here after hide");
     //SingleConnection.StopPythonEngine();
     while (this.open && this.close)
     {
         Console.WriteLine("wait");
     }
     this.Hide();
     if (this.open)
     {
         Select_Video_Form f1 = new Select_Video_Form();
         f1.ShowDialog();
     }
 }
        private void listView1_MouseClick(object sender, MouseEventArgs e)
        {
            string name = listView1.SelectedItems[0].Text;

            if (e.Button == MouseButtons.Right)
            {
                ContextMenuStrip  menuStrip = new ContextMenuStrip();
                ToolStripMenuItem menuItem1 = new ToolStripMenuItem("Play");
                menuStrip.Items.Add(menuItem1);
                menuItem1.Click += new EventHandler(menuItem_Click);
                menuItem1.Name   = "play";
                if (video_is_download(name))
                {
                    ToolStripMenuItem menuItem4 = new ToolStripMenuItem("Play without connection");
                    menuStrip.Items.Add(menuItem4);
                    menuItem4.Click += new EventHandler(menuItem_Click);
                    menuItem4.Name   = "Play without connection";
                }
                else
                {
                    ToolStripMenuItem menuItem4 = new ToolStripMenuItem("Download for later viewing");
                    menuStrip.Items.Add(menuItem4);
                    menuItem4.Click += new EventHandler(menuItem_Click);
                    menuItem4.Name   = "Download for later viewing";
                }
                if (this.movie_time_dict.ContainsKey(name))
                {
                    ToolStripMenuItem menuItem2 = new ToolStripMenuItem("Play from the last viewing point- " + this.movie_time_dict[name] + " sec");
                    menuStrip.Items.Add(menuItem2);
                    menuItem2.Click += new EventHandler(menuItem_Click);
                    menuItem2.Name   = "Play from the last viewing point";
                }
                if (this.movie_rate_dict.ContainsKey(name))
                {
                    ToolStripMenuItem menuItem3 = new ToolStripMenuItem("Rate: " + this.movie_rate_dict[name]);
                    menuStrip.Items.Add(menuItem3);
                }
                this.ContextMenuStrip = menuStrip;
            }
            else
            {
                SingleConnection.send(name); // send the name of the song that pressed
                this.Hide();
                Buttons_Form bf = new Buttons_Form();
                bf.Show();
            }
        }
Beispiel #9
0
        private void button2_Click(object sender, EventArgs e)
        {
            string username = textBox1.Text;
            string password = textBox2.Text;

            SingleConnection.send(username + "<&>" + password);
            string message = SingleConnection.recv();

            if (message == "ok")
            {
                Select_Video_Form form1 = new Select_Video_Form();
                this.Hide();
                form1.ShowDialog();
            }
            else
            {
                MessageBox.Show(message);
            }
        }
        private void receive_thread()
        {
            string message = SingleConnection.recv();

            Console.WriteLine(message);
            if (message.Equals("finish and open rate"))
            {
                if (InvokeRequired)
                {
                    this.open = false;
                    this.Invoke(new Action(() => { FormHandler1(); }));
                }
            }
            if (message.Equals("closing the thread in buttonsForm and open"))
            {
                this.close = false;
            }
            else
            {
                this.open = false;
            }
        }
 private void button3_Click(object sender, EventArgs e)
 {
     SingleConnection.send("plus");
 }
 private void button5_Click(object sender, EventArgs e)
 {
     SingleConnection.send("mute");
 }
 private void button2_Click(object sender, EventArgs e)
 {
     SingleConnection.send("stop");
 }
Beispiel #14
0
 private void LoginForm_Load(object sender, EventArgs e)
 {
     SingleConnection.Connect();
 }
Beispiel #15
0
 private void ButtonsForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     SingleConnection.StopPythonEngine();
 }