Exemplo n.º 1
0
        private void broker_OnWriteTextLog(string logMsg, eLogTextType type = eLogTextType.Info, eBrokerStatus status = eBrokerStatus.Unknow)
        {
            //switch (status)
            //{
            //    case eBrokerStatus.Buy:
            //        SumBuy++;
            //        break;
            //    case eBrokerStatus.Sell:
            //        SumSell++;
            //        break;
            //    case eBrokerStatus.GoodTrans:
            //        SumSell++;
            //        SumGoodTras++;
            //        break;
            //    case eBrokerStatus.BadTrans:
            //        SumSell++;
            //        SumBadTrans++;
            //        break;
            //    case eBrokerStatus.MissTrans:
            //        SumMissTrans++;
            //        break;
            //}

            //if (status != eBrokerStatus.Unknow)
            //{
            //    BindSummary();
            //}

            UpdateLogText(logMsg, type, status);
        }
Exemplo n.º 2
0
        private void UpdateLogText(string log, eLogTextType type = eLogTextType.Info)
        {
            Task.Factory.StartNew(() =>
                                  //Task.Run(() =>
            {
                this.Invoke((MethodInvoker)(() =>
                {
                    txtLog.AppendText(Environment.NewLine);
                    Color c;
                    switch (type)
                    {
                    case eLogTextType.Highlight:
                        c = Color.DarkMagenta;
                        break;

                    case eLogTextType.Error:
                        c = Color.Red;
                        break;

                    case eLogTextType.Warning:
                        c = Color.DarkBlue;
                        break;

                    default:
                        c = Color.Black;
                        break;
                    }
                    txtLog.Select(txtLog.TextLength, 0);
                    txtLog.SelectionColor = c;
                    txtLog.AppendText(log);
                    txtLog.ScrollToCaret();
                }));
            });
        }
Exemplo n.º 3
0
        void broker_OnWriteTextLog(string logMsg, eLogTextType type = eLogTextType.Info, eBrokerStatus status = eBrokerStatus.Unknow)
        {
            switch (status)
            {
            case eBrokerStatus.Buy:
                SumBuy++;
                break;

            case eBrokerStatus.Sell:
                SumSell++;
                break;

            case eBrokerStatus.GoodTrans:
                SumSell++;
                SumGoodTras++;
                break;

            case eBrokerStatus.BadTrans:
                SumSell++;
                SumBadTrans++;
                break;

            case eBrokerStatus.MissTrans:
                SumMissTrans++;
                break;
            }

            if (status != eBrokerStatus.Unknow)
            {
                BindSummary();
            }

            UpdateLogText(logMsg, type);
        }
Exemplo n.º 4
0
        private void UpdateLogText(string log, eLogTextType type = eLogTextType.Info, eBrokerStatus status = eBrokerStatus.Unknow)
        {
            Color c;

            switch (type)
            {
            case eLogTextType.Highlight:
                c = Color.SteelBlue;
                break;

            case eLogTextType.Error:
                c = Color.Crimson;
                break;

            case eLogTextType.Warning:
                c = Color.DarkBlue;
                break;

            case eLogTextType.LowLevel:
                c = Color.SlateGray;
                break;

            case eLogTextType.Important:
                c = Color.Red;
                break;

            default:
                c = Color.Black;
                break;
            }

            if (status == eBrokerStatus.Bet)
            {
                Task.Run(() =>
                {
                    this.Invoke((MethodInvoker)(() =>
                    {
                        txtLogBet.AppendText(Environment.NewLine);
                        var logBet = string.Concat(DateTime.Now, ">> ", log);
                        txtLogBet.Select(txtLogBet.TextLength, 0);
                        txtLogBet.SelectionColor = c;
                        txtLogBet.AppendText(logBet);
                        txtLogBet.ScrollToCaret();
                    }));
                });
            }

            Task.Run(() =>
            {
                this.Invoke((MethodInvoker)(() =>
                {
                    txtLog.AppendText(Environment.NewLine);
                    var logScan = string.Concat(DateTime.Now, ">> ", log);
                    txtLog.Select(txtLog.TextLength, 0);
                    txtLog.SelectionColor = c;
                    txtLog.AppendText(logScan);
                    txtLog.ScrollToCaret();
                }));
            });
        }
Exemplo n.º 5
0
 private void UpdateWriteTextLog(string log, eLogTextType type = eLogTextType.Info, eBrokerStatus status = eBrokerStatus.Unknow)
 {
     if (OnWriteTextLog != null)
     {
         Task.Factory.StartNew(() =>
         {
             OnWriteTextLog(log, type, status);
         });
     }
 }
Exemplo n.º 6
0
        private void UpdateLogText(string log, eLogTextType type = eLogTextType.Info)
        {
            Task.Run(() =>
            {
                this.Invoke((MethodInvoker)(() =>
                {
                    txtLog.AppendText(Environment.NewLine);
                    Color c;
                    switch (type)
                    {
                    case eLogTextType.Highlight:
                        c = Color.DarkMagenta;
                        break;

                    case eLogTextType.Error:
                        c = Color.Crimson;
                        break;

                    case eLogTextType.Warning:
                        c = Color.DarkBlue;
                        break;

                    case eLogTextType.LowLevel:
                        c = Color.SlateGray;
                        break;

                    case eLogTextType.Important:
                        c = Color.Red;
                        break;

                    default:
                        c = Color.Black;
                        break;
                    }
                    log = string.Concat(DateTime.Now, ">> ", log);
                    txtLog.Select(txtLog.TextLength, 0);
                    txtLog.SelectionColor = c;
                    txtLog.AppendText(log);
                    txtLog.ScrollToCaret();
                }));
            });
        }