Exemple #1
0
        public JiraUploader(string pk, List <Issue> _issuesJira, List <IssueBCF> i, string p, int pi, bool _delAfter)
        {
            //initialize
            projectKey = pk;
            issuesJira = _issuesJira;
            issues     = i;
            path       = p;
            projIndex  = pi;
            delAfter   = _delAfter;

            progressWin.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            progressWin.Show();
            progressWin.SetProgress(0, getProgressString(0));
            progressWin.killWorker += new EventHandler(worker_Kill);
            //bg worker


            worker.WorkerReportsProgress      = true;
            worker.WorkerSupportsCancellation = true;
            worker.DoWork             += new DoWorkEventHandler(worker_DoWork);
            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            worker.ProgressChanged    += new ProgressChangedEventHandler(worker_ProgressChanged);
            worker.RunWorkerAsync();
            worker.Dispose();
        }
Exemple #2
0
 public void initializeProgressWin(int totalNumOfElements)
 {
     progressWin = new ProgressWin();
     progressWin.WindowStartupLocation = WindowStartupLocation.CenterScreen;
     progressWin.SetProgress(0, string.Format("Finding elements 0/{0}", totalNumOfElements));
     progressWin.killWorker += cancelExternalEvent;
     progressWin.Show();
 }
Exemple #3
0
    public void ShowProgress()
    {
        _proressWindow.Show();
        _proressWindow.SetPercents(0, 0, 0, _processStartedAt);

        while (_processthread != null && _processthread.IsAlive)
        {
            if (_proressWindow.AbortRequest)
            {
                if (SupportMethods.RunningPlatform == SupportMethods.RunningPlatformEnum.Unix)
                {
                    SupportMethods.ExecuteAndReturnOutput("killall", "ffmpeg");
                }
                else
                {
                    SupportMethods.ExecuteAndReturnOutput("taskkill", "/f /im ffmpeg.exe");
                }
                _processAbortRequest = true;
            }

            var percentsCurrentFilePass = 0d;
            var percentsCurrentFile     = 0d;
            var percentsTotal           = 0d;

            var fName              = String.Empty;
            var passAsString       = String.Empty;
            var totalFilesAsString = String.Empty;

            if (_currentConvertingMovie != null && _currentPass > 0)
            {
                decimal totalTime = _currentConvertingMovie.DurationMS / 1000m;
                percentsCurrentFile = 0;
                fName = System.IO.Path.GetFileName(_currentConvertingMovie.FileName);

                if (_currentConvertingMovie.FirstVideoTrack != null)
                {
                    decimal time = MediaInfoBase.GetLastTimeFromConvertLogFile(_outputFile);

                    if (time > 0)
                    {
                        percentsCurrentFilePass = percentsCurrentFile = Convert.ToDouble(time / (totalTime / 100m));
                        percentsCurrentFile     = percentsCurrentFilePass / 2;
                        percentsCurrentFile    += (_currentPass - 1) * 50;
                    }

                    /*
                     * var frames = Convert.ToDouble (_currentConvertingMovie.DurationMS / 1000m * _currentConvertingMovie.FirstVideoTrack.FrameRate);
                     *
                     * // detecting progress from text file
                     * var lastFrame = MediaInfoBase.GetLastFrameFromConvertLogFile (_outputFile);
                     * if ((frames > 0) && (lastFrame != -1))
                     * {
                     *      percentsCurrentFilePass = Convert.ToInt32 (lastFrame / (frames / (double)100));
                     * }
                     *
                     * // computing current file progress
                     * if (_currentPass > 0)
                     * {
                     *
                     *      var correctedFrame = lastFrame;
                     *      if (correctedFrame < 0)
                     *              correctedFrame = 0;
                     *
                     *
                     *      passAsString = "Pass: "******"/" + (_currentFileListCount).ToString();

                    // adding actual file progress fraction
                    if (percentsCurrentFile > 0)
                    {
                        var onePart = 1d / (double)_currentFileListCount;
                        percentsTotal = percentsTotal + percentsCurrentFile * onePart;
                    }
                }

                _proressWindow.SetPercents(Math.Round(percentsTotal, 2),
                                           Math.Round(percentsCurrentFile, 2),
                                           Math.Round(percentsCurrentFilePass, 2),
                                           _processStartedAt,
                                           fName,
                                           passAsString,
                                           totalFilesAsString);

                while (GLib.MainContext.Iteration())
                {
                    ;
                }
                Thread.Sleep(500);
            }
        }

        _proressWindow.SetPercents(100,
                                   100,
                                   100,
                                   _processStartedAt);
    }