Exemplo n.º 1
0
        /// <summary>
        /// HTTP content being downloaded
        /// </summary>
        protected override void DonePartial(int sz, byte[] partialRes)
        {
            TaskActionEventArgs ev = new TaskActionEventArgs();

            try
            {
                ev.Partial = true;
                ev.ProgressPct = (int)(((float)ContentRead / (float)ContentSize) * 100);

                // Write the downloaded content asynchronously.
                byte[] writeRes = new byte[partialRes.Length];
                partialRes.CopyTo(writeRes, 0);
                m_fileStream.BeginWrite(writeRes, 0, sz, new AsyncCallback(DoneWrite), null);

                // Raise a partial result.
                FireTaskDone(ev);
            }
            catch (Exception ex)
            {
                FireTaskError(new TaskErrorEventArgs(ex));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Accumulate the buffer content inside a buffer.
        /// </summary>
        protected override void DonePartial(int sz, byte[] partialHttpContent)
        {
            TaskActionEventArgs ev = new TaskActionEventArgs();

            ev.Partial = true;
            ev.ProgressPct = (int)(((float)ContentRead / (float)ContentSize) * 100);

            // Create a static transfer buffer.
            if (m_resContent == null) m_resContent = new byte[ContentSize];

            // Copy the content inside the buffer.
            Array.Copy(partialHttpContent, 0, m_resContent, ContentRead - sz, sz);

            // Raise a partial completion.
            FireTaskDone(ev);
        }
Exemplo n.º 3
0
 protected void FireTaskDone(TaskActionEventArgs ev)
 {
     if (TaskDone != null) TaskDone(this, ev);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Called when an installer is finished downloading
        /// </summary>
        private void OnWebDownloadDone(object sender, TaskActionEventArgs ev)
        {
            Task evTask = sender as Task;

            if (ev.Partial)
            {
                string statusText = "Downloading update ... " + ev.ProgressPct + "%";

                ProgressForm.Status = statusText;
                ProgressTray.Status = statusText;

                // If this is a partial result, update the progress form with
                // a new % of progress.
                ProgressForm.Progress = ev.ProgressPct;
            }
            else
            {
                // Add the product to the queue of installable product.s
                m_installableProducts.Add(evTask.TaskProduct);

                m_currentTask = null;

                // Run the next task.
                RunCurrentStep();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Called when a product update data has been fetched online.
        /// </summary>
        private void OnWebCheckDone(object sender, TaskActionEventArgs ev)
        {
            Task evTask = sender as Task;

            // We don't care about partial results.
            if (ev.Partial)
            {
                // Just update the progress bar.
                ProgressForm.Progress = ev.ProgressPct;
            }
            else
            {
                // Compare the version.
                if (Misc.LaterVersion(evTask.TaskProduct.LocalVersion, evTask.TaskProduct.WebVersion))
                {
                    m_updateProducts.Add(evTask.TaskProduct);
                }

                m_currentTask = null;

                RunCurrentStep();
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Called when an installer is done running.
        /// </summary>
        private void OnInstallDone(object sender, TaskActionEventArgs ev)
        {
            Task evTask = sender as Task;

            m_currentTask = null;

            // Run the next task.
            RunCurrentStep();
        }