コード例 #1
0
ファイル: TachoService.cs プロジェクト: ISPLab/TachoClient
        public void GetTachodata(TachoParms parms)
        {
            TachoHelper.Services.Serializing.P8Serializer p8Serializer = new TachoHelper.Services.Serializing.P8Serializer();
            string paramB64 = p8Serializer.SerializeToBase64(parms);

            base.GetTachodata(paramB64);
        }
コード例 #2
0
        public TachoParms GetTachoParms()
        {
            TachoParms param = new TachoParms();

            param.Beginreportdatetime = new DateTime(2014, 01, 01).ToUniversalTime();
            param.Endreportdatetime   = new DateTime(2018, 01, 01).ToUniversalTime();
            param.Legislation         = CurrentLegislation;
            param.MaxCarAnalisis      = 10;
            param.MaxShiftNumber      = 50;
            param.MaxVioaltionNumber  = 50;
            param.Pin = Pin;
            return(param);
        }
コード例 #3
0
        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();
        }