void ReleaseDesignerOutlets() { if (ConnectBluetoothButton != null) { ConnectBluetoothButton.Dispose(); ConnectBluetoothButton = null; } if (DisconnectButton != null) { DisconnectButton.Dispose(); DisconnectButton = null; } if (MoveDownButton != null) { MoveDownButton.Dispose(); MoveDownButton = null; } if (MoveLeftButton != null) { MoveLeftButton.Dispose(); MoveLeftButton = null; } if (MovementView != null) { MovementView.Dispose(); MovementView = null; } if (MoveRightButton != null) { MoveRightButton.Dispose(); MoveRightButton = null; } if (MoveUpButton != null) { MoveUpButton.Dispose(); MoveUpButton = null; } if (OptionsView != null) { OptionsView.Dispose(); OptionsView = null; } }
private void MemberSelect_MouseDoubleClick(object sender, MouseButtonEventArgs e) { MoveLeftButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); e.Handled = true; }
/// <summary> /// Initializes a new instance of the <see cref="ChangeImage"/> class with the specified /// <see cref="EntityImage"/>.</summary> /// <param name="image"> /// The <see cref="EntityImage"/> whose data to change.</param> /// <exception cref="PropertyValueException"> /// The current <see cref="ImageSection"/> contains an empty <see /// cref="ImageSection.ImageFiles"/> collection.</exception> /// <exception cref="ArgumentNullException"> /// <paramref name="image"/> is a null reference.</exception> /// <remarks> /// The data of the specified <paramref name="image"/> may be changed in the dialog, as /// indicated by the value of the <see cref="DataChanged"/> property.</remarks> public ChangeImage(EntityImage image) { if (image == null) { ThrowHelper.ThrowArgumentNullException("image"); } // require non-empty ImageFiles for simplicity if (MasterSection.Instance.Images.ImageFiles.Count == 0) { ThrowHelper.ThrowPropertyValueException( "MasterSection.Instance.Images.ImageFiles", Tektosyne.Strings.PropertyEmpty); } this._image = image; InitializeComponent(); Title += image.Id; // initialize frame control buttons AddFrameButton.ShowSymbol(Symbols.BoxEmpty); RemoveFrameButton.ShowSymbol(Symbols.BoxCrossed); MoveLeftButton.ShowSymbol(Symbols.ArrowLeft); MoveRightButton.ShowSymbol(Symbols.ArrowRight); // set maximum ranges for frame dimensions LeftUpDown.Maximum = Int32.MaxValue; TopUpDown.Maximum = Int32.MaxValue; WidthUpDown.Minimum = 1; WidthUpDown.Maximum = Int32.MaxValue; HeightUpDown.Minimum = 1; HeightUpDown.Maximum = Int32.MaxValue; // add image files to combo box foreach (string id in MasterSection.Instance.Images.ImageFiles.Keys) { FileCombo.Items.Add(id); } // add animation options to combo boxes AnimationCombo.ItemsSource = Enum.GetValues(typeof(AnimationMode)); SequenceCombo.ItemsSource = Enum.GetValues(typeof(AnimationSequence)); // add scaling options to combo boxes var scalingValues = Enum.GetValues(typeof(ImageScaling)); ScalingXCombo.ItemsSource = scalingValues; ScalingYCombo.ItemsSource = scalingValues; // set animation & scaling options AnimationCombo.SelectedItem = image.Animation; SequenceCombo.SelectedItem = image.Sequence; ScalingXCombo.SelectedItem = image.ScalingX; ScalingYCombo.SelectedItem = image.ScalingY; // enable sequence control if animation enabled SequenceCombo.IsEnabled = (image.Animation != AnimationMode.None); // initialize list box parameters FrameList.Polygon = MasterSection.Instance.Areas.MapGrid.Element; FrameList.ScalingX = image.ScalingX; FrameList.ScalingY = image.ScalingY; // add default rectangle if none defined if (image.Frames.Count == 0) { image.Frames.Add(CreateFrame()); } // add frame bounds to list box foreach (ImageFrame frame in image.Frames) { RectI bounds = frame.Bounds; // correct any illegal location values int maxPoint = SimpleXml.MaxPointIValue; int left = Math.Max(0, Math.Min(maxPoint, bounds.Left)); int top = Math.Max(0, Math.Min(maxPoint, bounds.Top)); // correct any illegal size values int maxSize = SimpleXml.MaxSizeIValue; int width = Math.Max(1, Math.Min(maxSize, bounds.Width)); int height = Math.Max(1, Math.Min(maxSize, bounds.Height)); // add frame with corrected bounds to list box RectI newBounds = new RectI(left, top, width, height); ImageFrame newFrame = new ImageFrame(frame); newFrame.Bounds = newBounds; FrameList.Items.Add(new ImageListBoxItem(newFrame)); // add invalid file identifier to combo box string fileId = newFrame.Source.Key; if (!String.IsNullOrEmpty(fileId) && !FileCombo.Items.Contains(fileId)) { FileCombo.Items.Add(fileId); } } // disable Remove if only one frame defined RemoveFrameButton.IsEnabled = (FrameList.Items.Count > 1); // animate dashed outline of frame marker DoubleAnimation animation = new DoubleAnimation(10, 0, Duration.Automatic); animation.RepeatBehavior = RepeatBehavior.Forever; FrameMarker.BeginAnimation(Shape.StrokeDashOffsetProperty, animation); // construction completed this._initialized = true; }