Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to show SignalR ConnectionState Indicator

$
0
0

Hi,
I am using SignaR in my xamarin forms project.
I am trying to show the ConnectionState of SignalR on my HomePage .
Without success.
Bellow is some code snippet.

**HomePage.xaml**
...
<Label x:Name="LblState" Text="{Binding StateString}"></Label>
...

**HomePage.cs**
...
public HomePage ()
        {
            InitializeComponent ();
                    BindingContext =homepageviewModel= new HomePageViewModel();
            }
...

**public class HomePageViewModel : INotifyPropertyChanged**
    {
    ...
     private string _StateString;
        public string StateString
        {
            get
            {

                var _StateString = "getString";
                return _StateString;
            }
            set
            {
                if (StateString== value )
                    return;
                _StateString = value;
                OnPropertyChanged();
            }
        }

    }

 **public class SignalRServices : ISignalRServices, INotifyPropertyChanged**
    {
    ...
    if (obj.NewState == ConnectionState.Disconnected )
            {
                var _homepageViewModel1 = MyProject.HomePage.homepageviewModel;

                    _homepageViewModel1.StateString = "Disconnected";             
            }
    }

Above Code is not working.
What am i doing wrong ?
Thank you for any help.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>