コード例 #1
0
        private void tmx_Tick(object sender, EventArgs e)
        {
            // Check if there PDF file in source folder
            POProcess FolderPO = new POProcess();

            var files = FolderPO.GetAllFile(FolderPO.srcFolder, "txt");

            // Check if it has
            if (!files.Length.Equals(0))
            {
                // Check if there is Internet Connection
                if (new Ping().Send("www.danubeco.com").Status != IPStatus.Success)
                {
                    RichTxt(rtBox, "unavailable..", Color.Red);

                    return;
                }

                // Disable timer so that it won't process any pdf
                tmx.Enabled = false;

                // Show uploader Form
                App.Upload frm = new App.Upload();

                // Inform System Log -> Uploader
                RichTxt(rtBox, "Processing..", Color.Green);

                // System log
                frm.SysLog += new App.Upload.SystemLog(sysLOG);

                if (frm.ShowDialog(this) == DialogResult.Cancel)
                {
                    // if done uploading files enable timer
                    tmx.Enabled = true;

                    RichTxt(rtBox, "Finished..", Color.Green);

                    FolderPO.CreateFolder(FolderPO.bckFolder);

                    rtBox.SaveFile(Path.Combine(FolderPO.bckFolder, DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.ToString("hmmss") + DateTime.Now.ToString("tt") + ".log"), RichTextBoxStreamType.PlainText);
                }
            }
        }