Ejemplo n.º 1
0
 private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     // If an image was selected...
     if (openDialog.ShowDialog() == true)
     {
         // Store the path to the image
         imagePath = openDialog.FileName;
         // And invoke the update function if it exists
         updateFunction?.Invoke();
     }
 }
Ejemplo n.º 2
0
 protected override void MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         setColor(drawingColorToColor(colorDialog.Color));
         updateFunction?.Invoke();
     }
     else
     {
         colorDialog.Color = colorToDrawingColor(selectedColor);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Steps the animation by t, and stores the new state. If the animation sequence isn't initalised, initFn is called.
        /// CompletionPredicate is checked at every step, if true and a callback function exists, callback is called first,
        /// then the function returns true. Returns false if completionPredicate evaluates to false.
        /// </summary>
        /// <param name="t">A parameter (usually deltaTime) that indicates how far along is the animation</param>
        /// <returns></returns>
        public bool Step(float t)
        {
            if (!initialised)
            {
                state       = initFn.Invoke();
                initialised = true;
            }
            state = updateFn.Invoke(state, t);

            completed = completionPredicate.Invoke(state);

            if (completed && callback != null)
            {
                callback.Invoke(state);
            }

            return(completed);
        }