Пример #1
0
        void MainViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (!NSThread.IsMain)
            {
                InvokeOnMainThread(() => MainViewModel_PropertyChanged(sender, e));
                return;
            }

            DidChangeValue(e.PropertyName);

            if (e.PropertyName == ViewModel.GetPropertyName(() => ViewModel.ConnectionInfo))
            {
                if (ViewModel.ConnectionInfo != null)
                {
                    ConnectionInfoAdapter = new ConnectionInfoAdapter(ViewModel.ConnectionInfo);
                }
            }
            else if (e.PropertyName.Equals(nameof(MainViewModel.ConnectionState)) ||
                     e.PropertyName.Equals(nameof(MainViewModel.PauseStatus))
                     )
            {
                WillChangeValue("isConnected");
                DidChangeValue("isConnected");

                WillChangeValue("isDisconnected");
                DidChangeValue("isDisconnected");
            }
        }
Пример #2
0
        public MainViewModelAdapter(MainViewModel mainViewModel) : base(mainViewModel)
        {
            mainViewModel.PropertyChanged    += MainViewModel_PropertyChanged;
            mainViewModel.PropertyWillChange += MainViewModel_PropertyWillChange;

            if (ViewModel.ConnectionInfo != null)
            {
                ConnectionInfoAdapter = new ConnectionInfoAdapter(ViewModel.ConnectionInfo);
            }
        }