Exemple #1
0
 protected virtual void OnAllFilesDone(FileInfoEventArgs e)
 {
     if (AllFilesRead != null)
     {
         AllFilesRead(this, e);
     }
 }
 void extr_FileExtractionStarted(object sender, FileInfoEventArgs e)
 {
     l_ExtractProgress.Text = String.Format("Extracting \"{0}\"", e.FileInfo.FileName);
     l_ExtractProgress.Refresh();
     pb_ExtractWork.Increment(1);
     pb_ExtractWork.Refresh();
 }
Exemple #3
0
        /// <summary>
        /// Called when a file has been extracted from a source archive.
        /// </summary>
        /// <remarks>
        /// This notifies listeners that a read-only initialization step has finished.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">An <see cref="EventArgs"/> describing the event arguments.</param>
        private void FileExtractionFinished(object sender, FileInfoEventArgs e)
        {
            CancelProgressEventArgs ceaArgs = new CancelProgressEventArgs((float)e.PercentDone / 100f);

            ReadOnlyInitProgressUpdated(this, ceaArgs);
            e.Cancel = ceaArgs.Cancel;
        }
Exemple #4
0
        private void FileExtractionFinishedHandler(object sender, FileInfoEventArgs args)
        {
            if (!PassThru)
            {
                return;
            }

            string relArchivePathName = args.FileInfo.FileName;

            if (this.FlattenPaths)
            {
                string leafName = System.IO.Path.GetFileName(relArchivePathName);
                string destPath = System.IO.Path.Combine(OutputPath.ProviderPath, leafName);
                if (args.FileInfo.IsDirectory)
                {
                    WriteObject(new DirectoryInfo(destPath));
                }
                else
                {
                    WriteObject(new FileInfo(destPath));
                }
            }
            else
            {
                string destPath = System.IO.Path.Combine(OutputPath.ProviderPath, relArchivePathName);
                if (args.FileInfo.IsDirectory)
                {
                    WriteObject(new DirectoryInfo(destPath));
                }
                else
                {
                    WriteObject(new FileInfo(destPath));
                }
            }
        }
Exemple #5
0
        /// <summary>
        ///   Called when a file is about to be extracted from a source archive.
        /// </summary>
        /// <remarks>
        ///   This notifies listeners that a read-only initialization step has started.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">A <see cref="FileNameEventArgs" /> describing the event arguments.</param>
        private void FileExtractionStarted(object sender, FileInfoEventArgs e)
        {
            var ceaArgs = new CancelEventArgs(false);

            ReadOnlyInitStepStarted(this, ceaArgs);
            e.Cancel = ceaArgs.Cancel;
        }
Exemple #6
0
 protected virtual void OnFileDone(FileInfoEventArgs e)
 {
     if (FileDone != null)
     {
         FileDone(this, e);
     }
 }
Exemple #7
0
 protected virtual void OnFileProgressed(FileInfoEventArgs e)
 {
     if (FileProgressed != null)
     {
         FileProgressed(this, e);
     }
 }
Exemple #8
0
        private void OnFileExtractionStarted(object sender, FileInfoEventArgs e)
        {
            var extractedFile = Path.GetFileName(e.FileInfo.FileName);

            CurrentProgressDescription = $"--> Extracting {extractedFile}";
            Console.WriteLine(CurrentProgressDescription);
            SingleFileUnpackProgress = 0;
        }
        private void SetDocumentInfo(Document msWordDoc, FileInfoEventArgs fInfo)
        {
            //ToDo (d.Application.StatusBar = $"Reloaded";) тут я каким-то образом должен к загаловку окна добавить уникальный идентификатор и когда юзер нажмет кнопку печати, я получу этот идентификатор и буду точно знать какой документ печатается
            int countOfPage = msWordDoc.ComputeStatistics(WdStatistic.wdStatisticPages, false);

            fInfo.Doc        = msWordDoc;
            fInfo.PagesCount = countOfPage;
        }
 void ExtrFileExtractionStarted(object sender, FileInfoEventArgs e)
 {
     Dispatcher.Invoke(new SetInfoDelegate(args =>
     {
         System.Windows.Forms.Application.DoEvents();
         _pWindSplash.pb_Extract2.Value += 1;
     }), e);
 }
Exemple #11
0
        void Operate_OnFilePathError(object sender, FileInfoEventArgs e)
        {
            string errorInfo = e.Desc;

            if (!string.IsNullOrWhiteSpace(errorInfo))
            {
                this.ShowAlert(errorInfo);
            }
            this.SetControlDefaultState(false);
        }
