private void InitFrame() { if (ViewModel.Frame == null) { ProfileType p = Storage.GetAll <ProfileType>().Find(i => i.Shape == ProfileShape.L); if (p == null) { MessageBox.Show("There is no profile type defined.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } Frame = new PVCFrame(ViewModel.Width, ViewModel.Height, Storage.GetAll <ProfileType>()[0]); ViewModel.Modified = true; Frame.FontSize = (float)FrameFontSize.SelectedItem; } else { Frame = (PVCFrame)ViewModel.Frame.ToFrame(); FrameFontSize.SelectedValue = Frame.FontSize; } Frame.Click += Frame_Click; Frame.Model.Code = ViewModel.Code; ShowCodesCheckBox.IsChecked = Frame.ShowCodes; Canvas.Layer.AddChild(Frame); SelectionEventHandler = new SelectionEventHandler(Frame); DivisionEventHandler = new DivisionEventHandler(Frame.Surface); SashCreationEventHandler = new SashCreationEventHandler(Frame.Surface); FillingCreationEventHandler = new FillingCreationEventHandler(Frame.Surface); DragEventHandler = new MullionDragEventHandler(Canvas, Frame); PanEventHandler = new PPanEventHandler(); Decorator = new FrameDecorator(Frame, Canvas.Layer); Decorator.EnableFrameDecorator(); SelectionEventHandler.SelectionChanged += SelectionEventHandler_SelectionChanged; LProfileComboBox.SelectedItem = Frame.Model.ProfileType; UProfileComboBox.SelectedItem = Frame.Model.UProfileType; OnPropertyChanged("UnitWidth"); OnPropertyChanged("UnitHeight"); Frame.DimensionChanged += Frame_DimensionChanged; }
public Actor(BaseWorld world) : base(world) { _selectionEventHandler = new ActorSelectionEventHandler(this); }
/// <summary> /// Removes a handler for the SelectionChanged attached event /// </summary> /// <param name="element">UIElement or ContentElement that listens to the event</param> /// <param name="handler">Event handler to be removed</param> public static void RemoveSelectionChangedHandler(DependencyObject element, SelectionEventHandler handler) { RoutedEventHelper.RemoveHandler(element, SelectionChangedEvent, handler); }