Beispiel #1
0
        private void button_FaShong_Click(object sender, RoutedEventArgs e)
        {
            LEDSend vLEDSend = new LEDSend();

            vLEDSend.SelectedIPArray = m_SelectedIPArray;
            vLEDSend.TextArray       = RTFBox1.ImagePathList.ToArray();

            List <ConfigInfo> vPicList   = new List <ConfigInfo>();
            List <ConfigInfo> vVideoList = new List <ConfigInfo>();

            for (int i = 1; i <= 4; i++)
            {
                TextBox vVideoTextBox = (TextBox)FindName(string.Format("textBox_ShiPing_SPLJ{0}", i));
                if (vVideoTextBox.Text != null && vVideoTextBox.Text != "")
                {
                    if (File.Exists(vVideoTextBox.Text))
                    {
                        ConfigInfo vConfigInfo = new ConfigInfo()
                        {
                            Path = vVideoTextBox.Text,
                            ID   = i
                        };
                        vVideoList.Add(vConfigInfo);
                    }
                }

                TextBox vPicTextBox = (TextBox)FindName(string.Format("textBox_TuPian_TPLJ{0}", i));
                if (vPicTextBox.Text != null && vPicTextBox.Text != "")
                {
                    if (File.Exists(vPicTextBox.Text))
                    {
                        ConfigInfo vConfigInfo = new ConfigInfo()
                        {
                            Path = vPicTextBox.Text,
                            ID   = i
                        };
                        vPicList.Add(vConfigInfo);
                    }
                }
            }

            vLEDSend.PicArray = new string[vPicList.Count];
            for (int i = 0; i < vPicList.Count; i++)
            {
                vLEDSend.PicArray[i] = vPicList[i].Path;
            }

            vLEDSend.VideoArray = new string[vVideoList.Count];
            for (int i = 0; i < vVideoList.Count; i++)
            {
                vLEDSend.VideoArray[i] = vVideoList[i].Path;
            }
            vLEDSend.Owner = Application.Current.MainWindow;
            if (vLEDSend.ShowDialog() ?? false)
            {
                List <LEDChannelInfo> vLEDChannelInfoList = new List <LEDChannelInfo>();
                LEDControl            vLEDControl         = new LEDControl(App.WatchHouseID);

                List <LEDChannelInfo> vTextLedList = new List <LEDChannelInfo>();
                foreach (string vTempText in vLEDSend.SelectedTextArray)
                {
                    LEDChannelInfo vTextChannelInfo = new LEDChannelInfo()
                    {
                        ChannelType = LEDChanneTypeEnum.Text,
                        Content     = vTempText,
                        InEff       = (int)comboBox_Text_XianShi1.SelectedValue,
                        OutEff      = (int)comboBox_Text_QinPing1.SelectedValue,
                        HoldTime    = (integerUpDown_Text.Value ?? 0) * 10
                    };
                    vLEDChannelInfoList.Add(vTextChannelInfo);
                    vTextLedList.Add(vTextChannelInfo);
                }


                List <LEDChannelInfo> vPicLedList = new List <LEDChannelInfo>();
                foreach (string vTempPic in vLEDSend.SelectedPicArray)
                {
                    int      vID = vPicList.Where(m => m.Path == vTempPic).FirstOrDefault().ID;
                    ComboBox vComboBox_TuPian_XianShi = (ComboBox)FindName(string.Format("comboBox_TuPian_XianShi{0}", vID));
                    ComboBox vComboBox_TuPain_QinPing = (ComboBox)FindName(string.Format("comboBox_TuPian_QinPing{0}", vID));
                    Xceed.Wpf.Toolkit.IntegerUpDown vIntegerUpDown_TuPian = (Xceed.Wpf.Toolkit.IntegerUpDown)FindName(string.Format("integerUpDown_TuPian{0}", vID));

                    LEDChannelInfo vPicChannelInfo = new LEDChannelInfo()
                    {
                        ChannelType = LEDChanneTypeEnum.Image,
                        Content     = vTempPic,
                        InEff       = (int)vComboBox_TuPian_XianShi.SelectedValue,
                        OutEff      = (int)vComboBox_TuPain_QinPing.SelectedValue,
                        HoldTime    = (vIntegerUpDown_TuPian.Value ?? 0) * 10
                    };
                    vLEDChannelInfoList.Add(vPicChannelInfo);
                    vPicLedList.Add(vPicChannelInfo);
                }

                List <LEDChannelInfo> vVideoLedList = new List <LEDChannelInfo>();
                foreach (string vTempVideo in vLEDSend.SelectedVideoArray)
                {
                    int      vID = vVideoList.Where(m => m.Path == vTempVideo).FirstOrDefault().ID;
                    ComboBox vComboBox_ShiPing_XianShi = (ComboBox)FindName(string.Format("comboBox_ShiPing_XianShi{0}", vID));
                    ComboBox vComboBox_ShiPing_QinPing = (ComboBox)FindName(string.Format("comboBox_ShiPing_QinPing{0}", vID));
                    Xceed.Wpf.Toolkit.IntegerUpDown vIntegerUpDown_ShiPing = (Xceed.Wpf.Toolkit.IntegerUpDown)FindName(string.Format("integerUpDown_ShiPing{0}", vID));

                    LEDChannelInfo vVideoChannelInfo = new LEDChannelInfo()
                    {
                        ChannelType = LEDChanneTypeEnum.Video,
                        Content     = vTempVideo,
                        InEff       = (int)vComboBox_ShiPing_XianShi.SelectedValue,
                        OutEff      = (int)vComboBox_ShiPing_QinPing.SelectedValue,
                        HoldTime    = (vIntegerUpDown_ShiPing.Value ?? 0) * 10
                    };
                    vLEDChannelInfoList.Add(vVideoChannelInfo);
                    vVideoLedList.Add(vVideoChannelInfo);
                }

                m_SelectedIPArray = vLEDSend.SelectedIPArray;
                vLEDControl.SendMultiChannel(vLEDChannelInfoList, m_SelectedIPArray);
                Xceed.Wpf.Toolkit.MessageBox.Show("已发送", "信息", MessageBoxButton.OK, MessageBoxImage.Information);
                Config vConfig = new Config();
                vConfig.LedTextArray  = vTextLedList.ToArray();
                vConfig.LedPicArray   = vPicLedList.ToArray();
                vConfig.LedVideoArray = vVideoLedList.ToArray();
                vConfig.Save();
            }
        }