Exemple #12
0
        void Operate_OnFileOperateComplete(object sender, FileInfoEventArgs e)
        {
            string info = e.Desc;

            if (!string.IsNullOrWhiteSpace(info))
            {
                this.ShowAlert(info);
            }
            this.SetControlDefaultState(true);
        }
Exemple #13
0
        void Operate_OnFileOperate(object sender, FileInfoEventArgs e)
        {
            string fileName = e.Desc;

            if (!string.IsNullOrWhiteSpace(fileName))
            {
                this.tssInfo.Text        = fileName;
                this.tssInfo.ToolTipText = fileName;
                this.SetProgressValue((int)(e.Rate * 100));
            }
        }
Exemple #14
0
 void zmodem_FileInfoEvent(object sender, FileInfoEventArgs e)
 {
     Console.WriteLine(e.FileName + " " + e.Size);
     //fileSize = e.size;
     //backgroundWorker1.ReportProgress(0);
     //progress.Minimum = 0;
     //progress.Maximum = 100;
     //progress.Value = 0;
     //progress.Visible = true;
     //progress.Refresh();
 }
Exemple #15
0
        private void FileExtractionFinished(object sender, FileInfoEventArgs e)
        {
            //pb_totaalfiles.Invoke(new FileInfoEvent((object o, FileInfoEventArgs l) =>
            //{
            //    pb_totaalfiles.Value += (int)(100 / _sevenZipExtractor.FilesCount);
            //}),sender,e);

            pb_compression.Invoke(new InvokeEvent((object o, EventArgs l) =>
            {
                pb_compression.Value = 100;
            }), sender, e);
        }
Exemple #16
0
        private void OnFileExtractionFinished(object sender, FileInfoEventArgs e)
        {
            SingleFileUnpackProgress = Convert.ToInt32(100);
            var extractor = sender as SevenZipExtractor;

            if (extractor != null)
            {
                long totalSize = extractor.UnpackedSize;
                bytesUnpacked  += e.FileInfo.Size;
                OverallProgress = Convert.ToInt32(bytesUnpacked * 100 / (ulong)totalSize);
            }
        }
