Beispiel #1
0
        public void AddCamera(TableLayoutPanel tableLayoutPanel, string cameraName, Point point)
        {
            var playPanel = FindPlayPanel(cameraName);

            if (playPanel != null)
            {
                //xóa play panel cũ
                playPanels.Remove(playPanel);
            }

            playPanel           = new PlayPanel();
            playPanel.Padding   = new Padding(0);
            playPanel.Margin    = new Padding(0);
            playPanel.BackColor = Color.Black;
            playPanel.Name      = cameraName;
            playPanel.Dock      = DockStyle.Fill;
            playPanel.setBorderColor(Color.White, 1);

            playPanels.Add(playPanel);
            tableLayoutPanel.Controls.Clear();
            if (tableLayoutPanel.InvokeRequired)
            {
                tableLayoutPanel.BeginInvoke((MethodInvoker) delegate()
                {
                    tableLayoutPanel.Controls.Add(playPanel, point.X, point.Y);
                });
            }
            else
            {
                tableLayoutPanel.Controls.Add(playPanel, point.X, point.Y);
            }
        }
Beispiel #2
0
        public void clearAll()
        {
            if (paneltable.InvokeRequired)
            {
                paneltable.BeginInvoke((MethodInvoker) delegate() { this.paneltable.Controls.Clear(); });
            }
            else
            {
                this.paneltable.Controls.Clear();
            }

            this.quickpics = new List <Label>();
            this.fileNames = new List <String>();
        }
Beispiel #3
0
        public void write(string msg)
        {
            Label message = new System.Windows.Forms.Label();

            message.AutoSize = true;
            message.Size     = new System.Drawing.Size(40, 40);
            message.Text     = msg;
            message.Visible  = true;
            message.TabIndex = tab++;
            message.Show();
            if (mesagePanel.InvokeRequired)
            {
                mesagePanel.BeginInvoke(new Action <Label>((s)
                                                           => mesagePanel.Controls.Add(s)), message);
            }
            else
            {
                mesagePanel.Controls.Add(message);
            }
        }
Beispiel #4
0
        public bool IsSetLimitSuccessful(double limit, int limitOrderType, int direction)
        {
            if (limitOrderType * direction < 0)
            {
                //Trying to set a stop loss on a buy position, or a target profit on a sell position,
                //limit needs to be below current price
                if (limit < stockInFocusLastPrice)
                {
                    //Find the trade by searching by id, then add the limit to it
                    Trade tempTrade = stockList.Find(x => x.Id == tradeInFocus);
                    if (limitOrderType == SLTPOrderItem.SET_STOPP_LOSS)
                    {
                        tempTrade.StopLoss = limit;
                    }
                    if (limitOrderType == SLTPOrderItem.SET_TARGET_PROFIT)
                    {
                        tempTrade.TargetProfit = limit;
                    }

                    //Repaint form containing info about positions
                    if (portfolioTable.InvokeRequired)
                    {
                        portfolioTable.BeginInvoke(new MethodInvoker(() => RepaintPortfolioTable()));
                    }
                    else
                    {
                        RepaintPortfolioTable();
                    }

                    return(true);
                }
            }
            else if (limitOrderType * direction > 0)
            {
                //Trying to set a stop loss on a sell position, or a target profit on a buy position,
                //limit needs to be above current price
                if (limit > stockInFocusLastPrice)
                {
                    //Find the trade by searching by id, then add the limit to it
                    Trade tempTrade = stockList.Find(x => x.Id == tradeInFocus);
                    if (limitOrderType == SLTPOrderItem.SET_STOPP_LOSS)
                    {
                        tempTrade.StopLoss = limit;
                    }
                    if (limitOrderType == SLTPOrderItem.SET_TARGET_PROFIT)
                    {
                        tempTrade.TargetProfit = limit;
                    }

                    //Repaint form containing info about positions
                    if (portfolioTable.InvokeRequired)
                    {
                        portfolioTable.BeginInvoke(new MethodInvoker(() => RepaintPortfolioTable()));
                    }
                    else
                    {
                        RepaintPortfolioTable();
                    }

                    return(true);
                }
            }
            return(false);
        }