Пример #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (timer1.Interval == (int)numericUpDown1.Value * 1000)
     {
         if (listBox2.Items.Count > 0)
         {
             send_number++;
             int    err      = 0;
             IntPtr playlist = LedYNetSdk.create_playlist(Variable.p_width, Variable.p_height, Variable.p_screen_type);
             string name     = "program_0";
             IntPtr program  = LedYNetSdk.create_program(name, "0xff000000");
             for (int i = 0; i < S_DynamicAreaStr.Count; i++)
             {
                 LedYSDK.DynamicArea DynamicArea = S_DynamicAreaStr[i];
                 IntPtr dynamic_area             = LedYNetSdk.create_dynamic();
                 for (int j = 0; j < DynamicArea.m_DynamicAreaFile.Length; j++)
                 {
                     Random random      = new Random();
                     byte[] b           = System.Text.Encoding.UTF8.GetBytes(random.Next(10, 1000).ToString());
                     string m_file_path = Convert.ToBase64String(b);
                     LedYSDK.DynamicAreaFile DynamicAreaFile = DynamicArea.m_DynamicAreaFile[j];
                     err = LedYNetSdk.add_dynamic_unit(dynamic_area, DynamicAreaFile.m_dynamic_type, DynamicAreaFile.m_display_effects, DynamicAreaFile.m_display_speed, DynamicAreaFile.m_stay_time,
                                                       m_file_path, DynamicAreaFile.m_gif_flag, DynamicAreaFile.m_bg_color, DynamicAreaFile.m_font_size, DynamicAreaFile.m_font_name, DynamicAreaFile.m_font_color, DynamicAreaFile.m_font_attributes,
                                                       DynamicAreaFile.m_align_h, DynamicAreaFile.m_align_v, DynamicAreaFile.m_volumn, DynamicAreaFile.m_scale_mode, DynamicAreaFile.m_rolation_mode);
                 }
                 err = LedYNetSdk.add_dynamic(program, dynamic_area, DynamicArea.m_dynamic_id, DynamicArea.m_x, DynamicArea.m_y, DynamicArea.m_w, DynamicArea.m_h, DynamicArea.m_relative_program,
                                              DynamicArea.m_run_mode, DynamicArea.m_update_frequency, DynamicArea.m_transparency);
                 LedYNetSdk.delete_dynamic(dynamic_area);
             }
             //星期
             #region
             int  index;
             bool flag;
             byte BIT = 0;
             if (checkMon.Checked == true)
             {
                 index = 1;
                 flag  = true;
                 BIT   = set_bit(BIT, index, flag);
             }
             else
             {
                 index = 1;
                 flag  = false;
                 BIT   = set_bit(BIT, index, flag);
             }
             if (checkTues.Checked == true)
             {
                 index = 2;
                 flag  = true;
                 BIT   = set_bit(BIT, index, flag);
             }
             else
             {
                 index = 2;
                 flag  = false;
                 BIT   = set_bit(BIT, index, flag);
             }
             if (checkWed.Checked == true)
             {
                 index = 3;
                 flag  = true;
                 BIT   = set_bit(BIT, index, flag);
             }
             else
             {
                 index = 3;
                 flag  = false;
                 BIT   = set_bit(BIT, index, flag);
             }
             if (checkThur.Checked == true)
             {
                 index = 4;
                 flag  = true;
                 BIT   = set_bit(BIT, index, flag);
             }
             else
             {
                 index = 4;
                 flag  = false;
                 BIT   = set_bit(BIT, index, flag);
             }
             if (checkFri.Checked == true)
             {
                 index = 5;
                 flag  = true;
                 BIT   = set_bit(BIT, index, flag);
             }
             else
             {
                 index = 5;
                 flag  = false;
                 BIT   = set_bit(BIT, index, flag);
             }
             if (checkSat.Checked == true)
             {
                 index = 6;
                 flag  = true;
                 BIT   = set_bit(BIT, index, flag);
             }
             else
             {
                 index = 6;
                 flag  = false;
                 BIT   = set_bit(BIT, index, flag);
             }
             if (checkSun.Checked == true)
             {
                 index = 7;
                 flag  = true;
                 BIT   = set_bit(BIT, index, flag);
             }
             else
             {
                 index = 7;
                 flag  = false;
                 BIT   = set_bit(BIT, index, flag);
             }
             int m_play_week = BIT;
             #endregion
             err = LedYNetSdk.add_program_in_playlist(playlist, program, 1, 10, "", "", "", "", m_play_week);
             err = LedYNetSdk.update_dynamic_unit_small(Variable.p_ip, Variable.p_port, Variable.p_str, Variable.p_str, playlist);
             if (err != 0)
             {
                 err_number++; richTextBox1.Text = "更新失败:" + err;
             }
             else
             {
                 richTextBox1.Text = "更新成功";
             }
             LedYNetSdk.cancel_send_program(playlist);
             LedYNetSdk.delete_playlist(playlist);
             numericUpDown2.Value = send_number;
             numericUpDown3.Value = err_number;
         }
     }
 }
