Exemple #1
0
        private void FindOrdersButton_Click(object sender, EventArgs e)
        {
            DesyncController.Delete();

            List <Order> orders = new List <Order>();

            foreach (Order order in APIWrapper.GetMyOrders(0, AlgorithmComboBox.SelectedIndex))
            {
                orders.Add(order);
            }
            foreach (Order order in APIWrapper.GetMyOrders(1, AlgorithmComboBox.SelectedIndex))
            {
                orders.Add(order);
            }

            OrderContainer[] localOrders = OrderContainer.GetAll();
            foreach (Order order in orders)
            {
                bool exists = false;
                foreach (OrderContainer orderContainer in localOrders)
                {
                    if (orderContainer.ID == order.ID)
                    {
                        exists = true;
                    }
                }
                if (!exists)
                {
                    OrderContainer.Add(order.ServiceLocation, order.Algorithm, order.Price, order.SpeedLimit, new Pool(), order.ID, 0.001, 0.005, "");
                }
            }

            Refresh();
        }
Exemple #2
0
        public void Place(ref Panel place, ref Panel SyncOrderPanel)
        {
            if (height * (position + 1) > 400)
            {
                place.Size = new System.Drawing.Size(place.Size.Width, height * (position + 1));
            }
            else
            {
                place.Size = new System.Drawing.Size(place.Size.Width, 400);
            }

            panel.Location = new System.Drawing.Point(-1, (height - 1) * position);
            place.Controls.Add(panel);

            if (Sync != -1)
            {
                Button DesyncButton = new Button
                {
                    //Location = new System.Drawing.Point(0, panel.Location.Y + height / 2 - 5),
                    Location = new System.Drawing.Point(0, panel.Location.Y),
                    //Text = "",
                    BackColor = SystemColors.ButtonFace,
                    Height    = height,
                    Width     = SyncOrderPanel.Width - 2,
                    Image     = Properties.Resources.link_icon_black1,
                };
                DesyncButton.Click += (ob, args) =>
                {
                    DesyncController.Add(order.ID.ToString(), Sync.ToString());
                };
                DesyncButton.Click += TimerRefresh;
                SyncOrderPanel.Controls.Add(DesyncButton);
            }
        }
Exemple #3
0
        private void PositionPanels(ref List <OrderPanel> OrderPanels)
        {
            int  pos = 0;
            bool found;

            for (int i = 0; i < OrderPanels.Count; i++)
            {
                if (OrderPanels[i].position != -1)
                {
                    continue;
                }
                OrderPanels[i].position = pos;
                List <string> Desyncs = DesyncController.GetAll();

                found = false;

                for (int j = i + 1; j < OrderPanels.Count; j++)
                {
                    if (found)
                    {
                        continue;
                    }

                    if (
                        (OrderPanels[i].order.ServiceLocation != OrderPanels[j].order.ServiceLocation)
                        &&
                        (OrderPanels[i].order.MaxPrice == OrderPanels[j].order.MaxPrice)
                        &&
                        (OrderPanels[i].order.Limit == OrderPanels[j].order.Limit)
                        &&
                        ((OrderPanels[i].Sync == -1) && (OrderPanels[j].Sync == -1))
                        &&
                        (
                            (OrderPanels[i].order.OrderStats != null) && (OrderPanels[j].order.OrderStats != null)
                            ||
                            (OrderPanels[i].order.OrderStats == null) && (OrderPanels[j].order.OrderStats == null)
                        )
                        //&&
                        //()
                        )
                    {
                        string checkForth = OrderPanels[i].order.ID.ToString() + ":" + OrderPanels[j].order.ID.ToString();
                        string checkBack  = OrderPanels[j].order.ID.ToString() + ":" + OrderPanels[i].order.ID.ToString();
                        bool   quit       = false;
                        foreach (string desync in Desyncs)
                        {
                            if ((checkForth == desync) || (checkBack == desync))
                            {
                                quit = true;
                                continue;
                            }
                        }
                        if (quit)
                        {
                            continue;
                        }

                        OrderPanels[j].position = pos;

                        OrderPanels[i].Sync = OrderPanels[j].order.ID;
                        OrderPanels[j].Sync = OrderPanels[i].order.ID;

                        found = true;
                    }
                }
                pos++;
            }
        }