picpic2006
Topic Author
Posts: 67
Joined: 07 Nov 2013, 15:59

Noesis.Extended ?

26 Aug 2015, 10:54

Hello,

i didn't use noesis since a while, i really missing something new here.
I just try to bind a text property from a usercontrol to a textblock in xaml
I did that lot of times before, but now it doesn't work any more !

It appear you change the code to accomplish it can you tell me more about the new method.

xaml
<Grid x:Name="LayoutRoot"  TextElement.FontFamily="../Fonts/#Arial">
		<Rectangle Fill="#FFF4F4F5" Stroke="Black"/>
		<StackPanel Margin="172.967,107" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
			<TextBlock x:Name="Labeltxt" Text="{Binding ElementName=root, Path=Text}" TextWrapping="Wrap" FontSize="32" Margin="0,0,-0.001,0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black"/>
			<Button x:Name="AnnulerBtn" Content="Annuler" Style="{DynamicResource RedBtn}" VerticalAlignment="Top" FontSize="24" FontWeight="Bold" Foreground="White" Margin="0,5,0,0" Height="80"/>
			<Button x:Name="ValiderBtn" Content="Valider" Style="{DynamicResource GreenBtn}" FontSize="24" FontWeight="Bold" Foreground="White" Margin="0,5,0,0" Height="80"/>
		</StackPanel>
	</Grid>
c#

using Noesis;
using System;
using UnityEngine;


    [Noesis.UserControlSource("Assets/Gui/UserControls/PopUp.xaml")]

    public class PopUpControl : UserControl
    {

        public DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string),
        typeof(PopUpControl), new PropertyMetadata(""));

        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        private Button Annulerbtn;
        private Button.ClickHandler annulerEventHandler;


        public Button.ClickHandler AnnulerEventHandler
        {
            set
            {
                annulerEventHandler = value;
                if (Annulerbtn != null)
                {
                    Annulerbtn.Click += annulerEventHandler;
                }
            }
        }

        private Button Validerbtn;
        private Button.ClickHandler validerEventHandler;

        public Button.ClickHandler ValiderEventHandler
        {
            set
            {
                validerEventHandler = value;
                if (Validerbtn != null)
                {
                    Validerbtn.Click += validerEventHandler;
                }
            }
        }


        public void OnPostInit()
        {
            Validerbtn = (Button)FindName("ValiderBtn");
            Annulerbtn = (Button)FindName("AnnulerBtn");
            Annulerbtn.Click += annulerEventHandler;
            Validerbtn.Click += validerEventHandler;
        }

    }



