Ejemplo n.º 1
0
        public HResult WaitForAll(bool showDialog)
        {
            try
            {
                if (showDialog)
                {
                    using (var form = new JobForm())
                    {
                        form.ShowDialog(this);
                    }

                    return(HResult.OK);
                }
                else
                {
                    Cursor.Current = Cursors.WaitCursor;

                    while (true)
                    {
                        lock (_syncRoot)
                        {
                            if (_currentJob != null)
                            {
                                OnProgressChanged(new JobEventArgs(_currentJob));
                            }

                            if (_queue.Count == 0)
                            {
                                return(HResult.OK);
                            }
                        }

                        _event.WaitOne();
                    }
                }
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
Ejemplo n.º 2
0
        public HResult WaitForAll(bool showDialog)
        {
            try
            {
                if (showDialog)
                {
                    using (var form = new JobForm())
                    {
                        form.ShowDialog(this);
                    }

                    return HResult.OK;
                }
                else
                {
                    Cursor.Current = Cursors.WaitCursor;

                    while (true)
                    {
                        lock (_syncRoot)
                        {
                            if (_currentJob != null)
                                OnProgressChanged(new JobEventArgs(_currentJob));

                            if (_queue.Count == 0)
                                return HResult.OK;
                        }

                        _event.WaitOne();
                    }
                }
            }
            catch (Exception ex)
            {
                return ErrorUtil.GetHResult(ex);
            }
        }