public TachoControllerViewModel() { SetWaitView(); tachocardservice.P8Event += (s, e) => { if (e.EventName == "tachoinfo" && (string)e.Parametr == "connected") { Device.BeginInvokeOnMainThread(() => { SmartButtonVisible = true; PrbuttonText = "далее"; CurrentContent = new CardPinView { BindingContext = this }; }); } if (e.EventName == "tachoerror" && (string)e.Parametr == "connected false") { Label prlabel = new Label() { Style = (Style)Application.Current.Resources["H1Header"], TextColor = Color.Red }; prlabel.Text = "Ошибка подключения к тахографическому сервису. Обратитесь к администратору."; SmartButtonVisible = false; CurrentContent = new ContentView() { BindingContext = this, Content = new StackLayout() { Children = { prlabel } } }; } if (e.EventName == "tachoerror" && (((string)e.Parametr == "Licence_Premission_error") || (string)e.Parametr == "Check_license_error")) { SetWaitView(); Label prlabel = new Label() { Style = (Style)Application.Current.Resources["H1Header"], TextColor = Color.Red }; prlabel.Text = e.Description; SmartButtonVisible = false; CurrentContent = new ContentView() { BindingContext = this, Content = new StackLayout() { Children = { prlabel } } }; } }; ProcessCommand = new Command( execute: () => { var c = Legislations; if (CurrentContent is Views.CardPinView) { Legislations = tachocardservice.GetLegislations(); CurrentContent = new TachoLegislationParentView() { BindingContext = this };; PrbuttonText = "проверить карту"; } else if (CurrentContent is TachoLegislationParentView) { CurrentContent = new Views.TachoProcessView() { BindingContext = this }; PrbuttonText = "отменить"; tparms = GetTachoParms(); tachocardservice.GetTachodata(tparms); } else if (CurrentContent is Views.TachoProcessView || CurrentContent is TachoResultView) { tachocardservice.StopTachoProcess(); Pin = ""; CurrentContent = new Views.CardPinView() { BindingContext = this };; PrbuttonText = "далее"; } ProcessCommand.CanExecute(false); }, canExecute: () => { return(true); }); tachocardservice.StartService(); }