Пример #2
0
        private void btn_SendFile_Click(object sender, EventArgs e)
        {
            if (listBox1.Items.Count > 0)
            {
                int    err      = 0;
                IntPtr playlist = LedYNetSdk.create_playlist(Variable.p_width, Variable.p_height, Variable.p_screen_type);
                string name     = "program_0";
                IntPtr program  = LedYNetSdk.create_program(name, "0xff000000");
                for (int i = 0; i < S_DynamicAreaFile.Count; i++)
                {
                    LedYSDK.DynamicArea DynamicArea = S_DynamicAreaFile[i];
                    IntPtr dynamic_area             = LedYNetSdk.create_dynamic();
                    for (int j = 0; j < DynamicArea.m_DynamicAreaFile.Length; j++)
                    {
                        LedYSDK.DynamicAreaFile DynamicAreaFile = DynamicArea.m_DynamicAreaFile[j];
                        err = LedYNetSdk.add_dynamic_unit(dynamic_area, DynamicAreaFile.m_dynamic_type, DynamicAreaFile.m_display_effects, DynamicAreaFile.m_display_speed, DynamicAreaFile.m_stay_time,
                                                          DynamicAreaFile.m_file_path, DynamicAreaFile.m_gif_flag, DynamicAreaFile.m_bg_color, DynamicAreaFile.m_font_size, DynamicAreaFile.m_font_name, DynamicAreaFile.m_font_color, DynamicAreaFile.m_font_attributes,
                                                          DynamicAreaFile.m_align_h, DynamicAreaFile.m_align_v, DynamicAreaFile.m_volumn, DynamicAreaFile.m_scale_mode, DynamicAreaFile.m_rolation_mode);
                    }
                    err = LedYNetSdk.add_dynamic(program, dynamic_area, DynamicArea.m_dynamic_id, DynamicArea.m_x, DynamicArea.m_y, DynamicArea.m_w, DynamicArea.m_h, DynamicArea.m_relative_program,
                                                 DynamicArea.m_run_mode, DynamicArea.m_update_frequency, DynamicArea.m_transparency);
                    LedYNetSdk.delete_dynamic(dynamic_area);
                }
                //星期
                #region
                int  index;
                bool flag;
                byte BIT = 0;
                if (checkMon.Checked == true)
                {
                    index = 1;
                    flag  = true;
                    BIT   = set_bit(BIT, index, flag);
                }
                else
                {
                    index = 1;
                    flag  = false;
                    BIT   = set_bit(BIT, index, flag);
                }
                if (checkTues.Checked == true)
                {
                    index = 2;
                    flag  = true;
                    BIT   = set_bit(BIT, index, flag);
                }
                else
                {
                    index = 2;
                    flag  = false;
                    BIT   = set_bit(BIT, index, flag);
                }
                if (checkWed.Checked == true)
                {
                    index = 3;
                    flag  = true;
                    BIT   = set_bit(BIT, index, flag);
                }
                else
                {
                    index = 3;
                    flag  = false;
                    BIT   = set_bit(BIT, index, flag);
                }
                if (checkThur.Checked == true)
                {
                    index = 4;
                    flag  = true;
                    BIT   = set_bit(BIT, index, flag);
                }
                else
                {
                    index = 4;
                    flag  = false;
                    BIT   = set_bit(BIT, index, flag);
                }
                if (checkFri.Checked == true)
                {
                    index = 5;
                    flag  = true;
                    BIT   = set_bit(BIT, index, flag);
                }
                else
                {
                    index = 5;
                    flag  = false;
                    BIT   = set_bit(BIT, index, flag);
                }
                if (checkSat.Checked == true)
                {
                    index = 6;
                    flag  = true;
                    BIT   = set_bit(BIT, index, flag);
                }
                else
                {
                    index = 6;
                    flag  = false;
                    BIT   = set_bit(BIT, index, flag);
                }
                if (checkSun.Checked == true)
                {
                    index = 7;
                    flag  = true;
                    BIT   = set_bit(BIT, index, flag);
                }
                else
                {
                    index = 7;
                    flag  = false;
                    BIT   = set_bit(BIT, index, flag);
                }
                int m_play_week = BIT;
                #endregion
                err = LedYNetSdk.add_program_in_playlist(playlist, program, 1, 10, "", "", "", "", m_play_week);
                err = LedYNetSdk.update_dynamic(Variable.p_ip, Variable.p_port, Variable.p_str, Variable.p_str, playlist, -1, 0, 0);

                LedYNetSdk.cancel_send_program(playlist);
                LedYNetSdk.delete_playlist(playlist);
            }
        }