User avatar
MarioBarbero
Topic Author
Posts: 30
Joined: 10 Dec 2024, 20:04

Equivalent to Dispatcher in Noesis

08 Jan 2025, 11:50

Hello

I want yo do a Dispatcher en Noesis but I dont know what it is the equivalent. This Dispatcher code is worng when execute it in Unity.
How can I do that for Unity?
      
        public string Password
        {
            get { return (string)GetValue(PasswordProperty); }
            set { SetValue(PasswordProperty, value); }
        }
        public static readonly DependencyProperty PasswordProperty =
            DependencyProperty.Register(nameof(Password), typeof(string), typeof(PasswordBoxControl), new PropertyMetadata(default(string), OnPasswordChanged));
        private static void OnPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var control = (PasswordBoxControl)d;
            PasswordBox p = control.FindName("passwordControl") as PasswordBox;
            //Set the delay of 800ms to give time to the PasswordChanged event of the PasswordBoxRevealBehavior behavior
            Task.Delay(800).ContinueWith(t =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (p.Password != e.NewValue?.ToString())
                        p.Password = e.NewValue?.ToString();
                });
            });
        }
 
User avatar
jsantos
Site Admin
Posts: 4822
Joined: 20 Jan 2012, 17:18
Contact:

Re: Equivalent to Dispatcher in Noesis

08 Jan 2025, 19:07

Yes, our Views inherit from DispatcherObject. In fact, any framework object inherits from it and can be used to access the Dispatcher.

Could you try that?
 
User avatar
MarioBarbero
Topic Author
Posts: 30
Joined: 10 Dec 2024, 20:04

Re: Equivalent to Dispatcher in Noesis

13 Jan 2025, 14:03

Yes, that is work.
Thank you very much

Who is online

Users browsing this forum: No registered users and 5 guests