Пример #1
0
        private void ChecksumComputeProgress_Shown(object sender, EventArgs e)
        {
            lblProgressInfo.Text = "Computation Preparing...";

            //ͳ¼Æ×Ö½ÚÊý
            long totalBytes = 0;

            foreach (PathNode node in pathNodes_)
            {
                totalBytes += node.Size;
            }
            long computedSize = 0;
            int  startTick    = Environment.TickCount;

            foreach (PathNode node in pathNodes_)
            {
                lblProgressInfo.Text = string.Format(
                    "{0}", node.Name
                    );
                ChecksumCallback callback = new ChecksumCallback(
                    computedSize,
                    totalBytes,
                    this,
                    startTick
                    );

                string error = node.ComputeChecksumAsync(callback);
                if (error != null)
                {
                    if (MessageBox.Show("Checksum computation was interrupted.\n" + error + "\nContinue Computation?", "Error", MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        IsOK = false;
                        Close();
                        return;
                    }
                }
                computedSize += node.Size;
            }

            Close();
        }
Пример #2
0
        private void ChecksumComputeProgress_Shown( object sender, EventArgs e )
        {
            lblProgressInfo.Text = "Computation Preparing...";

            //ͳ���ֽ���
            long totalBytes = 0;
            foreach (PathNode node in pathNodes_)
            {
                totalBytes += node.Size;
            }
            long computedSize = 0;
            int startTick = Environment.TickCount;

            foreach (PathNode node in pathNodes_) {
                lblProgressInfo.Text = string.Format(
                    "{0}", node.Name
                );
                ChecksumCallback callback = new ChecksumCallback(
                    computedSize,
                    totalBytes,
                    this,
                    startTick
                    );

                string error = node.ComputeChecksumAsync(callback);
                if( error != null ) {
                    if( MessageBox.Show( "Checksum computation was interrupted.\n" + error+ "\nContinue Computation?", "Error", MessageBoxButtons.YesNo ) == DialogResult.No ) {
                        IsOK = false;
                        Close();
                        return;
                    }
                }
                computedSize += node.Size;
            }

            Close();
        }