Пример #1
0
        void burningUpdate([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress)
        {
            if (backgroundWorker.CancellationPending)
            {
                IDiscFormat2Data Data = (IDiscFormat2Data)sender;
                Data.CancelWrite();
                return;
            }

            IDiscFormat2DataEventArgs kejadian = (IDiscFormat2DataEventArgs)progress;

            burnMedia.task = BURN_MEDIA_TASK.BURN_MEDIA_TASK_WRITING;

            burnMedia.elapsedTime   = kejadian.ElapsedTime;
            burnMedia.remainingTime = kejadian.RemainingTime;
            burnMedia.totalTime     = kejadian.TotalTime;

            burnMedia.currentAction     = kejadian.CurrentAction;
            burnMedia.startLba          = kejadian.StartLba;
            burnMedia.sectorCount       = kejadian.SectorCount;
            burnMedia.lastReadLba       = kejadian.LastReadLba;
            burnMedia.lastWrittenLba    = kejadian.LastWrittenLba;
            burnMedia.totalSystemBuffer = kejadian.TotalSystemBuffer;
            burnMedia.usedSystemBuffer  = kejadian.UsedSystemBuffer;
            burnMedia.freeSystemBuffer  = kejadian.FreeSystemBuffer;

            backgroundWorker.ReportProgress(0, burnMedia);
        }
Пример #2
0
        /// <summary>
        /// The update event handler for the IMAPI service.  Reports the progress of the DVD burn.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="args">Event arguments.</param>
        private void DiscFormatData_Update(
            [In, MarshalAs(UnmanagedType.IDispatch)] object sender,
            [In, MarshalAs(UnmanagedType.IDispatch)] object args)
        {
            if (this.WorkerThread.CancellationPending)
            {
                IDiscFormat2Data format2Data = (IDiscFormat2Data)sender;
                format2Data.CancelWrite();
                return;
            }

            IDiscFormat2DataEventArgs ea = (IDiscFormat2DataEventArgs)args;
            double currentProgress       = 100 * ((ea.LastWrittenLba - ea.StartLba) / (double)ea.SectorCount);

            this.progress = (int)Math.Floor(currentProgress);
            this.StatusUpdateArgs.TimeRemaining = new TimeSpan(0, 0, ea.RemainingTime);
            this.WorkerThread.ReportProgress(this.progress);
        }
Пример #3
0
        private void OnBurnProgress(object o1, object o2)
        {
            IDiscFormat2Data          dd = o1 as IDiscFormat2Data;
            IDiscFormat2DataEventArgs ea = o2 as IDiscFormat2DataEventArgs;

            if (ea != null && dd != null)
            {
                Dispatcher.Invoke(
                    DispatcherPriority.Normal,
                    (Action) delegate() { OnUpdateProgress(ea); }
                    );

                if (isCancelRequested)
                {
                    dd.CancelWrite();
                }
            }
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="progress"></param>
        void discFormatData_Update([In, MarshalAs(UnmanagedType.IDispatch)] object sender, [In, MarshalAs(UnmanagedType.IDispatch)] object progress)
        {
            //
            // Check if we've cancelled
            //
            if (backgroundBurnWorker.CancellationPending)
            {
                IDiscFormat2Data format2Data = (IDiscFormat2Data)sender;
                format2Data.CancelWrite();
                return;
            }

            IDiscFormat2DataEventArgs eventArgs = (IDiscFormat2DataEventArgs)progress;

            m_burnData.task = BURN_MEDIA_TASK.BURN_MEDIA_TASK_WRITING;

            // IDiscFormat2DataEventArgs Interface
            m_burnData.elapsedTime   = eventArgs.ElapsedTime;
            m_burnData.remainingTime = eventArgs.RemainingTime;
            m_burnData.totalTime     = eventArgs.TotalTime;

            // IWriteEngine2EventArgs Interface
            m_burnData.currentAction     = eventArgs.CurrentAction;
            m_burnData.startLba          = eventArgs.StartLba;
            m_burnData.sectorCount       = eventArgs.SectorCount;
            m_burnData.lastReadLba       = eventArgs.LastReadLba;
            m_burnData.lastWrittenLba    = eventArgs.LastWrittenLba;
            m_burnData.totalSystemBuffer = eventArgs.TotalSystemBuffer;
            m_burnData.usedSystemBuffer  = eventArgs.UsedSystemBuffer;
            m_burnData.freeSystemBuffer  = eventArgs.FreeSystemBuffer;

            //
            // Report back to the UI
            //
            backgroundBurnWorker.ReportProgress(0, m_burnData);
        }