Beispiel #1
0
        private void GetAdvertInfo()
        {
            m_NowAdvertName   = PubHelper.p_BusinOper.VmFileOper.AdvertList[m_NextPlayNo].FileName;
            m_NowAdvertType   = PubHelper.p_BusinOper.VmFileOper.AdvertList[m_NextPlayNo].FileType;
            m_NowAdvertFormat = PubHelper.p_BusinOper.VmFileOper.AdvertList[m_NextPlayNo].AdvertType;

            if (m_NowAdvertFormat == BusinessEnum.AdvertType.Video)
            {
                string strAdvNo = PubHelper.p_BusinOper.VmFileOper.AdvertPath;
                m_NowAdvertFilePath = "pack://siteoforigin:,,,/advert/" + m_NowAdvListID + "/" + m_NowAdvertName + "." + m_NowAdvertType;
            }
            else
            {
                m_AdvertImgShowTime = PubHelper.p_BusinOper.VmFileOper.AdvertList[m_NextPlayNo].DelayTime;
                m_NowAdvertFilePath = AppDomain.CurrentDomain.BaseDirectory.ToString() + "advert\\" + m_NowAdvListID + "\\" + m_NowAdvertName + "." + m_NowAdvertType;
            }
        }
        private void InitForm()
        {
            #region 计算各区域尺寸

            double scrHeight = SystemParameters.PrimaryScreenHeight;
            panelTop.Height      = scrHeight * 0.23;
            panelBottom.Height   = scrHeight * 0.36;
            panelMiddele.Height  = scrHeight * 0.41;
            panelMiddele.Margin  = new Thickness(0, panelTop.Height + 1, 0, 0);
            tbProgressInfo.Width = panelMiddele.Width;

            videoScreenMediaElement.Height = panelTop.Height;
            videoScreenMediaElement.Width  = panelTop.Width;

            #endregion

            #region 加载各区域图片

            bool   result     = false;
            string strPicPath = string.Empty;

            string strTopFile = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("O2OTake_TopMv");
            m_TopFileType = PubHelper.p_BusinOper.VmFileOper.GetFileAdvertType(strTopFile);

            if (m_TopFileType == BusinessEnum.AdvertType.Image)
            {
                // 图片文件
                result = PubHelper.GetFormPubPic(strTopFile, out strPicPath);
                if (result)
                {
                    imgTop.Source = new BitmapImage(new Uri(strPicPath, UriKind.RelativeOrAbsolute));
                }
                videoScreenMediaElement.Visibility = System.Windows.Visibility.Hidden;
                imgTop.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                // 视频文件
                imgTop.Visibility = System.Windows.Visibility.Hidden;
                videoScreenMediaElement.Source = new Uri(AppDomain.CurrentDomain.BaseDirectory.ToString() + "Images\\FormPic\\pub\\" + strTopFile);
                // 临时测试
                videoScreenMediaElement.Position = TimeSpan.FromSeconds(5);
                videoScreenMediaElement.Play();
                videoScreenMediaElement.Visibility = System.Windows.Visibility.Visible;
            }

            result = PubHelper.GetFormPubPic("BarCode_TipBg.png", out strPicPath);
            if (result)
            {
                imgMiddele.Source = new BitmapImage(new Uri(strPicPath, UriKind.RelativeOrAbsolute));
            }
            result = PubHelper.GetFormPubPic("BarCode_Swip.png", out strPicPath);
            if (result)
            {
                imgSwipTip.Source = new BitmapImage(new Uri(strPicPath, UriKind.RelativeOrAbsolute));
            }
            result = PubHelper.GetFormPubPic(PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("O2OTake_BottomMv"), out strPicPath);
            if (result)
            {
                imgBottom.Source = new BitmapImage(new Uri(strPicPath, UriKind.RelativeOrAbsolute));
            }

            #endregion

            #region 加载字符资源

            btnCancel.Content    = PubHelper.p_LangOper.GetStringBundle("SellGoods_Button_Cancel");
            btnCancel.Visibility = System.Windows.Visibility.Hidden;

            m_CodeNum_Name = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("O2OTake_Name_CodeNum");

            #endregion

            #region 设置相关参数

            PubHelper.p_BusinOper.O2OServerOper.VmID      = PubHelper.p_BusinOper.ConfigInfo.VmId;
            PubHelper.p_BusinOper.O2OServerOper.ServerURL = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("O2OServerUrl");
            PubHelper.p_BusinOper.O2OServerOper.UserKey   = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("O2OServer_UserKey");

            GetCodeLen();

            #endregion

            #region 启动工作线程

            Thread TrdMainWork = new Thread(new ThreadStart(MainWorkTrd));
            TrdMainWork.IsBackground = true;
            TrdMainWork.Start();

            Thread TrdMonOutTime = new Thread(new ThreadStart(MonOutTimeTrd));
            TrdMonOutTime.IsBackground = true;
            TrdMonOutTime.Start();

            #endregion
        }
        private void InitForm()
        {
            #region 初始化界面

            tbTitle.Text           = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_Title_WxTake");
            tbCfgTitle.Text        = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_Cfg");
            tbSerName.Text         = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_SerName");
            tbTipInfo_SerName.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_SerName_Tip");
            tbWebUrl.Text          = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_WebUrl");
            tbUserKey.Text         = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_UserKey");

            btnSave.Content       = btnSaveTop.Content = btnSaveBottom.Content = PubHelper.p_LangOper.GetStringBundle("Pub_Btn_Save");
            btnCancel.Content     = PubHelper.p_LangOper.GetStringBundle("Pub_Btn_Cancel");
            btnBrowseTop.Content  = btnBrowseBottom.Content = PubHelper.p_LangOper.GetStringBundle("Pub_Btn_Browse");
            btnCodeConfig.Content = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_CodeConfig");

            tbTopCfg.Text  = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_Skin_Top");
            tbTop_Tip.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_Tip_File_Top");

            tbBottomCfg.Text  = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_Skin_Bottom");
            tbBottom_Tip.Text = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_Tip_File_Bottom");

            rdbSwitch_Run.Content  = PubHelper.p_LangOper.GetStringBundle("Pub_Run");
            rdbSwitch_Stop.Content = PubHelper.p_LangOper.GetStringBundle("Pub_Stop");
            tbServerSwitch.Text    = PubHelper.p_LangOper.GetStringBundle("SysCfg_Menu_AddService_Switch");

            #endregion

            #region 加载参数

            tbSerName_Value.Text = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("WxTake_Name");
            tbWebUrl_Value.Text  = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("WxTake_ServerUrl");
            tbUserKey_Value.Text = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("WxTake_UserKey");

            if (PubHelper.p_BusinOper.ConfigInfo.WxTake_Switch == Business.Enum.BusinessEnum.ControlSwitch.Stop)
            {
                rdbSwitch_Stop.IsChecked = true;
                ControlSwitch(false);
            }
            else
            {
                rdbSwitch_Run.IsChecked = true;
                ControlSwitch(true);
            }

            // 头部文件
            string strTopFile = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("WxTake_TopMv");
            BusinessEnum.AdvertType strTopFileType = PubHelper.p_BusinOper.VmFileOper.GetFileAdvertType(strTopFile);
            bool   result     = false;
            string strPicPath = string.Empty;
            if (strTopFileType == BusinessEnum.AdvertType.Image)
            {
                // 图片文件
                result = PubHelper.GetFormPubPic(strTopFile, out strPicPath);
                if (result)
                {
                    imgTop.Source = new BitmapImage(new Uri(strPicPath, UriKind.RelativeOrAbsolute));
                }
                mediaElement1.Visibility = System.Windows.Visibility.Hidden;
                imgTop.Visibility        = System.Windows.Visibility.Visible;
            }
            else
            {
                // 视频文件
                imgTop.Visibility    = System.Windows.Visibility.Hidden;
                mediaElement1.Source = new Uri(AppDomain.CurrentDomain.BaseDirectory.ToString() + "Images\\FormPic\\pub\\" + strTopFile);
                // 临时测试
                mediaElement1.Position = TimeSpan.FromSeconds(5);
                mediaElement1.Play();
                mediaElement1.Visibility = System.Windows.Visibility.Visible;
            }

            result = PubHelper.GetFormPubPic(PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("WxTake_BottomMv"), out strPicPath);
            if (result)
            {
                imgBottom.Source = new BitmapImage(new Uri(strPicPath, UriKind.RelativeOrAbsolute));
            }

            #endregion

            m_IsInit = false;
        }
        /// <summary>
        /// 选择文件
        /// </summary>
        /// <param name="operType">0:选择头部文件 1:选择底部文件</param>
        private void ChoiceFile(string operType)
        {
            string strFileFilter     = string.Empty;
            string strChoiceFilePath = string.Empty;
            string strChoiceFileName = string.Empty;
            // 在WPF中, OpenFileDialog位于Microsoft.Win32名称空间
            string strFilter = string.Empty;

            switch (operType)
            {
            case "0":    // 选择头部文件
                strFileFilter = "图片及视频文件类型(*.png,*.wmv,*.mp4)|*.png;*.wmv;*.mp4";
                break;

            default:    // 选择底部文件
                strFileFilter = "图片文件类型(*.png)|*.png";
                break;
            }

            try
            {
                Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog();
                dialog.Title           = "请选择文件";
                dialog.Filter          = strFileFilter;
                dialog.CheckFileExists = true;
                dialog.CheckPathExists = true;
                dialog.Multiselect     = false;
                bool result = false;
                if (dialog.ShowDialog() == true)
                {
                    strChoiceFilePath = dialog.FileName;
                    strChoiceFileName = dialog.SafeFileName;
                    // 获取格式
                    BusinessEnum.AdvertType strTopFileType = PubHelper.p_BusinOper.VmFileOper.GetFileAdvertType(strChoiceFileName);

                    if (strTopFileType == BusinessEnum.AdvertType.Image)
                    {
                        // 图片文件
                        if (operType == "0")
                        {
                            mediaElement1.Visibility = System.Windows.Visibility.Hidden;
                            imgTop.Source            = new BitmapImage(new Uri(strChoiceFilePath, UriKind.Absolute));
                            imgTop.Visibility        = System.Windows.Visibility.Visible;
                        }
                        else
                        {
                            imgBottom.Source     = new BitmapImage(new Uri(strChoiceFilePath, UriKind.Absolute));
                            imgBottom.Visibility = System.Windows.Visibility.Visible;
                        }
                    }
                    else
                    {
                        // 视频文件
                        imgTop.Visibility    = System.Windows.Visibility.Hidden;
                        mediaElement1.Source = new Uri(strChoiceFilePath);
                        // 临时测试
                        mediaElement1.Position = TimeSpan.FromSeconds(5);
                        mediaElement1.Play();
                        mediaElement1.Visibility = System.Windows.Visibility.Visible;
                    }

                    FileInfo fInfo = new FileInfo(strChoiceFilePath);
                    if (operType == "0")
                    {
                        m_TopFile.FilePath = strChoiceFilePath;
                        m_TopFile.FileName = strChoiceFileName;
                        m_TopFile.FileSize = fInfo.Length;
                    }
                    else
                    {
                        m_BottomFile.FilePath = strChoiceFilePath;
                        m_BottomFile.FileName = strChoiceFileName;
                        m_BottomFile.FileSize = fInfo.Length;
                    }
                }
            }
            catch (Exception ex)
            {
                PubHelper.ShowMsgInfo("选择文件发生错误,原因:" + ex.Message, PubHelper.MsgType.Ok);
            }
        }
