コード例 #1
0
        private void BackgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            m_Popup.Close( ); // Calling close might dispose, so create new one next time
            m_Popup = null;

            if (e.Cancelled)
            {
                InfoMsg("User cancelled operation. Are you joking to me?");
            }
            else
            {
                InfoMsg($"{e.Result}\nConversion is done.");
            }
        }
コード例 #2
0
        public void Convert( )
        {
            if (!File.Exists(inputPath.Text))
            {
                InfoMsg($"Input file is not exist\n{inputPath.Text}\nDeal with it.");
                return;
            }

            _UpdateEffectivePath( );
            // Check if file already exists
            if (File.Exists(outputPathPreview.Text))
            {
                InfoMsg($"Looks like there is file exists at\n{outputPathPreview.Text}\nPlease resolve this manually, for safety reason (loss of data), program will not continue.");
                return;
            }

            // Try create directory once
            if (!Directory.Exists(outputPath.Text))
            {
                Directory.CreateDirectory(outputPath.Text);
            }

            if (!Directory.Exists(outputPath.Text))
            {
                ErrorMsg($"Save path \n{outputPath.Text}\nis invalid");
                return;
            }

            if (m_Popup == null)
            {
                m_Popup = new WorkingDialog(this);
            }

            backgroundWorker1.RunWorkerAsync(m_Wp);

            m_Popup.ShowDialog(this);   // ShowDialog is blocking call
        }