/// ------------------------------------------------------------------------------------
 internal void Initialize(IPhoneInfo phoneInfo)
 {
     lblMonogram.Text        = phoneInfo.Phone;
     lblNormallyCount.Text   = phoneInfo.TotalCount.ToString();
     lblPrimaryCount.Text    = phoneInfo.CountAsPrimaryUncertainty.ToString();
     lblNonPrimaryCount.Text = phoneInfo.CountAsNonPrimaryUncertainty.ToString();
     RefreshFonts();
     m_siblingUncertaintiesExist = SetSiblingUncertainties(phoneInfo.SiblingUncertainties);
 }
예제 #2
0
        /// ------------------------------------------------------------------------------------
        private Label CreateLabel(IPhoneInfo phoneInfo)
        {
            var lbl = new Label();

            lbl.Font      = Font;
            lbl.Text      = phoneInfo.Phone;
            lbl.BackColor = Color.Transparent;
            lbl.AutoSize  = false;
            lbl.Size      = lbl.PreferredSize;
            lbl.Height   += _extraPhoneHeight;
            lbl.Margin    = new Padding(0);
            lbl.Tag       = phoneInfo;
            return(lbl);
        }
예제 #3
0
        public override MessageDomainEventArgs Send(IPhoneInfo phoneInfo)
        {
            MessageDomainEventArgs messageDomainEventArgs = new MessageDomainEventArgs();

            try
            {
                TryToSendWithReconnect(phoneInfo);
                messageDomainEventArgs.status = Status.Sended;
            }
            catch (Exception ex)
            {
                messageDomainEventArgs.status = Status.NotSened;
            }

            return(messageDomainEventArgs);
        }
예제 #4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets a value indicating whether or not the specified phone information matches the
        /// current mask(s).
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private bool GetIsPhoneEnabled(IPhoneInfo phoneInfo)
        {
            if (phoneInfo == null)
            {
                return(false);
            }

            var mask1 = (_srchClassType == SearchClassType.Articulatory ? _aMask : _bMask);
            var mask2 = (_srchClassType == SearchClassType.Articulatory ? phoneInfo.AMask : phoneInfo.BMask);

            if (mask1.IsEmpty)
            {
                return(false);
            }

            return(_allFeaturesMustMatch ? mask2.ContainsAll(mask1) : mask2.ContainsOneOrMore(mask1));
        }
예제 #5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void m_lvFeatures_FeatureChanged(object sender, ulong[] newMasks)
        {
            if (m_grid.CurrentRow == null)
            {
                return;
            }

            IPhoneInfo phoneInfo = m_grid.CurrentRow.Cells["phone"].Value as IPhoneInfo;

            if (phoneInfo == null)
            {
                return;
            }

            phoneInfo.Masks = m_lvFeatures.CurrentMasks;
            m_grid.CurrentRow.Cells["features"].Value =
                DataUtils.AFeatureCache.GetFeaturesText(phoneInfo.Masks);
        }
예제 #6
0
        private void TryToSendWithReconnect(IPhoneInfo phoneInfo)
        {
            try
            {
                var rezz = tLGun.SendMessageTo(phoneInfo);
            }
            catch (Exception ex)
            {
                log.LogWarning("Message did not send, reconnection start");

                //timerGetMessagesFromQueue.Change(Timeout.Infinite, Timeout.Infinite);
                tLGun.Reconnect();
                //timerGetMessagesFromQueue.Change(0, _miliseconds);

                log.LogInformation("Reconnection Complite");
                var rezz = tLGun.SendMessageTo(phoneInfo);
            }
        }
예제 #7
0
        public override MessageDomainEventArgs Send(IPhoneInfo phoneInfo)
        {
            var status = whatsApp.SendMessage(phoneInfo.Id, phoneInfo.PhoneNumber, phoneInfo.Message);


            if (status == System.Net.HttpStatusCode.OK)
            {
                return new MessageDomainEventArgs()
                       {
                           status = Status.Sended
                       }
            }
            ;
            else
            {
                return new MessageDomainEventArgs()
                       {
                           status = Status.NotSened
                       }
            };
        }
    }
예제 #8
0
        private void TryToSend(IPhoneInfo phoneInfo)
        {
            Monitor.Enter(synclock);

            MessageDomainEventArgs domainEventArgs = new MessageDomainEventArgs();

            domainEventArgs.phoneInfo = phoneInfo;
            try
            {
                domainEventArgs = Send(phoneInfo);

                //domainEventArgs.status = Status.Sended;
            }
            catch (Exception ex)
            {
                //log.LogError("Message not sended :", ex);
                domainEventArgs.status      = Status.NotSened;
                domainEventArgs.Description = ex.Message;
            }
            Monitor.Exit(synclock);
            OnMessageEvent(domainEventArgs);
        }
 /// ------------------------------------------------------------------------------------
 public override void SetMaskFromPhoneInfo(IPhoneInfo phoneInfo)
 {
     CurrentMask = phoneInfo != null ? phoneInfo.AMask : null;
 }
 /// ------------------------------------------------------------------------------------
 public virtual void SetMaskFromPhoneInfo(IPhoneInfo phoneInfo)
 {
     throw new NotImplementedException();
 }
예제 #11
0
 public void AddMessageToQueue(IPhoneInfo phoneInfo)
 {
     concurrentSendingQueue.Enqueue(phoneInfo);
 }
예제 #12
0
 public abstract MessageDomainEventArgs Send(IPhoneInfo phoneInfo);