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;
            }
        }
Example #2
0
        private void Open()
        {
            var mdlg = new OpenFileDialog();

            mdlg.CheckFileExists = true;
            mdlg.Multiselect     = false;
            mdlg.Filter          = "Tvtest channel file(*.ch2)|*.ch2|All file(*.*)|*.*";
            if (mdlg.ShowDialog() == true)
            {
                foreach (var item in Ch2.ReadChe2File(mdlg.FileName))
                {
                    switch (item.Type)
                    {
                    case CHType.GR:
                        if (!GRList.Any(x => x.ServiceID == item.ServiceID))
                        {
                            GRList.Add(new ChannelViewModel(item));
                        }
                        break;

                    case CHType.BS:
                        if (!BSList.Any(x => x.ServiceID == item.ServiceID))
                        {
                            BSList.Add(new ChannelViewModel(item));
                        }
                        break;

                    case CHType.CS:
                        if (!CSList.Any(x => x.ServiceID == item.ServiceID))
                        {
                            CSList.Add(new ChannelViewModel(item));
                        }
                        break;

                    default:
                        if (!SKList.Any(x => x.ServiceID == item.ServiceID))
                        {
                            SKList.Add(new ChannelViewModel(item));
                        }
                        break;
                    }
                }
                GRList.Sort((x, y) => x.Channel == y.Channel ? x.ServiceID.CompareTo(y.ServiceID) : x.Channel.CompareTo(y.Channel));
                BSList.Sort((x, y) => x.Channel == y.Channel ? x.ServiceID.CompareTo(y.ServiceID) : x.Channel.CompareTo(y.Channel));
                CSList.Sort((x, y) => x.Channel == y.Channel ? x.ServiceID.CompareTo(y.ServiceID) : x.Channel.CompareTo(y.Channel));
                SKList.Sort((x, y) => x.Channel == y.Channel ? x.ServiceID.CompareTo(y.ServiceID) : x.Channel.CompareTo(y.Channel));
                ChannelList  = new ObservableCollection <ChannelViewModel>(GRList.Concat(BSList).Concat(CSList).Concat(SKList));
                this.isSaved = false;
                this.NotifyPropertyChanged(nameof(this.Caption));
            }
            else
            {
                return;
            }
        }