Exemple #17
0
        } // состояние загрузки файлов

        private void Extr_FileExtractionStarted(object sender, FileInfoEventArgs e)
        {
            try
            {
                label_status_bar.Invoke(new Action(() => label_status_bar.Font = new Font("Arial Narrow", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 204)));
                label_status_bar.Invoke(new Action(() => label_status_bar.Text = $"Установка: {e.FileInfo.FileName}"));
                progressBar1.Increment(1);  // ЗАПОЛНЕНИЕ ПРОГРЕССА
                progressBar1.Refresh();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
        } // процесс распаковки
        private void FileExtractFinished(object sender, FileInfoEventArgs e)
        {
            if (bgwUnZipper.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            if (e.PercentDone == 100)
            {
                //this.Invoke(new MethodInvoker(delegate
                //{
                pb.Value += (int)e.FileInfo.Size;
                //}));
                //System.Threading.Thread.Sleep(200);
            }
        }
        private void WatchDirectory(object o, FileInfoEventArgs e)
        {
            switch (e.FileExtension)
            {
            case _csv:
            {
                GenerateCsvModelAsync(e.FullFileName).ContinueWith(AdditionNewCsv);
                break;
            }

            case _xml:
            {
                GenerateXmlModelAsync(e.FullFileName).ContinueWith(AdditionNewXml);
                break;
            }
            }
        }
        private void FileExtractStarted(object sender, FileInfoEventArgs e)
        {
            if (bgwUnZipper.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            if (e.PercentDone == 0)
            {
                //this.Invoke(new MethodInvoker(delegate
                //{
                lInfo.Text = e.FileInfo.FileName;
                lInfo.Refresh();
                //}));
            }
        }
Exemple #21
0
        private void FileExtractionStarted(object sender, FileInfoEventArgs e)
        {
            //when the next file is being compressed.
            lbl_commpressing_file.Invoke(new FileInfoEvent((object o, FileInfoEventArgs l) =>
            {
                lbl_commpressing_file.Text = String.Format(_commpressingFileName, l.FileInfo.FileName);
            }), sender, e);

            pb_totaalfiles.Invoke(new FileInfoEvent((object o, FileInfoEventArgs l) =>
            {
                pb_totaalfiles.Value = l.PercentDone;
            }), sender, e);

            pb_compression.Invoke(new InvokeEvent((object o, EventArgs l) =>
            {
                pb_compression.Value = 0;
            }), sender, e);
        }
        protected void ProcessStarted(object sender, EventArrivedEventArgs e)
        {
            ManagementBaseObject targetInstance = (ManagementBaseObject)e.NewEvent.Properties["TargetInstance"].Value;
            int id = int.Parse(targetInstance["ProcessId"].ToString());

            var path = GetPathOfOpenedDoc(targetInstance, id);

            Process.GetProcessById(id).Kill();


            Document reloadedDoc = GetReloadedFile(path);

            //reloadedDoc.Close(false, null, null);
            //reloadedDoc = GetReloadedFile(path);
            //return;

            GetWindowThreadProcessId(reloadedDoc.Application.ActiveWindow.Hwnd, out int reloadedProcId);
            FileInfoEventArgs fInfo = new FileInfoEventArgs(path, reloadedProcId, Path.GetExtension(path), 0);

            reloadedDoc.Content.Application.DocumentBeforePrint += delegate(Document doc, ref bool cancel)
            {
            };

            SetDocumentInfo(reloadedDoc, fInfo);

            OpenWordPrintDialog(reloadedDoc);

            //msWordDoc.Close(0, null, null);

            //msWordDoc.Application.Quit(0, null, null);

            //if (бабок хватает)
            //msOfficeApp.Print();
            //else
            //{
            //	запускаем авторизацию
            //}
        }
Exemple #23
0
 void extractor_FileExtractionFinished(object sender, FileInfoEventArgs e)
 {
 }
 private void OnFileExtractionFinished(FileInfoEventArgs e)
 {
     if (FileExtractionFinished != null)
     {
         FileExtractionFinished(this, e);
     }
 }
Exemple #25
0
 /// <summary>
 /// Invoke filtered event.
 /// </summary>
 private void FilteredFileRaised(FileInfoEventArgs args)
 {
     this.FilteredItem?.Invoke(this, args);
 }
Exemple #26
0
 /// <summary>
 /// Event proxy for FileExtractionFinished.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The event arguments.</param>
 private void FileExtractionFinishedEventProxy(object sender, FileInfoEventArgs e)
 {
     OnEvent(FileExtractionFinished, e, true);
 }
 static void extr_FileExtractionStarted(object sender, FileInfoEventArgs e)
 {
 }
 private void Extractor_FileExtractionStarted(object sender, FileInfoEventArgs e)
 {
     _extractingfn = e.FileInfo.FileName;
     logger.Debug("Extracting " + _extractingfn);
 }
Exemple #29
0
 /// <summary>
 /// Handles the <see cref="SevenZipExtractor.FileExtractionFinished"/> event of
 /// the archive extractors.
 /// </summary>
 /// <remarks>
 /// This cancels the extraction if the user has cancelled the task. This also updates
 /// the item progress.
 /// </remarks>
 /// <param name="sender">The object that raised the event.</param>
 /// <param name="e">A <see cref="FileInfoEventArgs"/> describing the event arguments.</param>
 private void Extractor_FileExtractionFinished(object sender, FileInfoEventArgs e)
 {
     e.Cancel = Status == TaskStatus.Cancelling;
     StepItemProgress();
 }
Exemple #30
0
 /// <summary>
 /// Handles the <see cref="SevenZipExtractor.FileExtractionStarted"/> event of
 /// the archive extractors.
 /// </summary>
 /// <remarks>
 /// This cancels the extraction if the user has cancelled the task.
 /// </remarks>
 /// <param name="sender">The object that raised the event.</param>
 /// <param name="e">A <see cref="FileInfoEventArgs"/> describing the event arguments.</param>
 private void Extractor_FileExtractionStarted(object sender, FileInfoEventArgs e)
 {
     e.Cancel = Status == TaskStatus.Cancelling;
 }
Exemple #31
0
 void extr_FileExtractionStarted(object sender, FileInfoEventArgs e)
 {
     tb_Messages.Text += String.Format("Extracting \"{0}\"" + Environment.NewLine, e.FileInfo.FileName);
     tb_Messages.ScrollToEnd();
     pb_Extract2.Value += 1;
 }
Exemple #32
0
 /// <summary>
 /// szip_FileExtractionStarted
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">FileInfoEventArgs</param>
 private void Szip_FileExtractionStarted(object sender, FileInfoEventArgs e)
 {
     tosCmp = new TOSortie(100, string.Format("Extracting \"{0}\" ...", e.FileInfo.FileName), TypeTOSortie.Zip);
 }