public CustImproveViewModel()
        {
            try
            {
                _commonFun         = Resolver.Resolve <ICommonFun>();
                _commonHelper      = Resolver.Resolve <CommonHelper>();
                _localScoreService = Resolver.Resolve <ILocalScoreService>();

                Device.BeginInvokeOnMainThread(async() =>
                {
                    var cardType = await _localScoreService.LocalGetTypeFromHiddenCode("16");
                    if (cardType != null && cardType.Count > 0)
                    {
                        foreach (var item in cardType)
                        {
                            _dIcCardType.Add(item.Value, item.Name);
                        }
                    }
                    else
                    {
                    }
                });
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->LocalRegistScoreViewModel");
                return;
            }
        }
        public LocalRegistScoreViewModel()
        {
            try
            {
                _tourService       = Resolver.Resolve <ITourService>();
                _commonFun         = Resolver.Resolve <ICommonFun>();
                _commonHelper      = Resolver.Resolve <CommonHelper>();
                _localScoreService = Resolver.Resolve <ILocalScoreService>();
                _remoteService     = Resolver.Resolve <IRemoteService>();

                _tapCommand = new Command(ImageTaped);

                MessagingCenter.Subscribe <LocalRegistScorePage>(this, "CheckBoxChanged", (obj) =>
                {
                    if (CSList.Any(p => p.IsCheck == true))
                    {
                        CurrentScore        = "0";
                        CurrentSystem.Score = 0;
                    }
                    else
                    {
                        CurrentScore        = "1";
                        CurrentSystem.Score = 1;
                    }
                });

                MessagingCenter.Subscribe <StandardPic>(this, "DeleteLossImage", (obj) =>
                {
                    //删除失分照片
                    DeleteImage(obj);
                });

                MessagingCenter.Subscribe <PictureStandard>(this, "RegistScoreItemTapped", (obj) =>
                {
                    UploadStandPic(obj.StandardPicId);
                });

                MessagingCenter.Subscribe <PictureStandard>(this, "PreviewPlanAttechment", (obj) =>
                {
                    if (!string.IsNullOrEmpty(obj.Url))
                    {
                        PreviewStanderImage(obj.Url);
                    }
                });

                MessagingCenter.Subscribe <PictureStandard>(this, "DeletePlanAttechment", (obj) =>
                {
                    if (!string.IsNullOrEmpty(obj.Url))
                    {
                        DeleteStanderImage(obj);
                    }
                });
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->CustImproveViewModel");
                return;
            }
        }
        public LocalSystemListViewModel()
        {
            try
            {
                _localScoreService = Resolver.Resolve <ILocalScoreService>();
                _commonFun         = Resolver.Resolve <ICommonFun>();


                MessagingCenter.Subscribe <CommonMessage>(this, "LocalResetTaskID", (obj) =>
                {
                    if (obj.TaskID == "-1")
                    {
                        _refresh = false;
                    }
                    else
                    {
                        _refresh = true;
                    }
                });

                MessagingCenter.Subscribe <List <LoaclItemOfTaskDto> >(this, "LocalSendSystemList", (obj) =>
                {
                    _taskId = obj.FirstOrDefault().TPId.ToString();
                    Init(obj);
                });

                MessagingCenter.Subscribe <LocalSystemListPage>(this, "LocalRefreshSystem", (obj) =>
                {
                    if (_refresh)
                    {
                        RefreshPage(TaskId.ToString());
                    }
                });

                ItemTappedCommand = new RelayCommand <LoaclItemOfTaskDto>(TappedCommand);
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->CustomizedTaskViewModel");
                return;
            }
        }