Beispiel #5
0
        private void InitForm()
        {
            #region 计算各区域尺寸

            double scrHeight = SystemParameters.PrimaryScreenHeight;
            panelTop.Height      = scrHeight * 0.33;
            panelBottom.Height   = scrHeight * 0.1;
            panelMiddele.Height  = scrHeight * 0.57;
            panelMiddele.Margin  = new Thickness(0, panelTop.Height + 1, 0, 0);
            tbProgressInfo.Width = panelMiddele.Width;

            #endregion

            #region 加载各区域图片

            bool   result     = false;
            string strPicPath = string.Empty;

            string strTopFile = "ShZyZ_Top_Donate.png";
            m_TopFileType = PubHelper.p_BusinOper.VmFileOper.GetFileAdvertType(strTopFile);

            if (m_TopFileType == BusinessEnum.AdvertType.Image)
            {
                // 图片文件
                result = PubHelper.GetFormPubPic(strTopFile, out strPicPath);
                if (result)
                {
                    imgTop.Source = new BitmapImage(new Uri(strPicPath, UriKind.RelativeOrAbsolute));
                }

                imgTop.Visibility = System.Windows.Visibility.Visible;
            }

            string strTipBg = "ShZyZ_Donate_TipBg.png";
            if (PubHelper.p_ShZyZ_Donate_PayType == BusinessEnum.PayMent.AliPay_Code)
            {
                strTipBg = "ShZyZ_Donate_TipBg_AliPay.png";
            }
            result = PubHelper.GetFormPubPic(strTipBg, out strPicPath);
            if (result)
            {
                imgMiddele.Source = new BitmapImage(new Uri(strPicPath, UriKind.RelativeOrAbsolute));
            }

            #endregion

            #region 加载字符资源

            btnCancel.Content    = PubHelper.p_LangOper.GetStringBundle("SellGoods_Button_Cancel");
            btnCancel.Visibility = System.Windows.Visibility.Hidden;

            #endregion

            btnOK.IsEnabled = false;

            #region 设置相关参数

            PubHelper.p_BusinOper.O2OServerOper.VmID      = PubHelper.p_BusinOper.ConfigInfo.VmId;
            PubHelper.p_BusinOper.O2OServerOper.ServerURL = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("O2OServerUrl");
            PubHelper.p_BusinOper.O2OServerOper.UserKey   = PubHelper.p_BusinOper.SysCfgOper.GetSysCfgValue("O2OServer_UserKey");
            m_NowStep = "0";

            #endregion

            #region 启动工作线程

            switch (PubHelper.p_ShZyZ_Donate_PayType)
            {
            case BusinessEnum.PayMent.Cash:    // 现金支付方式
                m_DonType                        = "1";
                btnOK.Visibility                 = System.Windows.Visibility.Visible;
                sPanelMoneyNum.Visibility        = System.Windows.Visibility.Hidden;
                imgShZy_AliPay_QrCode.Visibility = System.Windows.Visibility.Hidden;
                Thread TrdMainWork_Cash = new Thread(new ThreadStart(MainWorkDonTrd_Cash));
                TrdMainWork_Cash.IsBackground = true;
                TrdMainWork_Cash.Start();
                break;

            case BusinessEnum.PayMent.AliPay_Code:    // 支付宝支付方式
                m_DonType                        = "2";
                btnOK.Visibility                 = System.Windows.Visibility.Hidden;
                btnCancel.Visibility             = System.Windows.Visibility.Visible;
                imgShZy_AliPay_QrCode.Visibility = System.Windows.Visibility.Visible;
                sPanelMoneyNum.Visibility        = System.Windows.Visibility.Hidden;
                tbPhone_Value.Visibility         = System.Windows.Visibility.Hidden;
                tbPhone_Title.Visibility         = System.Windows.Visibility.Hidden;
                tbTipInfo_SerName.Visibility     = System.Windows.Visibility.Hidden;
                tbMoney_Value.Visibility         = System.Windows.Visibility.Hidden;
                tbMoney_Title.Visibility         = System.Windows.Visibility.Hidden;
                tbProgressInfo.Foreground        = Brushes.Orange;
                tbProgressInfo.Text              = "请用支付宝“扫一扫”扫描二维码进行捐赠";
                ////Thread TrdMainWork_AliPay = new Thread(new ThreadStart(MainWorkDonTrd_AliPay));
                ////TrdMainWork_AliPay.IsBackground = true;
                ////TrdMainWork_AliPay.Start();
                // 开始超时监控
                BeginMonOutTime();
                break;
            }

            Thread TrdMonOutTime = new Thread(new ThreadStart(MonOutTimeTrd));
            TrdMonOutTime.IsBackground = true;
            TrdMonOutTime.Start();

            #endregion
        }