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); }
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); } }
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(); }
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); } } }
private void UpdatePlanesMarket() { userMarketPlanesBuy.Invoke(new Action(() => userMarketPlanesBuy.GetPanel.Controls.Clear())); FillPlanesMarket(userMarketPlanesBuy); }
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; } }