Exemplo n.º 4
0
        public ShopfrontMainPageViewModel()
        {
            try
            {
                _tourService       = Resolver.Resolve <ITourService>();
                _localScoreService = Resolver.Resolve <ILocalScoreService>();
                _commonFun         = Resolver.Resolve <ICommonFun>();
                _commonHelper      = Resolver.Resolve <CommonHelper>();
                ItemTappedCommand  = new RelayCommand <TourDistributorDto>(TappedCommand);
                _improveService    = Resolver.Resolve <IImproveService>();

                MessagingCenter.Subscribe <ShopfrontMainPage>(this, "GetShops", (sender) =>
                {
                    canGo = false;
                    Task.Run(async() =>
                    {
                        await GetShops();
                    });
                });
                MessagingCenter.Subscribe <string>(this, "GetImproveDitstriLst", async(arg) =>
                {
                    await GetImproveDitstriLst(arg);
                });

                Device.BeginInvokeOnMainThread(async() =>
                {
                    if (CommonContext.Account.UserType == "S")
                    {
                        await GetImproveDitstriLst("");
                    }
                    else
                    {
                        await GetShops();
                    }
                });
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->ShopfrontMainPageViewModel");
                return;
            }
        }
        public CustomizedTaskViewModel()
        {
            try
            {
                _commonFun         = Resolver.Resolve <ICommonFun>();
                _commonHelper      = Resolver.Resolve <CommonHelper>();
                _tourService       = Resolver.Resolve <ITourService>();
                _localScoreService = Resolver.Resolve <ILocalScoreService>();


                MessagingCenter.Subscribe <string>(this, "TaskSearchParam", (param) =>
                {
                    fromSeachYN = param;
                });
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->CustImproveViewModel");
                return;
            }
        }
