예제 #1
0
        private void button_Photo_Click(object sender, EventArgs e)
        {
            OpenFileDialog vOpenFileDialog = new OpenFileDialog();

            vOpenFileDialog.Multiselect = false;
            vOpenFileDialog.Filter      = "Png files (*.png)|*.png";
            if (vOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                pictureBox_Photo.Image = Image.FromStream(CommHelper.ByteToStream(CommHelper.SetImageToByteArray(vOpenFileDialog.FileName)));
                pictureBox_Photo.Tag   = vOpenFileDialog.FileName;
            }
        }
예제 #2
0
 private void dataGridView_EmployeeInfo_SelectionChanged(object sender, EventArgs e)
 {
     if (dataGridView_EmployeeInfo.SelectedRows.Count > 0)
     {
         textBox_Name.Text    = (string)dataGridView_EmployeeInfo.SelectedRows[0].Cells["Column_XingMing"].Value;
         comboBox_Sex.Text    = (string)dataGridView_EmployeeInfo.SelectedRows[0].Cells["Column_XingBie"].Value;
         textBox_JobNo.Text   = dataGridView_EmployeeInfo.SelectedRows[0].Cells["Column_GongHao"].Value.ToString();
         textBox_CardNo.Text  = (string)dataGridView_EmployeeInfo.SelectedRows[0].Cells["Column_KaHao"].Value;
         comboBox_XingJi.Text = (string)dataGridView_EmployeeInfo.SelectedRows[0].Cells["Column_XingJi"].Value;
         textBox_GeYan.Text   = (string)dataGridView_EmployeeInfo.SelectedRows[0].Cells["Column_GeYan"].Value;
         string vPhotoPath = string.Format(@"{0}\Photo\{1}", System.Environment.CurrentDirectory, (string)dataGridView_EmployeeInfo.SelectedRows[0].Cells["Column_Photo"].Value);
         if (System.IO.File.Exists(vPhotoPath))
         {
             pictureBox_Photo.Image = Image.FromStream(CommHelper.ByteToStream(CommHelper.SetImageToByteArray(vPhotoPath)));
             pictureBox_Photo.Tag   = vPhotoPath;
         }
         else
         {
             pictureBox_Photo.Image = null;
             pictureBox_Photo.Tag   = null;
         }
     }
 }
예제 #3
0
        void init()
        {
            //岗亭初始化
            m_CheckBoxList = new List <CheckBox>();
            WatchHouseMonitoring  vWatchHouseMonitoring = new WatchHouseMonitoring();
            List <WatchHouseInfo> vWatchHouseInfoList   = vWatchHouseMonitoring.GetAllWatchHouseInfo();

            double vCount_Double = vWatchHouseInfoList.Count / (double)4;
            int    vCount_int    = (int)(vCount_Double / (double)8);

            for (int i = 0; i < vWatchHouseInfoList.Count; i++)
            {
                if (vWatchHouseInfoList[i].GuanGaoPing1IP != null && vWatchHouseInfoList[i].GuanGaoPing1IP != "")
                {
                    CheckBox vNewCheckBox1 = new CheckBox()
                    {
                        Content = vWatchHouseInfoList[i].GangTingMC + "(屏幕1)",
                        Tag     = vWatchHouseInfoList[i].GuanGaoPing1IP
                    };
                    string vIsSelected = SelectedIPArray.Where(m => m == vWatchHouseInfoList[i].GuanGaoPing1IP).FirstOrDefault();
                    if (vIsSelected != null && vIsSelected != "")
                    {
                        vNewCheckBox1.IsChecked = true;
                    }

                    listBox_GangTing.Items.Add(vNewCheckBox1);
                    m_CheckBoxList.Add(vNewCheckBox1);
                }

                if (vWatchHouseInfoList[i].GuanGaoPing2IP != null && vWatchHouseInfoList[i].GuanGaoPing2IP != "")
                {
                    CheckBox vNewCheckBox2 = new CheckBox()
                    {
                        Content = vWatchHouseInfoList[i].GangTingMC + "(屏幕2)",
                        Tag     = vWatchHouseInfoList[i].GuanGaoPing2IP
                    };

                    string vIsSelected = SelectedIPArray.Where(m => m == vWatchHouseInfoList[i].GuanGaoPing2IP).FirstOrDefault();
                    if (vIsSelected != null && vIsSelected != "")
                    {
                        vNewCheckBox2.IsChecked = true;
                    }

                    listBox_GangTing.Items.Add(vNewCheckBox2);
                    m_CheckBoxList.Add(vNewCheckBox2);
                }
            }

            //文本内容初始化
            List <TextInfo> vTextInfoList = new List <TextInfo>();

            foreach (string vText in TextArray)
            {
                BitmapImage vBitmapImage = new BitmapImage();
                vBitmapImage.BeginInit();
                vBitmapImage.StreamSource = CommHelper.ByteToStream(CommHelper.SetImageToByteArray(vText));
                vBitmapImage.EndInit();
                vTextInfoList.Add(new TextInfo()
                {
                    FullPath = vText, Image = vBitmapImage
                });
            }
            listBox_Text.ItemsSource = vTextInfoList;

            //图片内容初始化
            List <TextInfo> vPicInfoList = new List <TextInfo>();

            foreach (string vPic in PicArray)
            {
                vPicInfoList.Add(new TextInfo()
                {
                    FullPath = vPic
                });
            }
            listBox_Pic.ItemsSource = vPicInfoList;


            //视频内容初始化
            List <TextInfo> vVideoInfoList = new List <TextInfo>();

            foreach (string vVideo in VideoArray)
            {
                vVideoInfoList.Add(new TextInfo()
                {
                    FullPath = vVideo
                });
            }
            listBox_Video.ItemsSource = vVideoInfoList;
        }