public void MoveLed(object sender, MouseEventArgs e) { if (!_movingLed || SelectedLed == null || e.LeftButton == MouseButtonState.Released) { return; } var position = e.GetPosition((IInputElement)sender); SelectedLed.InputX = Math.Round(position.X - SelectedLed.LedLayout.Width / 2, 1).ToString(CultureInfo.InvariantCulture); SelectedLed.InputY = Math.Round(position.Y - SelectedLed.LedLayout.Height / 2, 1).ToString(CultureInfo.InvariantCulture); SelectedLed.ApplyInput(); }
public void SelectLed(LedViewModel ledViewModel) { if (SelectedLed != null) { SelectedLed.Selected = false; SelectedLed.SetColor(LedViewModel.UnselectedColor); } if (ledViewModel != null) { SelectedLed = ledViewModel; SelectedLed.Selected = true; SelectedLed.SetColor(LedViewModel.SelectedColor); } }
public void KeyUpDown(object sender, KeyEventArgs e) { if (e.Key == Key.LeftShift) { _movingLed = e.IsDown; Mouse.OverrideCursor = _movingLed ? Cursors.SizeAll : null; } else if (e.Key == Key.Escape) { if (SelectedLed != null) { SelectedLed.Selected = false; SelectedLed.SetColor(LedViewModel.UnselectedColor); SelectedLed = null; } } }
public void ApplyLed() { SelectedLed.ApplyInput(); }
public void SelectLedImage() { SelectedLed.SelectImage(); }