Sorry if the question seem so stupid !
Exception: System.ApplicationException: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: DependencyProperty 'Text' already registered to type 'PopUpControl'
  at Noesis.Error.Check () [0x00020] in F:\2015_Affaire_Anthony\15_XXX Edf_Borne\Engine\Opinio\Assets\Plugins\NoesisGUI\Scripts\Core\NoesisError.cs:21 
  at Noesis.DependencyProperty.Noesis_RegisterDependencyProperty_String_ (IntPtr classType, IntPtr propertyName, IntPtr propertyMetada
Noesis.Error.Check () (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisError.cs:21)
Noesis.UIRenderer.Noesis_MouseButtonUp (Int32 rendererId, Single x, Single y, Int32 button) (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisUIRendererImports.cs:202)
Noesis.UIRenderer.ProcessEvent (UnityEngine.Event ev, Boolean enableKeyboard, Boolean enableMouse) (at Assets/Plugins/NoesisGUI/Scripts/Core/NoesisUIRenderer.cs:417)
NoesisGUIPanel.OnGUI () (at Assets/Plugins/NoesisGUI/Scripts/NoesisGUIPanel.cs:448)
 
picpic2006
Topic Author
Posts: 67
Joined: 07 Nov 2013, 15:59

Re: Noesis.Extended ?

26 Aug 2015, 15:03

Hello again,

i have an other question i try to build for windows 8 store with out succes, i try to build, i have an error
Failed to patch file
UnityEngine.Debug:LogError(Object)
NoesisBuildPostprocessor:OnPostprocessBuildWSA(String) (at Assets/Editor/NoesisGUI/NoesisBuildPostprocessor.cs:36)
NoesisBuildPostprocessor:OnPostprocessBuild(BuildTarget, String) (at Assets/Editor/NoesisGUI/NoesisBuildPostprocessor.cs:14)
UnityEditor.HostView:OnGUI()
in VS

Exception de première chance à 0x76174598 dans Template.exe : exception Microsoft C++ : Platform::FailureException ^ à l'emplacement de mémoire 0x0A0FC8BC. HRESULT:0x80004005 Erreur non spécifiée

Informations WinRT : NoesisError: NoesisUnityRenderHook library was not initialized

Trace de la pile :
[Code externe]
Noesis.dll!15583b16()
Noesis.dll!15583a62()
[Code externe]

I'm in the last release of unity 5.1.2

if i build with sdk8.1 not universal every thing work fine but when i compile in VS i have not click or input to my gui !

Any idee

Thanks a lot

Any idee
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: Noesis.Extended ?

26 Aug 2015, 17:36

System.Exception: DependencyProperty 'Text' already registered to type 'PopUpControl'
This error appears because you are defining the Text DependencyProperty as an instance field instead of static, so every time an instance of your PopUpControl is created, the Text property is registered again in the native type.

You have to change your UserControl code to:
using Noesis;
using System;
using UnityEngine;

[Noesis.UserControlSource("Assets/Gui/UserControls/PopUp.xaml")]
public class PopUpControl : UserControl
{
    public static DependencyProperty TextProperty = DependencyProperty.Register(
        "Text", typeof(string), typeof(PopUpControl), new PropertyMetadata(""));

    public string Text
    {
        get { return (string)GetValue(TextProperty); }
        set { SetValue(TextProperty, value); }
    }

    private Button Annulerbtn;
    private Button.ClickHandler annulerEventHandler;

    public Button.ClickHandler AnnulerEventHandler
    {
        set
        {
            annulerEventHandler = value;
            if (Annulerbtn != null)
            {
                Annulerbtn.Click += annulerEventHandler;
            }
        }
    }

    private Button Validerbtn;
    private Button.ClickHandler validerEventHandler;

    public Button.ClickHandler ValiderEventHandler
    {
        set
        {
            validerEventHandler = value;
            if (Validerbtn != null)
            {
                Validerbtn.Click += validerEventHandler;
            }
        }
    }

    public void OnPostInit()
    {
        Validerbtn = (Button)FindName("ValiderBtn");
        Annulerbtn = (Button)FindName("AnnulerBtn");
        Annulerbtn.Click += annulerEventHandler;
        Validerbtn.Click += validerEventHandler;
    }
}
 
picpic2006
Topic Author
Posts: 67
Joined: 07 Nov 2013, 15:59

Re: Noesis.Extended ?

26 Aug 2015, 18:31

great thanks you

So i just take the exemple in the databinding tutorial sorry what is the difference between ?

For the windows store build i should do something wrong but i can't see any todo in your documentation.
class View2: UserControl
{
    public DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string),
        typeof(View2), new PropertyMetadata(""));

    public string Text
    {
        get { return (string)GetValue(TextProperty); }
        set { SetValue(TextProperty, value); }
    }
}
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: Noesis.Extended ?

26 Aug 2015, 18:53

The C# code in that sample of the documentation is wrong, it should be a static field.
Sorry for the inconveniences :(

I just fixed it, thanks.
 
picpic2006
Topic Author
Posts: 67
Joined: 07 Nov 2013, 15:59

Re: Noesis.Extended ?

27 Aug 2015, 08:59

Great

i really tinking i'm crazzy !

*I saw in your documentation, that in unity 5.1 we don't have to had the reference :

Noesis.dll and NoesisUnityRenderHook.dll

to the reference of the VS project.

I'm in 5.1.2 so i did nothing but when i open my project i can't see noesis.dll in the references, is it correct ?

Thanks you
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: Noesis.Extended ?

03 Sep 2015, 18:18

I'm in 5.1.2 so i did nothing but when i open my project i can't see noesis.dll in the references, is it correct ?
Yes, it is correct. That .dll is a native library, so you don't need to have a reference to that dll in your VS project.

But you can check that all our scripts under Plugins are included in the firstpass assembly project, so they will be compiled and could be used by your application scripts.

Who is online

Users browsing this forum: Google [Bot] and 1 guest