public void OnDrop(object sender) { var element = sender as FrameworkElement; Mouse.OverrideCursor = Cursors.Arrow; if (!(element.DataContext is ISimulationService simulationService)) { throw new Exception($"Element {element} not implement {typeof(ISimulationService)}"); } StationCore = new StationCore(sender as Canvas, simulationService); simulationService.CreateModel(StationCore); StationCore.UnlockAll(); }
private static void Click(object sender, RoutedEventArgs e) { var dataContext = sender as FrameworkElement; Mouse.OverrideCursor = Cursors.Arrow; StationCore.UnlockAll(); if (!(dataContext.DataContext is ISimulationService simulationService)) { throw new Exception($"Element {dataContext} not implement {typeof(ISimulationService)}"); } simulationService.SetDragService(new CursorAnimation()); StationCore.SetStationPickService(new DefaultPickService(simulationService)); }
private static void Click(object sender, RoutedEventArgs e) { var dataContext = sender as FrameworkElement; Mouse.OverrideCursor = Cursors.Arrow; if (!(dataContext.DataContext is ISimulationService simulationService)) { throw new Exception($"Element {dataContext} not implement {typeof(ISimulationService)}"); } var vm = new RouteDialogeViewModel(); var content = new RouteDialogeView { DataContext = vm, }; Dialoge.ShowDialog(content, "Route builder"); simulationService.SetDragService(new CursorAnimation()); StationCore.SetStationPickService(new DefaultPickService(simulationService)); StationCore.UnlockAll(); }