Exemple #1
0
        public UserPayQRCodeDialog(int payType) : this()
        {
            if (payType == 1)
            {
                PayTypeName.Text  = "使用支付宝支付";
                ImgPayIcon.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.alipay);
            }

            if (payType == 2)
            {
                PayTypeName.Text  = "使用微信支付";
                ImgPayIcon.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.wechatpay);
            }

            PayMoneyShow.Text = GlobalUser.STUDYCARD.card_price + "元";

            var result0 = WebApiProxy.GetHtmlRespInfo(ApiType.GetCardOrder, GlobalUser.USER.Token);

            UserOrderModel model = new UserOrderModel()
            {
                token    = GlobalUser.USER.Token,
                order_id = result0.retData.order_id.ToString()
            };
            var result1 = WebApiProxy.GetImage(model, ApiType.GetQrCode, null, "get");

            ImgQrCode.Source = ConvertHelper.ChangeBitmapToImageSource(result1 as Bitmap);
        }
Exemple #2
0
        void DispatcherTimer_Tick(object sender, EventArgs e)
        {
            if (_duration % 4 == 0)
            {
                VolumeImageSource = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.volume_6);
            }
            else if (_duration % 3 == 0)
            {
                VolumeImageSource = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.volume_4);
            }
            else if (_duration % 2 == 0)
            {
                VolumeImageSource = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.volume_2);
            }
            else
            {
                VolumeImageSource = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.volume_8);
            }

            _duration--;

            if (_duration <= 0)
            {
                _dispatcherTimer?.Stop();
            }
        }
Exemple #3
0
 private void AvatarImage_SourceUpdated(object sender, DataTransferEventArgs e)
 {
     if (!HttpHelper.RemoteFileExists(GlobalUser.USER.Avatar))
     {
         //GlobalUser.USER.Avatar = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "head.png");
         AvatarImage.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.head);
     }
 }
Exemple #4
0
        public void SetAllDisable()
        {
            _dispatcherTimer?.Stop();

            MicrophoneImageSource = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.microphone_disable);
            VolumeImageSource     = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.volume_disable);
            SpeakerImageSource    = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.speaker_disable);
        }
Exemple #5
0
        public void SetSpeakerEnabled(int duration = 0)
        {
            MicrophoneImageSource = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.microphone_disable);
            VolumeImageSource     = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.volume_enabled);
            SpeakerImageSource    = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.speaker_enabled);

            if (duration != 0)
            {
                SetVolumeAnimation(duration);
            }
        }
Exemple #6
0
        private Image GetScoreImage(int score)
        {
            Image img = new Image();

            img.Height = 58;
            switch (score)
            {
            case 0:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._0);
                break;

            case 1:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._1);
                break;

            case 2:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._2);
                break;

            case 3:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._3);
                break;

            case 4:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._4);
                break;

            case 5:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._5);
                break;

            case 6:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._6);
                break;

            case 7:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._7);
                break;

            case 8:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._8);
                break;

            case 9:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._9);
                break;

            default:
                img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources._0);
                break;
            }
            return(img);
        }
Exemple #7
0
        /// <summary>
        /// 打开用户信息对话框。
        /// </summary>
        /// <param name="o"></param>
        private async void OpenUserInfoDialog(object o)
        {
            var userInfo         = GlobalUser.USER;
            var cardInfo         = GlobalUser.USER.Card;
            var userInfoDialogVM = new UserInfoDialogVM();

            if (userInfo != null)
            {
                //userInfoDialogVM.User = GlobalUser.USER;
                //userInfoDialogVM.UserName = GlobalUser.USER.UserName;
                if (cardInfo != null)
                {
                    cardInfo.Validity = $"{Convert.ToDateTime(GlobalUser.USER.Card.expire_time).ToString("yyyy年MM月dd日")} 到期";
                }
            }
            else
            {
                MessageBox.Show("获取用户信息失败,请重新登录!");
            }
            //let's set up a little MVVM, cos that's what the cool kids are doing:
            var view = new UserInfoDialog(true)
            {
                DataContext = userInfoDialogVM,
                Height      = 500,
                Width       = 370
            };

            #region 验证用户头像是否存在...
            //GlobalUser.USER.Avatar = "http://www.baid2u.com/123.png";
            if (!HttpHelper.RemoteFileExists(GlobalUser.USER.Avatar))
            {
                //GlobalUser.USER.Avatar = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "head.png");
                view.AvatarImage.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.head);
            }

            #endregion
            //show the dialog
            await DialogHostEx.ShowDialog(GlobalUser.MainWin, view, UserInfoDialogOpenedEventHandler,
                                          UserInfoDialogClosingEventHandler);

            //check the result...
            //Console.WriteLine("Dialog was closed, the CommandParameter used to close it was: " + (result ?? "NULL"));
        }
