예제 #1
0
 public void UpdatePlanes()
 {
     planesUI.Clear();
     planesToSellUI.Clear();
     userMarketPlanesSell.Invoke(new Action(() => userMarketPlanesSell.GetPanel.Controls.Clear()));
     FillPlanes(PlaneDataType.SellPlane, userMarketPlanesSell);
     userAiroportPlanes.Invoke(new Action(() => userAiroportPlanes.GetPanel.Controls.Clear()));
     FillPlanes(PlaneDataType.TransferPlane, userAiroportPlanes);
 }
예제 #2
0
 private void AddContractData(ContractData contractData)
 {
     contractData.Location = new Point(contractsStartX, contractsStartY);
     contractsStartY      += contractData.Height + 10;
     if (userAiroportContracts.IsHandleCreated)
     {
         userAiroportContracts.Invoke(new Action(() => userAiroportContracts.GetPanel.Controls.Add(contractData)));
     }
     else
     {
         userAiroportContracts.GetPanel.Controls.Add(contractData);
     }
 }
예제 #3
0
        private void setupTimer(int ValueChange, int FirstInterval, int SecondInterval, int ThereafterInterval)
        {
            repeatTimer          = new Timer();
            repeatTimer.Interval = FirstInterval;
            repeatTimer.Tick    += (s, ee) =>
            {
                switch (ValueChange)
                {
                case Int32.MaxValue:
                    if (ScrollSkip != null)
                    {
                        ScrollSkip.Invoke(false);
                    }
                    break;

                case Int32.MinValue:
                    if (ScrollSkip != null)
                    {
                        ScrollSkip.Invoke(true);
                    }
                    break;

                default:
                    int v = Value;
                    Value += ValueChange;
                    if (v != Value)
                    {
                        UserScroll.Invoke(this, Value);
                    }
                    else
                    {
                        repeatTimer.Stop();
                    }
                    break;
                }
                if (repeatTimer != null)
                {
                    if (repeatTimer.Interval == FirstInterval)
                    {
                        repeatTimer.Interval = SecondInterval;
                    }
                    else if (repeatTimer.Interval == SecondInterval)
                    {
                        repeatTimer.Interval = ThereafterInterval;
                    }
                }
            };
            repeatTimer.Start();
        }
예제 #4
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (dragStart >= 0 && this.Enabled && Range > 0)
     {
         int oldVal = valFromHandlePosition(e.Y - dragOffset);
         if (oldVal != val)
         {
             val = oldVal;
             this.Invalidate();
             Lib.DoEvents();
             UserScroll.Invoke(this, Value);
         }
     }
 }
예제 #5
0
 private void UpdatePlanesMarket()
 {
     userMarketPlanesBuy.Invoke(new Action(() => userMarketPlanesBuy.GetPanel.Controls.Clear()));
     FillPlanesMarket(userMarketPlanesBuy);
 }
예제 #6
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
            if (this.Enabled && Range > 0)
            {
                int oldVal = val;
                if (dragStart >= 0)
                {
                    val       = valFromHandlePosition(e.Y - dragOffset);
                    dragStart = -1;
                }
                else
                {
                    if (!killRepeatTimer())
                    {
                        switch (getCursorPosn(e.Y, (int)handlePosition()))
                        {
                        case CursorPosition.OnTopButton:
                            if (e.Button == MouseButtons.Right)
                            {
                                val = 0;
                            }
                            else
                            {
                                val = Math.Max(0, val - 1);
                            }
                            break;

                        case CursorPosition.OnBottomButton:
                            if (e.Button == MouseButtons.Right)
                            {
                                val = Range;
                            }
                            else
                            {
                                val = Math.Min(Range, val + 1);
                            }
                            break;

                        case CursorPosition.AboveHandle:
                            if (e.Button == MouseButtons.Right || LargeChange == 0)
                            {
                                val = valFromHandlePosition(e.Y);
                            }
                            else
                            {
                                Value -= LargeChange;
                            }
                            break;

                        case CursorPosition.BelowHandle:
                            if (e.Button == MouseButtons.Right || LargeChange == 0)
                            {
                                val = valFromHandlePosition(e.Y);
                            }
                            else
                            {
                                Value += LargeChange;
                            }
                            break;
                        }
                    }
                }
                if (oldVal != val)
                {
                    UserScroll.Invoke(this, Value);
                    this.Invalidate();
                }
            }
            else
            {
                dragStart = -1;
            }
        }