示例#1
0
        public bool Enqueue(TargetInfo[] range)
        {
            Monitor.Enter(internalQueue);
                foreach (TargetInfo ti in range)
                {
                    internalQueue.Enqueue(ti);
                }
                Monitor.Exit(internalQueue);
                ThreadStart ts = new ThreadStart(startTh);

                threadSessionStateChanged.Invoke(SenderState.QueueReady);
                if (mainThread==null || mainThread.ThreadState != ThreadState.Running)
                {
                    mainThread = new Thread(ts);
                    mainThread.Start();
                }
                threadSessionStateChanged.Invoke(SenderState.Started);
                return true;
        }
示例#2
0
 internal void AddMessageList(ExcelMessageList curES, ChangeProgressNotifier changeProgressDel)
 {
     int row = Settings.Default.list_row, col = Settings.Default.list_col;
     changeProgressDel(0);
     List<string> header = new List<string>();
     if (paramList.Count != 0)
         header.AddRange(curES.GetRange(row, col, row, col + (int)paramList.Count));
     else
         header.Add(curES.GetSingleValue(row, col));
     int vrow = row+1;
     int numIdx = (int)header.IndexOf("num")+1;
     int parIdx;
     do {
         TargetInfo ti = new TargetInfo();
         if (!MassMsgStorage.CheckNumber(curES.GetSingleValue(vrow, numIdx), ref ti.phoneNumber))
         {
             ti.preStatus = MessageStatus.IncorrectNumber;
         }
         if (ti.phoneNumber == String.Empty)
             break;
         foreach(string s in paramList)
         {
             parIdx = header.IndexOf(s);
             if (parIdx<0)
                 throw new Exception("There is no necessary variable in the list");
             string paramVal = curES.GetSingleValue(vrow, parIdx + 1);
             if (translitEnabled)
                 paramVal = Translit.Convert(paramVal);
             ti.paramList.Add(paramVal);
         }
         //ti.message = String.Format(templateStringCS, ti.paramList.ToArray());
         ti.message = templateStringCS;
         //if (ti.status == MessageStatus.IncorrectNumber)
         //    reportAdded(ti.phoneNumber, ti.paramList[0], ti.message, ti.status.ToString());
         rcvList.Add(ti);
         vrow++;
     } while (true);
     changeProgressDel(100);
 }
示例#3
0
 internal void EnqueueSingle(TargetInfo ti)
 {
     Enqueue(new TargetInfo[] { ti });
 }
示例#4
0
 private void toolStripButton5_Click(object sender, EventArgs e)
 {
     SingleMessageForm smf = new SingleMessageForm();
     smf.To = smsSetts.DefaultTo;
     if(DialogResult.OK == smf.ShowDialog(this))
     {
         TargetInfo ti = new TargetInfo();
         ti.message = smsSetts.NeedTransliteration ? Translit.Convert(smf.Msg):smf.Msg;
         ti.phoneNumber = smf.To;
         InitKS();
         kannelThreadSession.EnqueueSingle(ti);
     }
 }