Beispiel #1
0
        private void InitVideoFeeds()
        {
            try
            {
                int col = 0, row = 0;
                for (int i = 0; i < 4; i++)
                {
                    System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
                    m_obj       = new AplusVideoC01.wpf_Monitor();
                    host.Width  = (int)grid_main.ColumnDefinitions[col].ActualWidth;
                    host.Height = (int)grid_main.RowDefinitions[row].ActualHeight + (int)grid_main.RowDefinitions[row + 1].ActualHeight;

                    row  = i / 2;
                    row *= 2;

                    host.Child = m_obj;
                    host.SetValue(Grid.RowProperty, row);
                    host.SetValue(Grid.ColumnProperty, col);

                    col++; if (col == 2)
                    {
                        col = 0;
                    }

                    grid_main.Children.Add(host);
                    m_obj.Device_Login(host_ip, host_port, "", "");

                    int id = i;
                    if (i == 0)
                    {
                        id = 1;
                    }
                    if (i == 1)
                    {
                        id = 0;
                    }
                    if (i == 2)
                    {
                        id = 3;
                    }
                    if (i == 3)
                    {
                        id = 2;
                    }

                    m_obj.Device_RealPlay(id, 0, 0);
                    m_objList.Add(m_obj);
                    hostList.Add(host);
                }
            }
            catch (Exception ee)
            {
                Console.WriteLine("Video Windows set up error");
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button but = sender as Button;

            if (but == but_play)
            {
                Console.WriteLine("play click");
                m_obj.Device_RealPlay(Int32.Parse(tb_ch.Text), 0, 0);
            }
            else if (but == but_stop)
            {
                Console.WriteLine("stop click");
            }
        }