Page 2 of 2

Re: Using EventTriggers gives error

Posted: 03 Nov 2016, 16:29
by esses
What you have to make sure is that the xaml is correctly processed (without errors) after the InvokeCommand class is compiled and available in the assembly.
How can I make sure it is compiled and available? I don't get any error/warning to the NoesisGUIPanel component or the console. Rebuilding from Noesis Settings menu didn't help. Now I get this error in Blend:
latesterror.png
Latest error.

Re: Using EventTriggers gives error

Posted: 04 Nov 2016, 14:39
by sfernandez
In Unity, we write messages to the Console window whenever we found warnings or errors processing the xamls. And if the xaml set in the NoesisGUIPanel contains errors, we also show in the component inspector a message to indicate it. You can see it here: http://www.noesisengine.com/docs/Gui.Co ... -noesisgui

The error in Blend maybe is because InvokeCommand class doesn't inherit from UIElement. Make sure of that, and maybe you don't have a public empty constructor for the class either:
namespace Assets.GloryAssets.Scripts.GUI.NoesisCommands
{
  public public class InvokeCommand : FrameworkElement
  {
    public InvokeCommand()
    {
    }
    ...
  }
}

Re: Using EventTriggers gives error

Posted: 07 Nov 2016, 13:12
by esses
Well, it is inherited from FrameWorkElement. After meddling around the issue disappeared, but it reappared after commenting
    <local:InvokeCommand x:Name="enterCommandInvoker"
        Command="{Binding EnterCommand}"
        CommandParameter="{Binding ElementName=rect}"/>
and uncommenting.

Simply creating a new scene and copy-pasting the example codes and putting them to NoesisGUIPanel (and trying rebuilding noesis + adding the public empty constructor) won't work. Red square is drawn, no warnings or errors in console nor in NoesisGUIPanel. InvokeCommandTestBehavior is attached to the NoesisGUIPanel object.

It seems I will have to do the UI differently. Thank you for the help.

Re: Using EventTriggers gives error

Posted: 08 Nov 2016, 09:57
by Etana
Hi Sfernandez,
First, thanks for helping me and Esses with our noesis issues.

After looking at your example with Esses and wondering why it works quite randomly we found out that keytime you placed in your example
<DiscreteBooleanKeyFrame KeyTime="0:0:0.01" Value="False"/> 
Was way too fast for unity/noesis to fire that invokeCommand, after changing time to
<DiscreteBooleanKeyFrame KeyTime="0:0:0.1" Value="False"/> 
Then mouseEnter occured everytime when ever mouse did enter that red rectancle.

Re: Using EventTriggers gives error

Posted: 10 Nov 2016, 19:51
by sfernandez
I guess my machine was faster 8-)

Anyway, the trick here is just provide a change in the value to fire the trigger, so it is ok to use a bigger duration.
I'm glad it worked fine.

Re: Using EventTriggers gives error

Posted: 11 Nov 2016, 21:54
by jsantos
Anyway, I am not sure if this behavior is correct. Even if you use a very small delta time, the command should be invoked.

We are investigating it.

Thanks!

Re: Using EventTriggers gives error

Posted: 25 Jul 2023, 15:17
by MarcusM-PDX
A bit of a necro here, but for anyone that sees this, one useful thing you can do which appears to work for me is that instead of the following:
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="enterCommandInvoker"
				Storyboard.TargetProperty="Invoke">
	<DiscreteBooleanKeyFrame KeyTime="0" Value="True"/>
	<DiscreteBooleanKeyFrame KeyTime="0:0:0.01" Value="False"/>
</BooleanAnimationUsingKeyFrames>
You can set the FillBehavior on the BooleanAnimationUsingKeyFrames to "Stop" and do without the False value. Like so:
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="enterCommandInvoker"
				Storyboard.TargetProperty="Invoke"
				FillBehaviour="Stop">
	<DiscreteBooleanKeyFrame KeyTime="0" Value="True"/>
</BooleanAnimationUsingKeyFrames>
I believe this now makes the resetting of the behavior immune to the framerate issues that were discussed before.

Re: Using EventTriggers gives error

Posted: 31 Jul 2023, 14:01
by sfernandez
Thanks a lot for sharing, this makes more sense as the animated value is removed as soon as the animation finishes, automatically restoring the oringinal false value.

Re: Using EventTriggers gives error

Posted: 01 Aug 2023, 11:16
by MarcusM-PDX
No problem, happy to help! The CommandInvoker solved a lot of problems for me, so I was happy to give back! :D