/// <summary> /// Sets the retrieved values. /// </summary> /// <param name="zeroitTransitionInput">The zeroit transition input.</param> private void Set_Retrieved_Values(ZeroitTransitionInput zeroitTransitionInput) { zeroitTransitionInput.Target = (Control)mainControl_Control_ComboBox.SelectedItem; zeroitTransitionInput.Transitions = (ZeroitTransitorEdit.TransitionType)Enum.Parse( typeof(ZeroitTransitorEdit.TransitionType), mainControl_Transition_ComboBox.SelectedItem.ToString()); zeroitTransitionInput.Position = (ZeroitTransitorEdit.Positions)Enum.Parse( typeof(ZeroitTransitorEdit.Positions), mainControl_Position_ComboBox.SelectedItem.ToString()); zeroitTransitionInput.TransitionTime = (int)mainControl_Duration_Numeric.Value; zeroitTransitionInput.Destination = (int)mainControl_Destination_Numeric.Value; zeroitTransitionInput.No_Of_Flashes = (int)mainControl_NoOfFlashes_Numeric.Value; }
/// <summary> /// Initializes a new instance of <c>FillerEditorDialog</c> using an existing <c>Filler</c> /// at the default window position. /// </summary> /// <param name="zeroitTransitionInput">The zeroit transition input.</param> /// <exception cref="ArgumentNullException">zeroitTransitionInput</exception> /// <exception cref="System.ArgumentNullException">Thrown if <paramref name="peaceInput" /> is null.</exception> public ZeroitAnimateTransitionDialog(ZeroitTransitionInput zeroitTransitionInput) { if (zeroitTransitionInput == null) { throw new ArgumentNullException("zeroitTransitionInput"); } InitializeComponent(); SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.SupportsTransparentBackColor, true); Knob1AnimatorCreated(); Knob2AnimatorCreated(); Knob3AnimatorCreated(); Set_Initial_Values(zeroitTransitionInput); //AdjustDialogSize(); //SetInitial_Values(pizaroAnimatorInput); }
// This code allows the designer to generate the Shape constructor /// <summary> /// Converts the given value object to the specified type, using the specified context and culture information. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context.</param> /// <param name="culture">A <see cref="T:System.Globalization.CultureInfo" />. If null is passed, the current culture is assumed.</param> /// <param name="value">The <see cref="T:System.Object" /> to convert.</param> /// <param name="destinationType">The <see cref="T:System.Type" /> to convert the <paramref name="value" /> parameter to.</param> /// <returns>An <see cref="T:System.Object" /> that represents the converted value.</returns> public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { // Display string in designer return("(Customize)"); } else if (destinationType == typeof(InstanceDescriptor) && value is ZeroitTransitionInput) { ZeroitTransitionInput zeroitTransitionInput = (ZeroitTransitionInput)value; if (zeroitTransitionInput.Transitions == ZeroitTransitorEdit.TransitionType.Accelaration) { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(new Type[] { typeof(ZeroitTransitorEdit.TransitionType), typeof(int), typeof(ZeroitTransitorEdit.Positions), typeof(int), typeof(int), typeof(Control), typeof(int) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { zeroitTransitionInput._Transition, zeroitTransitionInput._destination, zeroitTransitionInput._Position, zeroitTransitionInput._TransitionTime, zeroitTransitionInput._No_Of_Flashes, zeroitTransitionInput._Target, zeroitTransitionInput.dummy_int })); } } else if (zeroitTransitionInput.Transitions == ZeroitTransitorEdit.TransitionType.Bounce) { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(new Type[] { typeof(ZeroitTransitorEdit.TransitionType), typeof(int), typeof(ZeroitTransitorEdit.Positions), typeof(int), typeof(int), typeof(Control), typeof(float) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { zeroitTransitionInput._Transition, zeroitTransitionInput._destination, zeroitTransitionInput._Position, zeroitTransitionInput._TransitionTime, zeroitTransitionInput._No_Of_Flashes, zeroitTransitionInput._Target, zeroitTransitionInput.dummy_float })); } } else if (zeroitTransitionInput.Transitions == ZeroitTransitorEdit.TransitionType.CriticalDamping) { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(new Type[] { typeof(ZeroitTransitorEdit.TransitionType), typeof(int), typeof(ZeroitTransitorEdit.Positions), typeof(int), typeof(int), typeof(Control), typeof(double) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { zeroitTransitionInput._Transition, zeroitTransitionInput._destination, zeroitTransitionInput._Position, zeroitTransitionInput._TransitionTime, zeroitTransitionInput._No_Of_Flashes, zeroitTransitionInput._Target, zeroitTransitionInput.dummy_double })); } } else if (zeroitTransitionInput.Transitions == ZeroitTransitorEdit.TransitionType.Deceleration) { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(new Type[] { typeof(ZeroitTransitorEdit.TransitionType), typeof(int), typeof(ZeroitTransitorEdit.Positions), typeof(int), typeof(int), typeof(Control), typeof(decimal) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { zeroitTransitionInput._Transition, zeroitTransitionInput._destination, zeroitTransitionInput._Position, zeroitTransitionInput._TransitionTime, zeroitTransitionInput._No_Of_Flashes, zeroitTransitionInput._Target, zeroitTransitionInput.dummy_decimal })); } } else if (zeroitTransitionInput.Transitions == ZeroitTransitorEdit.TransitionType.EaseInEaseOut) { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(new Type[] { typeof(ZeroitTransitorEdit.TransitionType), typeof(int), typeof(ZeroitTransitorEdit.Positions), typeof(int), typeof(int), typeof(Control), typeof(long) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { zeroitTransitionInput._Transition, zeroitTransitionInput._destination, zeroitTransitionInput._Position, zeroitTransitionInput._TransitionTime, zeroitTransitionInput._No_Of_Flashes, zeroitTransitionInput._Target, zeroitTransitionInput.dummy_long })); } } else if (zeroitTransitionInput.Transitions == ZeroitTransitorEdit.TransitionType.Flash) { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(new Type[] { typeof(ZeroitTransitorEdit.TransitionType), typeof(int), typeof(ZeroitTransitorEdit.Positions), typeof(int), typeof(int), typeof(Control), typeof(string) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { zeroitTransitionInput._Transition, zeroitTransitionInput._destination, zeroitTransitionInput._Position, zeroitTransitionInput._TransitionTime, zeroitTransitionInput._No_Of_Flashes, zeroitTransitionInput._Target, zeroitTransitionInput.dummy_string })); } } else if (zeroitTransitionInput.Transitions == ZeroitTransitorEdit.TransitionType.Linear) { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(new Type[] { typeof(ZeroitTransitorEdit.TransitionType), typeof(int), typeof(ZeroitTransitorEdit.Positions), typeof(int), typeof(int), typeof(Control), typeof(bool) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { zeroitTransitionInput._Transition, zeroitTransitionInput._destination, zeroitTransitionInput._Position, zeroitTransitionInput._TransitionTime, zeroitTransitionInput._No_Of_Flashes, zeroitTransitionInput._Target, zeroitTransitionInput.dummy_bool })); } } else if (zeroitTransitionInput.Transitions == ZeroitTransitorEdit.TransitionType.ThrowAndCatch) { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(new Type[] { typeof(ZeroitTransitorEdit.TransitionType), typeof(int), typeof(ZeroitTransitorEdit.Positions), typeof(int), typeof(int), typeof(Control), typeof(int), typeof(int) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { zeroitTransitionInput._Transition, zeroitTransitionInput._destination, zeroitTransitionInput._Position, zeroitTransitionInput._TransitionTime, zeroitTransitionInput._No_Of_Flashes, zeroitTransitionInput._Target, zeroitTransitionInput.dummy_int, zeroitTransitionInput.dummy_int })); } } else if (zeroitTransitionInput.Transitions == ZeroitTransitorEdit.TransitionType.Zeroit) { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(new Type[] { typeof(ZeroitTransitorEdit.TransitionType), typeof(int), typeof(ZeroitTransitorEdit.Positions), typeof(int), typeof(int), typeof(Control), typeof(int), typeof(float) }); if (ctor != null) { return(new InstanceDescriptor(ctor, new object[] { zeroitTransitionInput._Transition, zeroitTransitionInput._destination, zeroitTransitionInput._Position, zeroitTransitionInput._TransitionTime, zeroitTransitionInput._No_Of_Flashes, zeroitTransitionInput._Target, zeroitTransitionInput.dummy_int, zeroitTransitionInput.dummy_float })); } } else { ConstructorInfo ctor = typeof(ZeroitTransitionInput).GetConstructor(Type.EmptyTypes); if (ctor != null) { return(new InstanceDescriptor(ctor, null)); } } } return(base.ConvertTo(context, culture, value, destinationType)); }
/// <summary> /// Initializes a new instance of <c>FillerEditorDialog</c> using an existing <c>Filler</c> /// and positioned beneath the specified control. /// </summary> /// <param name="zeroitTransitionInput">The zeroit transition input.</param> /// <param name="c">Control beneath which the dialog should be placed.</param> /// <exception cref="System.ArgumentNullException">Thrown if <paramref name="filler" /> is null.</exception> public ZeroitAnimateTransitionDialog(ZeroitTransitionInput zeroitTransitionInput, Control c) : this(zeroitTransitionInput) { Zeroit.Framework.Transitions.AnimationEditors.Utilities.Draw.SetStartPositionBelowControl(this, c); }
/// <summary> /// Handles the Click event of the okBtn control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void okBtn_Click(object sender, EventArgs e) { if (mainControl_Transition_ComboBox.SelectedIndex == (int)ZeroitTransitorEdit.TransitionType.Accelaration) { zeroitTransitionInput = new ZeroitTransitionInput( ZeroitTransitorEdit.TransitionType.Accelaration, 100, ZeroitTransitorEdit.Positions.Left, 2000, 1, new Control(), 1); Set_Retrieved_Values(zeroitTransitionInput); } else if (mainControl_Transition_ComboBox.SelectedIndex == (int)ZeroitTransitorEdit.TransitionType.Bounce) { zeroitTransitionInput = new ZeroitTransitionInput( ZeroitTransitorEdit.TransitionType.Bounce, 100, ZeroitTransitorEdit.Positions.Left, 2000, 1, new Control(), 1f); Set_Retrieved_Values(zeroitTransitionInput); } else if (mainControl_Transition_ComboBox.SelectedIndex == (int)ZeroitTransitorEdit.TransitionType.CriticalDamping) { zeroitTransitionInput = new ZeroitTransitionInput( ZeroitTransitorEdit.TransitionType.CriticalDamping, 100, ZeroitTransitorEdit.Positions.Left, 2000, 1, new Control(), 1D); Set_Retrieved_Values(zeroitTransitionInput); } else if (mainControl_Transition_ComboBox.SelectedIndex == (int)ZeroitTransitorEdit.TransitionType.Deceleration) { zeroitTransitionInput = new ZeroitTransitionInput( ZeroitTransitorEdit.TransitionType.Deceleration, 100, ZeroitTransitorEdit.Positions.Left, 2000, 1, new Control(), (decimal)1); Set_Retrieved_Values(zeroitTransitionInput); } else if (mainControl_Transition_ComboBox.SelectedIndex == (int)ZeroitTransitorEdit.TransitionType.EaseInEaseOut) { zeroitTransitionInput = new ZeroitTransitionInput( ZeroitTransitorEdit.TransitionType.EaseInEaseOut, 100, ZeroitTransitorEdit.Positions.Left, 2000, 1, new Control(), (long)1); Set_Retrieved_Values(zeroitTransitionInput); } else if (mainControl_Transition_ComboBox.SelectedIndex == (int)ZeroitTransitorEdit.TransitionType.Flash) { zeroitTransitionInput = new ZeroitTransitionInput( ZeroitTransitorEdit.TransitionType.Flash, 100, ZeroitTransitorEdit.Positions.Left, 2000, 1, new Control(), ""); Set_Retrieved_Values(zeroitTransitionInput); } else if (mainControl_Transition_ComboBox.SelectedIndex == (int)ZeroitTransitorEdit.TransitionType.Linear) { zeroitTransitionInput = new ZeroitTransitionInput( ZeroitTransitorEdit.TransitionType.Linear, 100, ZeroitTransitorEdit.Positions.Left, 2000, 1, new Control(), false); Set_Retrieved_Values(zeroitTransitionInput); } else if (mainControl_Transition_ComboBox.SelectedIndex == (int)ZeroitTransitorEdit.TransitionType.ThrowAndCatch) { zeroitTransitionInput = new ZeroitTransitionInput( ZeroitTransitorEdit.TransitionType.ThrowAndCatch, 100, ZeroitTransitorEdit.Positions.Left, 2000, 1, new Control(), 1, 1); Set_Retrieved_Values(zeroitTransitionInput); } else if (mainControl_Transition_ComboBox.SelectedIndex == (int)ZeroitTransitorEdit.TransitionType.Zeroit) { zeroitTransitionInput = new ZeroitTransitionInput( ZeroitTransitorEdit.TransitionType.Zeroit, 100, ZeroitTransitorEdit.Positions.Left, 2000, 1, new Control(), 1, 1f); Set_Retrieved_Values(zeroitTransitionInput); } DialogResult = DialogResult.OK; }
/// <summary> /// Initializes a new instance of <c>FillerEditorDialog</c> using an empty <c>Filler</c> /// and positioned beneath the specified control. /// </summary> /// <param name="c">Control beneath which the dialog should be placed.</param> public ZeroitAnimateTransitionDialog(Control c) : this(ZeroitTransitionInput.Empty(), c) { }
/// <summary> /// Initializes a new instance of <c>FillerEditorDialog</c> using an empty <c>Filler</c> /// at the default window position. /// </summary> public ZeroitAnimateTransitionDialog() : this(ZeroitTransitionInput.Empty()) { }
/// <summary> /// Sets the initial values. /// </summary> /// <param name="zeroitTransitionInput">The zeroit transition input.</param> private void Set_Initial_Values(ZeroitTransitionInput zeroitTransitionInput) { #region Control foreach (var controlNames in zeroitTransitionInput.Target.FindForm().Controls) { mainControl_Control_ComboBox.Items.Add(controlNames); } mainControl_Control_ComboBox.Items.Add(zeroitTransitionInput.Target.FindForm()); for (int i = 0; i < mainControl_Control_ComboBox.Items.Count; i++) { if (zeroitTransitionInput.Target == (Control)(mainControl_Control_ComboBox.Items[i])) { mainControl_Control_ComboBox.SelectedIndex = i; } } #endregion #region Add Transitions to mainControl_Transition_ComboBox // get a list of member names from EasingFunctionTypes enum, // figure out the numeric value, and display foreach (string volume in Enum.GetNames(typeof(ZeroitTransitorEdit.TransitionType))) { mainControl_Transition_ComboBox.Items.Add(volume); } for (int i = 0; i < mainControl_Transition_ComboBox.Items.Count; i++) { if (zeroitTransitionInput.Transitions == (ZeroitTransitorEdit.TransitionType)Enum.Parse(typeof(ZeroitTransitorEdit.TransitionType), mainControl_Transition_ComboBox.Items[i].ToString())) { mainControl_Transition_ComboBox.SelectedIndex = i; } } #endregion #region Add Position to mainControl_Transition_ComboBox // get a list of member names from EasingFunctionTypes enum, // figure out the numeric value, and display foreach (string volume in Enum.GetNames(typeof(ZeroitTransitorEdit.Positions))) { mainControl_Position_ComboBox.Items.Add(volume); } for (int i = 0; i < mainControl_Position_ComboBox.Items.Count; i++) { if (zeroitTransitionInput.Position == (ZeroitTransitorEdit.Positions)Enum.Parse(typeof(ZeroitTransitorEdit.Positions), mainControl_Position_ComboBox.Items[i].ToString())) { mainControl_Position_ComboBox.SelectedIndex = i; } } #endregion mainControl_Duration_Numeric.Value = (int)zeroitTransitionInput.TransitionTime; mainControl_Destination_Numeric.Value = (int)zeroitTransitionInput.Destination; mainControl_NoOfFlashes_Numeric.Value = (int)zeroitTransitionInput.No_Of_Flashes; #region Animation Previewer transitionAnimator.TransitionTime = zeroitTransitionInput.TransitionTime; transitionAnimator.Destination = zeroitTransitionInput.Destination / 2; transitionAnimator.No_Of_Flashes = zeroitTransitionInput.No_Of_Flashes; #endregion }