示例#1
0
 public override bool Open()
 {
     if (KCommon.CheckVersion(base.EmbeddedEntry.FullName))
     {
         DockWindow dockWindow = System.Windows.Application.Current.MainWindow as DockWindow;
         if (Setting.IsSingleFile == "1" && Setting.TabsDic.Count > 0)
         {
             foreach (KeyValuePair <object, object> item in Setting.TabsDic)
             {
                 if (((Mainpage)item.Value).FilePath == base.EmbeddedEntry.FullName)
                 {
                     ((LayoutDocument)item.Key).IsActive   = true;
                     ((LayoutDocument)item.Key).IsSelected = true;
                     return(true);
                 }
             }
         }
         Mainpage    content     = new Mainpage(base.EmbeddedEntry.FullName);
         string      title       = base.EmbeddedEntry.Name.Substring(0, base.EmbeddedEntry.Name.Length - 4);
         BitmapImage kFBThumnail = KCommon.GetKFBThumnail(base.EmbeddedEntry.FullName);
         if (kFBThumnail.StreamSource == null)
         {
             MessageWind messageWind = new MessageWind(MessageBoxButton.OK, System.Windows.Application.Current.MainWindow, dockWindow.languageSetter.LanguageResource["Filedamage"], dockWindow.languageSetter.LanguageResource["Prompt"], MessageBoxIcon.Exclamation, false);
             messageWind.ShowDialog();
             return(false);
         }
         dockWindow.AddItem(base.EmbeddedEntry.Name + DateTime.Now.ToString("yyyyMMddhhmmss"), title, content, kFBThumnail);
         return(true);
     }
     return(false);
 }
示例#2
0
 private void FtpSession_CommandSent(object sender, KCommon.Net.FTP.FtpCommandEventArgs args)
 {
 }
示例#3
0
 private void FtpSession_BeginPutFile(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     statusBar1.Panels[0].Text = "File upload started...";
 }
示例#4
0
文件: WM9.cs 项目: CarverLab/Oyster
 private void FtpSession_FileTransferProgress(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     string sDirection = (args.TransferDirection == KCommon.Net.FTP.TransferDirection.Download) ?
         "Downloading" : "Uploading";
     //			Msg(sDirection + " " + args.RemoteFileName + ": " +
     //				args.TransferedPercentage + "%");
     m_iPercentUploadingComplete = args.TransferedPercentage;
     RaiseFileTransferProgressEvent(args);
 }
