Exemple #1
0
        public IAPForm(IAP origin)
        {
            InitializeComponent();
            iap       = origin;
            this.Text = iap.Text;
            this.Icon = Properties.Resources.favicon;
            this.timestTransLogGridColumn.DefaultCellStyle.Format = "dd/MM/yyyy HH:mm:ss";
            this.timestEventGridColumn.DefaultCellStyle.Format    = "dd/MM/yyyy HH:mm:ss";
            this.responseCodeDataGridViewTextBoxColumn.HeaderCell.ContextMenuStrip = responseCodeContextMenu;

            CreateTimer(this.GetStatus, 1000, ref updateStatus);
        }
Exemple #2
0
        public TrafficChart(IAP parentIap, char hostRole)
        {
            ParentIAP = parentIap;
            role      = hostRole;
            mainForm  = IAP.mainForm;

            if (role == ParentIAP.role)
            {
                chartCount = 1;
            }
            else if (ParentIAP.role == 'B')
            {
                chartCount = (role == 'I') ? 1 : 2;
            }

            for (int i = 0; i < 10; i++)
            {
                lastTransactions.Add(new Transaction {
                    ID = Int32.MinValue, ResponseCode = -1, Time = default(DateTime)
                });
            }
        }
Exemple #3
0
        public void GetFromTimer(Dictionary <string, List <Transaction> > TransForIAP)
        {
            Database.firstExecution = false;
            DateTime maxLastTime = DateTime.MinValue;

            foreach (KeyValuePair <string, List <Transaction> > transForIAP in TransForIAP)
            {
                if (IAP.IAPs.ContainsKey(transForIAP.Key))
                {
                    if (transForIAP.Value[transForIAP.Value.Count - 1].Time > maxLastTime)
                    {
                        maxLastTime = transForIAP.Value[transForIAP.Value.Count - 1].Time;
                    }
                    int lastIndex = transForIAP.Value.FindIndex(o => o.ID == IAP.IAPs[transForIAP.Key].lastID);

                    if (lastIndex > -1 && lastIndex + 1 <= transForIAP.Value.Count)
                    {
                        transForIAP.Value.RemoveRange(0, lastIndex + 1);
                    }
                    IAP.IAPs[transForIAP.Key].Update(transForIAP.Value);
                }
            }
            foreach (IAP IAP in IAP.IAPs.Values)
            {
                IAP.Invalidate(false);
            }

            UpdateTimer = new System.Threading.Timer(db.GetTransactions, null, 1000, System.Threading.Timeout.Infinite);

            CurrentTimeLabel.Text         = $"Current time: {DateTime.Now.ToString("HH:mm:ss")}";
            LastTransactionTimeLabel.Text = $"Last transaction time: {maxLastTime.ToString("HH:mm:ss")}";
            PerSecLabel.Text = $"All per second: {beautifyNumber(transForSec)} (max. {beautifyNumber(db.forSecondMax)})";

            PerMinLabel.Text       = $"All per minute: {beautifyNumber(transForMinute)} (max. {beautifyNumber(db.forMinuteMax)})";
            PerHourLabel.Text      = $"All per hour: {beautifyNumber(transForHour)} (max. {beautifyNumber(db.forHourMax)})";
            FromMidnightLabel.Text = $"All from midnight: {beautifyNumber(transFromMidnight)}";
        }