Exemplo n.º 6
0
        public TaskListViewModel()
        {
            try
            {
                _tourService = Resolver.Resolve<ITourService>();
                _localScoreService = Resolver.Resolve<ILocalScoreService>();
                _commonFun = Resolver.Resolve<ICommonFun>();
                _commonHelper = Resolver.Resolve<CommonHelper>();
                _remoteService = Resolver.Resolve<IRemoteService>();


                MessagingCenter.Subscribe<TourDistributorDto>(this, "SendShopItem", (obj) =>
                {
                    _disId = obj.DisId;
                    _isChecking = true;
                    _statu = "N";
                    //if (_commonHelper.IsNetWorkConnected() == true)
                    //{
                    //    GetPlans(_disId, "", "", _statu);
                    //}
                    //else
                    //{
                    GetLocalPlans(_disId);
                    //}
                });


                //MessagingCenter.Subscribe<TaskListPage>(this, "RefreshTask", (obj) =>
                //{
                //	if (_disId != 0)
                //	{
                //		GetPlans(_disId);
                //	}
                //});

                MessagingCenter.Subscribe<TaskOfPlanDto>(this, "CheckTask", async (obj) =>
                {
                    if (_isChecking)
                    {
                        //if (_commonHelper.IsNetWorkConnected() == true)
                        //{
                        //    if (obj.TPStatus == "E")
                        //    {
                        //        if (obj.TPType == "C")
                        //        {
                        //            CheckCustomizedTask(obj.TPId, "A", obj.TPStatus);
                        //        }
                        //        else
                        //        {
                        //            CheckPlan(obj.TPId, "A");
                        //        }

                        //    }
                        //    else
                        //    {
                        //        var action = await _commonFun.ShowActionSheet("开始检查", "结束检查");

                        //        if (action == "开始检查")
                        //        {
                        //            if (obj.TPType == "C")// 自定义任务
                        //            {
                        //                CheckCustomizedTask(obj.TPId, "S", obj.TPStatus);
                        //            }
                        //            else
                        //            {
                        //                CheckStartPlan(obj.TPId);
                        //            }
                        //        }
                        //        else if (action == "结束检查")
                        //        {
                        //            if (obj.TPType == "C")// 自定义任务
                        //            {
                        //                CheckCustomizedTask(obj.TPId, "E", obj.TPStatus);
                        //            }
                        //            else
                        //            {
                        //                CheckEndPlan(obj.TPId);
                        //            }

                        //        }
                        //    }
                        //}

                        // 没有网络的状态下
                        if (obj.TPStatus == "E")
                        {
                            if (obj.TPType == "C")
                            {
                                //CheckCustomizedTask(obj.TPId, "A", obj.TPStatus);
                                LocalCheckCustomizedTask(obj.TPId, "A", obj.TPStatus);
                            }
                            else
                            {
                                LocalCheckPlan(obj.TPId, "A");
                            }

                        }
                        else
                        {
                            var action = await _commonFun.ShowActionSheet("开始检查", "结束检查");//, "取消任务");

                            if (action == "开始检查")
                            {
                                if (obj.TPType == "C")// 自定义任务
                                {
                                    //CheckCustomizedTask(obj.TPId, "S", obj.TPStatus);
                                    LocalCheckCustomizedTask(obj.TPId, "S", obj.TPStatus);
                                }
                                else
                                {
                                    LocalCheckStartPlan(obj.TPId);
                                }
                            }
                            else if (action == "结束检查")
                            {
                                if (obj.TPType == "C")// 自定义任务
                                {
                                    //CheckCustomizedTask(obj.TPId, "E", obj.TPStatus);
                                    LocalCheckCustomizedTask(obj.TPId, "E", obj.TPStatus);
                                }
                                else
                                {
                                    LocalCheckEndPlan(obj.TPId);
                                }

                            }
                            else if (action == "取消任务")
                            {
                                if (await _commonFun.Confirm("确定取消该任务吗?"))
                                {
                                    if (obj.TPType == "C")// 自定义任务
                                    {
                                        LocalCheckCustomizedTask(obj.TPId, "C", obj.TPStatus);
                                    }
                                    else
                                    {
                                        LocalClosePlanTask(obj.TPId);
                                    }
                                }
                            }
                        }

                    }
                    else
                    {
                        if (obj.TPType == "C")
                        {
                            CheckCustomizedTask(obj.TPId, "A", obj.TPStatus);
                        }
                        else
                        {
                            CheckPlan(obj.TPId, "");
                        }
                    }
                });

                MessagingCenter.Subscribe<string>(this, "SearchTaskList", (disId) =>
                {
                    _isChecking = true;
                    _statu = "N";

                    GetLocalPlans(Convert.ToInt32(disId));
                });
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->TaskListViewModel");
                return;
            }
        }
        public RegistScoreViewModel()
        {
            try
            {
                _tourService       = Resolver.Resolve <ITourService>();
                _commonFun         = Resolver.Resolve <ICommonFun>();
                _commonHelper      = Resolver.Resolve <CommonHelper>();
                _localScoreService = Resolver.Resolve <ILocalScoreService>();

                _tapCommand = new Command(ImageTaped);

                MessagingCenter.Subscribe <List <ItemOfTaskDto> >(this, "PassSystemList", (obj) =>
                {
                    //if (null != obj)
                    //{
                    //	Init(obj, obj.FirstOrDefault().CurrentIndex);
                    //}
                });

                //MessagingCenter.Subscribe<RegistScorePage>(this, "InitPage", (obj) =>
                //{
                //    if (null != SystemList && SystemList.Count > 0 && CurrentSystem != null)
                //    {
                //        if (_initTimer)
                //        {
                //            _initTimer = false;
                //            Init(SystemList, CurrentSystem);
                //        }
                //    }
                //});

                MessagingCenter.Subscribe <RegistScorePage>(this, "CheckBoxChanged", (obj) =>
                {
                    if (CurrentSystem.CSList.Any(p => p.IsCheck == true))
                    {
                        CurrentScore        = "0";
                        CurrentSystem.Score = 0;
                    }
                    else
                    {
                        CurrentScore        = "1";
                        CurrentSystem.Score = 1;
                    }
                });

                //MessagingCenter.Subscribe<StandardPic>(this, "PreviewLossImage", (obj) =>
                //{
                //	if (_previewTimer)
                //	{
                //		_previewTimer = false;
                //		//浏览失分照片
                //		Preview(obj);

                //		Device.StartTimer(TimeSpan.FromSeconds(2), () => {
                //			_previewTimer = true;
                //			return true;
                //		});
                //	}
                //});

                MessagingCenter.Subscribe <StandardPic>(this, "DeleteLossImage", (obj) =>
                {
                    //删除失分照片
                    DeleteImage(obj);
                });

                MessagingCenter.Subscribe <PictureStandard>(this, "RegistScoreItemTapped", (obj) =>
                {
                    UploadStandPic(obj.StandardPicId);
                });

                MessagingCenter.Subscribe <PictureStandard>(this, "PreviewPlanAttechment", (obj) =>
                {
                    if (!string.IsNullOrEmpty(obj.Url))
                    {
                        PreviewStanderImage(obj.Url);
                    }
                });

                MessagingCenter.Subscribe <PictureStandard>(this, "DeletePlanAttechment", (obj) =>
                {
                    if (!string.IsNullOrEmpty(obj.Url))
                    {
                        DeleteStanderImage(obj);
                    }
                });
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->RegistScoreViewModel");
                return;
            }
        }