示例#5
0
        private void FtpSession_EndGetFile(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
        {
            #region Send Download_End_Event

                long TotalDownloadPercentage = 0;

                try
                {
                    //Only used during multiple file downloads/uploads
                    TotalDownloadPercentage	= CalculatePercentage(TotalTransferProgress,TotalFileSize);
                }
                catch(Exception Err)
                {

                    string peekError = Err.Message;
                }
            try
            {
                if(args.TransferResult != null)
                {
                    bTransferSuccess = args.TransferResult.IsSuccess;
                }
                else if(args.TransferedPercentage > 90)
                {
                    bTransferSuccess = true;
                }
                else
                {
                    bTransferSuccess = false;
                }
            }
            catch(Exception CErr)
            {
                string peekThisErr = CErr.Message;
            }
            try
            {

                TransferDirection e = TransferDirection.Upload;
                if(args.TransferDirection == KCommon.Net.FTP.TransferDirection.Download)
                    e = TransferDirection.Download;

                TransferResult TR = new TransferResult();
                OysterTransferArguments ota = new OysterTransferArguments(args.LocalFileName,
                    args.RemoteFileName,(double)args.TotalBytes,TransferProgress,TotalFileSize,TotalTransferProgress,
                    e,args.TransferedPercentage,(int)TotalDownloadPercentage,TR);
                if(On_Download_Complete != null)
                    On_Download_Complete(this,ota);
            }
            catch(Exception PostError)
            {
                string peekError = PostError.Message;
                OysterTransferArguments Eota = new OysterTransferArguments(args);
                if(On_Upload_Complete != null)
                    On_Upload_Complete(this,Eota);
            }

            #endregion
            Msg("Download complete.");
            DownloadingFile = false;
            TransferProgress = 0;
            m_ThreadTransferCompleteEvent.Set();
        }
示例#6
0
文件: WM9.cs 项目: CarverLab/Oyster
 private void FtpSession_EndPutFile(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     RaiseEndPutFile(args);
 }
示例#7
0
文件: WM9.cs 项目: CarverLab/Oyster
 internal void RaiseFileTransferProgressEvent(KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     if(FileTransferProgress != null)
         FileTransferProgress(this, args);
 }
示例#8
0
 private void FtpSession_FileTransferProgress(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     string sDirection = (args.TransferDirection == KCommon.Net.FTP.TransferDirection.Download) ?
         "Downloading" : "Uploading";
     statusBar1.Panels[0].Text = sDirection + " " + args.TransferDirection + " " + args.RemoteFileName + ": " +
         args.TransferedPercentage + "%";
 }
示例#9
0
文件: WM9.cs 项目: CarverLab/Oyster
 internal void RaiseBeginPutFileEvent(KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     if(BeginPutFile != null)
         BeginPutFile(this, args);
 }
示例#10
0
文件: WM9.cs 项目: CarverLab/Oyster
 internal void RaiseEndPutFile(KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     if(EndPutFile != null)
         EndPutFile(this, args);
 }
示例#11
0
 internal OysterTransferArguments(KCommon.Net.FTP.IFtpFileTransferArgs FFTArgs)
 {
     m_LocalFileName = FFTArgs.LocalFileName;
     m_RemoteFileName = FFTArgs.RemoteFileName;
     m_CurrentFile_TotalBytes = FFTArgs.TotalBytes;
     m_CurrentFile_BytesTransfered = FFTArgs.TotalBytesTransfered;
     m_AllFiles_TotalBytes = FFTArgs.TotalBytes;
     m_AllFiles_TotalBytesTransfered = FFTArgs.TotalBytesTransfered;
     m_TransferDirection = (TransferDirection)FFTArgs.TransferDirection;
     m_CurrentFileTransferPercentage = FFTArgs.TransferedPercentage;
     m_TotalDownloadTransferPercentage = FFTArgs.TransferedPercentage;
     if(null == FFTArgs.TransferResult)
         m_TransferResult = null;
     else
         m_TransferResult = (TransferResult)FFTArgs.TransferResult;
 }
示例#12
0
        private void FtpSession_FileTransferProgress(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
        {
            try
            {
                double TotalSize = args.TotalBytes;
                TransferProgress = args.TotalBytesTransfered;
                if(LTransfer != 0)
                {
                    TotalTransferProgress += (TransferProgress - LTransfer);
                }
                LTransfer = TransferProgress;

            //				frmTS.pbCBar.Maximum = 100;
            //				frmTS.pbCBar.Minimum = 0;
            //				frmTS.pbTBar.Minimum = 0;
            //
            //				frmTS.pbCBar.Value = CalculatePercentage(TransferProgress,TotalSize);
            //				frmTS.pbTBar.Value =  CalculatePercentage(TotalTransferProgress,TotalFileSize);//ConvertBytesToProgressBarInt(TotalTransferProgress);
                int TotalDownloadPercentage = 0;

                try
                {
                    TotalDownloadPercentage	= CalculatePercentage(TotalTransferProgress,TotalFileSize);
                }
                catch(Exception Err)
                {
                    string peekError = Err.Message;
                }

                TransferDirection e = TransferDirection.Upload;
                if(args.TransferDirection == KCommon.Net.FTP.TransferDirection.Download)
                    e = TransferDirection.Download;

                TransferResult TR = new TransferResult();
                OysterTransferArguments ota = new OysterTransferArguments(args.LocalFileName,
                    args.RemoteFileName,(double)args.TotalBytes,TransferProgress,TotalFileSize,TotalTransferProgress,
                    e,args.TransferedPercentage,(int)TotalDownloadPercentage,TR);

                if(On_TransferProgress != null)
                    On_TransferProgress(this,ota);

                string sCurrent = ConvertByteToString(TransferProgress);
                string sTotal = ConvertByteToString(TotalSize);
            //				frmTS.pbTBar.Refresh();

                string sDirection = "Download";

                if(args.TransferDirection == KCommon.Net.FTP.TransferDirection.Upload)
                    sDirection = "Upload";
            //				Msg(sDirection + " progress: " + ((double)(TransferProgress / 1024 / 1024)).ToString() + " of " + ((double)(TotalSize / 1024 / 1024)).ToString());
                Msg(sDirection + " progress: " + sCurrent + " of " + sTotal);

                Application.DoEvents();
            }
            catch(Exception Err)
            {
                //MessageBox.Show(Err.Message,"File Transfer Progress");
                string p = Err.Message;
            }
        }
示例#13
0
        private void FtpSession_EndPutFile(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
        {
            #region Send Upload_Begin_Event

            long TotalDownloadPercentage = 0;
            try
            {
                TotalDownloadPercentage	= CalculatePercentage(TotalTransferProgress,TotalFileSize);
            }
            catch(Exception Err)
            {
                string peekError = Err.Message;
            }
            try
            {
                if(args.TransferResult != null)
                {
                    bTransferSuccess = args.TransferResult.IsSuccess;
                }
                else if(args.TransferedPercentage > 90)
                {
                    bTransferSuccess = true;
                }
                else
                {
                    bTransferSuccess = false;
                }
            }
            catch(Exception CErr)
            {
                string peekThisErr = CErr.Message;
            }

            try
            {
                TransferDirection e = TransferDirection.Upload;

                TransferResult TR = null;
                if(args.TransferDirection == KCommon.Net.FTP.TransferDirection.Download)
                    e = TransferDirection.Download;

                if(args.TransferResult != null)
                {
                    TR = new TransferResult(args.TransferResult.FtpResponseCode,
                        args.TransferResult.IsAborted,args.TransferResult.IsFailed,args.TransferResult.IsSuccess,
                        args.TransferResult.Message);
                }
                else
                {
                    TR = new TransferResult(0,false,false,false,"No transfer result received");
                }
                OysterTransferArguments ota = new OysterTransferArguments(args.LocalFileName,
                    args.RemoteFileName,(double)args.TotalBytes,TransferProgress,TotalFileSize,TotalTransferProgress,
                    e,args.TransferedPercentage,(int)TotalDownloadPercentage,TR);
                if(On_Upload_Complete != null)
                    On_Upload_Complete(this,ota);
            }
            catch(Exception PostError)
            {
                string peekError = PostError.Message;
                OysterTransferArguments Eota = new OysterTransferArguments(args);
                if(On_Upload_Complete != null)
                    On_Upload_Complete(this,Eota);
            }
            #endregion

            Msg("Upload complete.");
            TransferProgress = 0;
            //UploadingFile = false;
            m_ThreadTransferCompleteEvent.Set();
        }
示例#14
0
 private void FtpSession_EndGetFile(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
 }
示例#15
0
文件: WM9.cs 项目: CarverLab/Oyster
 private void FtpSession_BeginGetFile(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     RaiseBeginGetFileEvent(args);
 }
示例#16
0
 private void FtpSession_EndPutFile(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     statusBar1.Panels[0].Text = "Upload complete.";
 }
示例#17
0
文件: WM9.cs 项目: CarverLab/Oyster
 private void FtpSession_BeginPutFile(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
 {
     //			Msg(args.LocalFileName + ":" + " upload started...");
     RaiseBeginPutFileEvent(args);
 }
示例#18
0
 private void FtpSession_ResponseReceived(object sender, KCommon.Net.FTP.FtpResponseEventArgs args)
 {
 }
示例#19
0
        private void FtpSession_BeginPutFile(object sender, KCommon.Net.FTP.IFtpFileTransferArgs args)
        {
            #region Send Upload_Begin_Event
            long TotalDownloadPercentage = 0;
            //System.Math.DivRem((long)TotalFileSize,args.TotalBytesTransfered,out TotalDownloadPercentage);

            TransferDirection e = TransferDirection.Upload;
            if(args.TransferDirection == KCommon.Net.FTP.TransferDirection.Download)
                e = TransferDirection.Download;

            TransferResult TR = new TransferResult();
            OysterTransferArguments ota = new OysterTransferArguments(args.LocalFileName,
                args.RemoteFileName,(double)args.TotalBytes,0,TotalFileSize,TotalTransferProgress,
                e,args.TransferedPercentage,(int)TotalDownloadPercentage,TR);
            if(On_Upload_Begin != null)
                On_Upload_Begin(this,ota);
            #endregion

            LTransfer = 0;
            Msg(args.LocalFileName + ":" + " upload started...");
            Application.DoEvents();
        }