Exemple #8
0
        private ImageSource SetStarScore(float avgScore)
        {
            float? AvgScore5Points = 5 * (avgScore / 100);
            string strScore        = Convert.ToDouble(AvgScore5Points).ToString("0.00");

            int leftPoint  = int.Parse(strScore.Substring(0, 1));
            int rightPoint = int.Parse(strScore.Substring(2, 2));

            if (AvgScore5Points > 0)
            {
                if (rightPoint > 0 && rightPoint <= 30)
                {
                    rightPoint = 25;
                }
                else if (rightPoint > 30 && rightPoint <= 60)
                {
                    rightPoint = 50;
                }
                else if (rightPoint > 60 && rightPoint <= 99)
                {
                    rightPoint = 75;
                }
                else if (rightPoint > 99)
                {
                    if (leftPoint < 5)
                    {
                        leftPoint = leftPoint + 1;
                    }

                    rightPoint = 00;
                }

                AvgScore5Points = float.Parse($"{leftPoint}.{rightPoint}");
            }

            switch (AvgScore5Points)
            {
            case 0.0f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_0_0));

            case 0.25f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_0_1));

            case 0.5f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_0_2));

            case 0.75f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_0_3));

            case 1.0f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_1));

            case 1.25f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_1_1));

            case 1.5f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_1_2));

            case 1.75f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_1_3));

            case 2.0f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_2));

            case 2.25f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_2_1));

            case 2.5f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_2_2));

            case 2.75f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_2_3));

            case 3.0f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_3));

            case 3.25f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_3_1));

            case 3.5f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_3_2));

            case 3.75f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_3_3));

            case 4.0f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_4));

            case 4.25f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_4_1));

            case 4.5f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_4_2));

            case 4.75f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_4_3));

            case 5.0f:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_5));

            default:
                return(ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.star_0_0));
            }
        }
Exemple #9
0
        public ExpireCard()
        {
            InitializeComponent();

            BindCardImage.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.overCard);
        }
Exemple #10
0
        /// <summary>
        /// 同步报纸 信息
        /// </summary>
        private void LoadNewsPaperUC()
        {
            // 异步请求,防止界面假死
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                var ml = new GetSimulationListModel()
                {
                    paper_type = 6,
                    pagesize   = 100,
                    token      = GlobalUser.USER.Token
                };

                var result = WebProxy(ml, ApiType.GetSimulationList, null, "get");

                if (result.retCode == 0 && result.retData.total > 0)
                {
                    List <SimulationItem> lsPapers =
                        JsonHelper.FromJson <List <SimulationItem> >(result.retData.list.ToString());

                    //Messenger.OverrideDefault();
                    if (lsPapers != null && lsPapers.Count > 0)
                    {
                        var sList = lsPapers;

                        for (int i = 0; i < sList.Count; i++)
                        {
                            string keyName   = $"{sList[i].exam_id}_{sList[i].paper_title}_{i}";
                            sList[i].exam_id = $"{sList[i].exam_id}#{i + 1}";

                            var pc         = new NewPaperControl();
                            pc.DataContext = new NewPaperControlVM(sList[i], (i + 1) % 4);
                            pc.Margin      = new Thickness(0, 0, 20, 20);
                            _NewPaperContentPanel.Children.Add(pc);
                        }
                    }
                }
                else
                {
                    if (result.retCode == 40400)
                    {
                        Messenger.Default.Send(new MainDialogMessage(result.retMsg), "MainMessageDialog");
                        return;
                    }

                    if (GlobalUser.USER?.Expire_status == 1 || GlobalUser.USER?.Expire_status == 0)
                    {
                        //无试卷可用
                        //todo
                        //Messenger.Default.Send(new MainDialogMessage("暂无试卷可练习!"), "MainMessageDialog");
                        //MessageBox.Show("无试卷可用!");

                        _NewPaperContentPanel.Children.Clear();
                        //无内容
                        StackPanel wpContent          = new StackPanel();
                        wpContent.HorizontalAlignment = HorizontalAlignment.Center;
                        wpContent.VerticalAlignment   = VerticalAlignment.Top;
                        wpContent.Margin = new Thickness(200, 40, 0, 0);

                        //无内容
                        Image img  = new Image();
                        img.Source = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.nozy);
                        img.Width  = 430;
                        img.Height = 240;
                        img.HorizontalAlignment = HorizontalAlignment.Center;
                        img.VerticalAlignment   = VerticalAlignment.Top;
                        img.Margin = new Thickness(0, 80, 0, 0);

                        var color                  = (Color)ColorConverter.ConvertFromString("#537588");
                        TextBlock txtMsg           = new TextBlock();
                        txtMsg.Text                = Properties.Settings.Default.NoTrainPaper;
                        txtMsg.FontSize            = 22;
                        txtMsg.VerticalAlignment   = VerticalAlignment.Bottom;
                        txtMsg.HorizontalAlignment = HorizontalAlignment.Center;
                        txtMsg.Margin              = new Thickness(0, 10, 0, 20);
                        txtMsg.Foreground          = new SolidColorBrush(color);


                        wpContent.Children.Add(img);
                        wpContent.Children.Add(txtMsg);

                        _NewPaperContentPanel.Children.Add(wpContent);
                    }
                }
            }));
        }
Exemple #11
0
 public void SetMicrophoneEnabled()
 {
     MicrophoneImageSource = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.microphone_enabled);
     VolumeImageSource     = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.volume_disable);
     SpeakerImageSource    = ConvertHelper.ChangeBitmapToImageSource(Properties.Resources.speaker_disable);
 }