示例#1
0
        private async void SaveSystem(ItemOfTaskDto dto)
        {
            try
            {
                _commonFun.ShowLoading("保存中...");

                var result = await _tourService.SaveSystemList(dto);

                if (result != null && result.ResultCode == Module.ResultType.Success)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        _commonFun.Alert("保存成功", "");
                        ClosePop();
                    });
                }
            }
            catch (OperationCanceledException)
            {
                _commonFun.HideLoading();
                _commonFun.AlertLongText("保存超时,请重试");
            }
            catch (Exception)
            {
                _commonFun.HideLoading();
                _commonFun.AlertLongText("保存异常,请重试");
            }
            finally
            {
                _commonFun.HideLoading();
            }
        }
        public void Init(List <ItemOfTaskDto> list, ItemOfTaskDto dto)
        {
            try
            {
                SystemList    = list;
                CurrentSystem = dto;

                CurrentSystem.ParamSPicList = new ObservableCollection <StandardPic>();

                //_deleteList = new ObservableCollection<StandardPic>();
                foreach (var spi in CurrentSystem.SPicList)
                {
                    CurrentSystem.ParamSPicList.Add(spi);
                }

                IsPreview = true;
                int index = list.IndexOf(list.FirstOrDefault(p => p.SeqNo == dto.SeqNo));// list.IndexOf(dto) + 1;
                CurrentPage   = index + 1;
                JumpPage      = 1;
                RowHeight     = CurrentSystem.CSList.Count * 50;
                PicRowHeight  = CurrentSystem.PStandardList.Count * 50;
                LossImageList = CurrentSystem.SPicList.Count * 50;
                IsLoading     = false;
                CurrentScore  = CurrentSystem.Score == -1 ? "" : CurrentSystem.Score.ToString();
                //IsPreEnable = false;
                if (SystemList != null && SystemList.Count > 1)
                {
                    //if (index == SystemList.Count - 1)
                    //{
                    //    IsNextEnable = false;
                    //}
                    //else
                    //{
                    //    IsNextEnable = true;
                    //}

                    if (index == 0)
                    {
                        IsPreEnable = false;
                    }
                    else
                    {
                        IsPreEnable = true;
                    }
                }
                else
                {
                    IsPreEnable = false;
                    //IsNextEnable = false;
                }
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->RegistScoreViewModel");
                return;
            }
        }
        public UpdatePopPage(ItemOfTaskDto save)
        {
            InitializeComponent();

            var bx = new UpdatePopViewModel();

            bx.SaveDto = save;

            BindingContext = bx;
        }
示例#4
0
        private void GoRegistScore(ItemOfTaskDto dto)
        {
            try
            {
                if (SystemList == null || SystemList.Count == 0)
                {
                    return;
                }

                if (null != dto)
                {
                    int           seq        = dto.SeqNo;
                    ItemOfTaskDto currentDto = SystemList.Where(p => p.SeqNo == seq &&
                                                                p.TPId == dto.TPId &&
                                                                p.TIId == dto.TIId).FirstOrDefault();
                    //int index = SystemList.IndexOf(currentDto);

                    //if (index == -1)
                    //{
                    //    _commonFun.AlertLongText("获取索引失败");
                    //    return;
                    //}

                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        //await Navigation.PushAsync<RegistScoreViewModel>(true);
                        //SystemList.FirstOrDefault().CurrentIndex = index;
                        //MessagingCenter.Send<List<ItemOfTaskDto>>(SystemList, "PassSystemList");
                        try
                        {
                            if (currentDto.IsClicked)
                            {
                                await Navigation.PushAsync <RegistScoreViewModel>((vm, v) => vm.Init(SystemList, currentDto), true);
                            }
                            else
                            {
                                await Navigation.PushAsync <ViewRegistScoreViewModel>((vm, v) => vm.Init(SystemList, currentDto), true);
                            }
                        }
                        catch (Exception)
                        {
                        }
                    });
                }
            }
            catch (Exception)
            {
            }
        }