/// <summary>
        /// 开始上传文件
        /// </summary>
        /// <param name="ftpHelper">ftp辅助对象(针对ftp的相关操作)</param>
        /// <param name="amrAudioFullName">语音文件地址</param>
        /// <param name="amrAudioName">语音名称</param>
        /// <param name="guid">序列号</param>
        public void BeginUpload(FtpManage ftpHelper, string amrAudioFullName, string amrAudioName, int guid)
        {
            //将语音文件上传到服务器
            ftpHelper.UploadFtp(amrAudioFullName, amrAudioName, IMMCodeEnterEntity.ConferenceFtpWebAddressFront + IMMCodeEnterEntity.FtpServerceAudioName, "/",
                                IMMCodeEnterEntity.FtpUserName, IMMCodeEnterEntity.FtpPassword, delegate(long Length, double progress)
            {
            }, delegate(System.Exception error, bool result)
            {
                //this.wave.StreamDispose();

                //可以再次执行录音、语音转换
                this.isInTransfer = false;

                if (File.Exists(this.wave.SavedFile))
                {
                    File.Delete(this.wave.SavedFile);
                }
                ModelManage.ConferenceAudio.UploadAudioCompleate(IMMCodeEnterEntity.ConferenceName, new ConferenceAudioItemTransferEntity()
                {
                    Guid = guid
                }, new Action <bool>((isSuccessed) =>
                {
                }));
            });
        }
Beispiel #2
0
 /// <summary>
 /// 上传图片
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void imgUPload(string UploadImg)
 {
     try
     {
         if (string.IsNullOrEmpty(UploadImg))
         {
             return;
         }
         //生成一个ftp辅助类()
         FtpManage ftpHelper = new FtpManage();
         //头像地址
         string personImgUri = Constant.ConferenceFtpWebAddressFront + Constant.FtpServercePersonImgName;
         //删除文件
         FtpManage.DeleteFile(personImgUri, Constant.FtpUserName, Constant.FtpPassword);
         //上传头像
         ftpHelper.UploadFtp(UploadImg, Constant.LoginUserName + ".png", Constant.ConferenceFtpWebAddressFront + Constant.FtpServercePersonImgName, "/", Constant.FtpUserName, Constant.FtpPassword, delegate(long Length, double progress)
         {
         }, delegate(System.Exception error, bool result)
         {
             if (result)
             {
                 //使用异步委托
                 this.Dispatcher.BeginInvoke(new Action(() =>
                 {
                     try
                     {
                         //显示状态
                         this.txtUPloadTip.Visibility = System.Windows.Visibility.Visible;
                         //过渡一端时间隐藏提示状态
                         TimerJob.StartRun(new Action(() =>
                         {
                             this.txtUPloadTip.Visibility = System.Windows.Visibility.Collapsed;
                         }), 2000);
                     }
                     catch (Exception ex)
                     {
                         LogManage.WriteLog(this.GetType(), ex);
                     }
                     finally
                     {
                     }
                 }));
             }
         });
     }
     catch (Exception ex)
     {
         LogManage.WriteLog(this.GetType(), ex);
     }
     finally
     {
     }
 }