private void Initialize() { Array shapeTypes = Enum.GetValues(typeof(MsoAutoShapeType)); Bitmap[] shapeBitmaps = ShapeTypesToBitmaps(shapeTypes, TooltipsLabConstants.CalloutNameSubstring); for (int i = 0; i < shapeTypes.Length; i++) { if (shapeBitmaps[i] == null) { continue; } TooltipsLabSettingsShapeEntry newEntry = new TooltipsLabSettingsShapeEntry( (MsoAutoShapeType)shapeTypes.GetValue(i), shapeBitmaps[i]); shapeList.Items.Add(newEntry); if (newEntry.Type == lastSelectedShapeType) { shapeList.SelectedItem = newEntry; shapeList.ScrollIntoView(newEntry); } } for (int i = 0; i < TooltipsLabConstants.AnimationEffects.Length; i++) { TooltipsLabSettingsAnimationEntry newEntry = new TooltipsLabSettingsAnimationEntry( TooltipsLabConstants.AnimationEffects[i], TooltipsLabConstants.AnimationImages[i]); animationList.Items.Add(newEntry); if (newEntry.Type == lastSelectedAnimType) { animationList.SelectedItem = newEntry; animationList.ScrollIntoView(newEntry); } } }
private void OkButton_Click(object sender, RoutedEventArgs e) { TooltipsLabSettingsShapeEntry shapeItem = shapeList.SelectedItem as TooltipsLabSettingsShapeEntry; TooltipsLabSettingsAnimationEntry animationItem = animationList.SelectedItem as TooltipsLabSettingsAnimationEntry; if (shapeItem != null && animationItem != null) { DialogConfirmedHandler(shapeItem.Type, animationItem.Type); } Close(); }