public bool GetDailyBroadcastTable(ref DailyBroadcastTable oldTable)
 {
     try
     {
         List <DailyCmd> daily = GetSendDailyCmd();
         if (daily == null || daily.Count == 0)
         {
             if (oldTable != null)
             {
                 oldTable.list_daily_cmd = null;
             }
             return(false);
         }
         //if (oldTable == null)
         //{
         //    oldTable = new DailyBroadcastTable();
         //    oldTable.Table_id = 0xfa;
         //    oldTable.Table_id_extension = 0;
         //}
         oldTable.list_daily_cmd = daily;
         oldTable.Repeat_times   = pnlRepeatTimes.GetRepeatTimes();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 private void ChanngeProgramState(DataGridViewCellEventArgs e, ChangeProgram pro)
 {
     if ((MdiParent as EBMMain).IsStartStream)
     {
         if ((string)dgvChangeProgram[e.ColumnIndex, e.RowIndex].Value == "停止广播")
         {
             DailyBroadcastTable table = (MdiParent as EBMMain).EbMStream.Daily_Broadcast_Table;
             if (table == null)
             {
                 GetDailyBroadcastTable(ref table);
             }
             List <DailyCmd> list = table.list_daily_cmd;
             foreach (var l in list)
             {
                 if (l.B_Daily_cmd_tag == 1)
                 {
                     if ((short)((l.Br_Daily_cmd_char[8] << 8) + l.Br_Daily_cmd_char[9]) == pro.Program_PID)
                     {
                         list.Remove(l);
                         break;
                     }
                 }
             }
             DailyCmdProgramStop stop = new DailyCmdProgramStop
             {
                 B_Address_type        = pro.B_Address_type,
                 list_Terminal_Address = pro.Program.list_Terminal_Address,
                 NetID       = pro.NetID,
                 PCR_PID     = Convert.ToInt16(pro.PCR_PID),
                 Program_PID = pro.Program_PID,
                 ServiceID   = pro.ServiceID,
                 TSID        = pro.TSID,
             };
             list.Add(stop.GetCmd());
             table.list_daily_cmd = list;
             (MdiParent as EBMMain).EbMStream.Daily_Broadcast_Table = table;
             //  (MdiParent as EBMMain).EbMStream.SignatureCallbackRef = new EBMStream.SignatureCallBackDelegateRef(Calcle.SignatureFunc);//每次在 Initialization()之前调用
             (MdiParent as EBMMain).EbMStream.Initialization();
             (MdiParent as EBMMain).UpdateDataText();
             dgvChangeProgram[e.ColumnIndex, e.RowIndex].Value = "开始广播";
             pro.BroadcastStatus = "已停止";
         }
         else if ((string)dgvChangeProgram[e.ColumnIndex, e.RowIndex].Value == "开始广播")
         {
             pro.SendState = true;
             DailyBroadcastTable table = (MdiParent as EBMMain).EbMStream.Daily_Broadcast_Table;
             if (table == null)
             {
                 GetDailyBroadcastTable(ref table);
             }
             List <DailyCmd> list = table.list_daily_cmd;
             foreach (var l in list)
             {
                 if (l.B_Daily_cmd_tag == 2)
                 {
                     if ((short)((l.Br_Daily_cmd_char[8] << 8) + l.Br_Daily_cmd_char[9]) == pro.Program_PID)
                     {
                         list.Remove(l);
                         break;
                     }
                 }
             }
             list.Add(pro.Program.GetCmd());
             table.list_daily_cmd = list;
             (MdiParent as EBMMain).EbMStream.Daily_Broadcast_Table = table;
             // (MdiParent as EBMMain).EbMStream.SignatureCallbackRef = new EBMStream.SignatureCallBackDelegateRef(Calcle.SignatureFunc);//每次在 Initialization()之前调用
             (MdiParent as EBMMain).EbMStream.Initialization();
             dgvChangeProgram[e.ColumnIndex, e.RowIndex].Value = "停止广播";
             pro.BroadcastStatus = "正在广播";
         }
     }
     dgvChangeProgram.Invalidate(dgvChangeProgram.GetRowDisplayRectangle(e.RowIndex, true));
 }