Пример #1
0
        /// <summary>
        /// 加载活动主题背景图
        /// </summary>
        private void LoadActivityThemeData()
        {
            var    errCode = 0;
            string errMsg  = string.Empty;
            //AsyncHandler.CallFuncWithUI(System.Windows.Application.Current.Dispatcher,
            //    () =>
            //    {
            //        var output = AntSdkService.GetActivityImages(ref errCode, ref errMsg);
            //        return output;
            //    },
            //    (ex, datas) =>
            //    {
            var output = AntSdkService.GetActivityImages(ref errCode, ref errMsg);

            if (output != null)
            {
                if (!string.IsNullOrEmpty(output.outdoor))
                {
                    BitmapImage outdoorImage = new BitmapImage();

                    outdoorImage.BeginInit();

                    outdoorImage.UriSource = new System.Uri(output.outdoor);

                    outdoorImage.DecodePixelWidth = 800;

                    outdoorImage.EndInit();
                    _activityThemePicList.Add(new ActivityThemePicInfo
                    {
                        PicId            = 1,
                        ActivityTheme    = "户外",
                        ActivityThemePic = output.outdoor,
                        ActivityPic      = outdoorImage,
                        SelectedThemePic = true
                    });
                }
                if (!string.IsNullOrEmpty(output.dinner))
                {
                    BitmapImage dinnerImage = new BitmapImage();

                    dinnerImage.BeginInit();

                    dinnerImage.UriSource = new System.Uri(output.dinner);

                    dinnerImage.DecodePixelWidth = 800;

                    dinnerImage.EndInit();
                    _activityThemePicList.Add(new ActivityThemePicInfo
                    {
                        PicId            = 2,
                        ActivityTheme    = "聚餐",
                        ActivityThemePic = output.dinner,
                        ActivityPic      = dinnerImage,
                        SelectedThemePic = false
                    });
                }
                if (!string.IsNullOrEmpty(output.game))
                {
                    BitmapImage gameImage = new BitmapImage();

                    gameImage.BeginInit();

                    gameImage.UriSource = new System.Uri(output.game);

                    gameImage.DecodePixelWidth = 800;

                    gameImage.EndInit();
                    _activityThemePicList.Add(new ActivityThemePicInfo
                    {
                        PicId            = 3,
                        ActivityTheme    = "游戏",
                        ActivityThemePic = output.game,
                        ActivityPic      = gameImage,
                        SelectedThemePic = false
                    });
                }

                if (!string.IsNullOrEmpty(output.sport))
                {
                    BitmapImage sportImage = new BitmapImage();

                    sportImage.BeginInit();

                    sportImage.UriSource = new System.Uri(output.sport);

                    sportImage.DecodePixelWidth = 800;

                    sportImage.EndInit();
                    _activityThemePicList.Add(new ActivityThemePicInfo
                    {
                        PicId            = 4,
                        ActivityTheme    = "体育",
                        ActivityThemePic = output.sport,
                        ActivityPic      = sportImage,
                        SelectedThemePic = false
                    });
                }
                if (!string.IsNullOrEmpty(output.sing))
                {
                    BitmapImage singImage = new BitmapImage();

                    singImage.BeginInit();

                    singImage.UriSource = new System.Uri(output.sing);

                    singImage.DecodePixelWidth = 800;

                    singImage.EndInit();
                    _activityThemePicList.Add(new ActivityThemePicInfo
                    {
                        PicId            = 5,
                        ActivityTheme    = "唱K",
                        ActivityThemePic = output.sing,
                        ActivityPic      = singImage,
                        SelectedThemePic = false
                    });
                }

                BitmapImage customImage = new BitmapImage();

                customImage.BeginInit();

                customImage.UriSource = new System.Uri("pack://application:,,,/AntennaChat;component/Images/addActivityThemePic.png");

                customImage.DecodePixelWidth = 800;

                customImage.EndInit();
                _activityThemePicList.Add(new ActivityThemePicInfo
                {
                    PicId            = 6,
                    ActivityTheme    = "",
                    ActivityThemePic = "/AntennaChat;component/Images/addActivityThemePic.png",
                    ActivityPic      = customImage,
                    SelectedThemePic = false
                });
            }
            //});
            string        xmlPath   = Environment.CurrentDirectory + "/ActivityReminderTime.xml";
            List <string> modelList = new List <string>();

            if (File.Exists(xmlPath))
            {
                XmlTextReader reader = new XmlTextReader(xmlPath);

                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (reader.Name == "value")
                        {
                            modelList.Add(reader.ReadElementString().Trim());
                        }
                    }
                }
            }
            if (modelList.Count > 0)
            {
                _activityRemindList = modelList;
            }
            else
            {
                _activityRemindList.Add("提前10分钟");
                _activityRemindList.Add("提前20分钟");
                _activityRemindList.Add("提前30分钟");
                _activityRemindList.Add("提前1小时");
            }
            _activityRemindSelectedValue = _activityRemindList.Count > 2 ? _activityRemindList[2] : "提前30分钟";
        }