public ArchProcessForm(Form1 mainForm, int totalRecords, bool isRecovery, List <PawnDocRegVO> dataList)
        {
            this.FormClosing += new FormClosingEventHandler(this.MainForm_FormClosing);
            this.mainForm     = mainForm;
            //this.CenterToParent();
            this.dataList         = dataList;
            this.StartPosition    = FormStartPosition.CenterScreen;
            this.mainForm.Enabled = false;
            InitializeComponent();
            XmlConfigurator.Configure();
            this.ControlBox = false;
            this.Show();
            var sH = new BgWorkerJobAllocationEventHandler(this, totalRecords);

            this.backgroundWorker1.ProgressChanged           += sH.BackgroundWorkerForGetDocsProgressChanged;
            this.backgroundWorker1.DoWork                    += sH.BackgroundWorkerForGetDocsDoWork;
            this.backgroundWorker1.RunWorkerCompleted        += sH.BgWorkGetDocsCompleted;
            this.backgroundWorker1.WorkerReportsProgress      = true;
            this.backgroundWorker1.WorkerSupportsCancellation = true;
            initProgBar();
            if (isRecovery)
            {
                this.backgroundWorker1.RunWorkerAsync(1);
            }
            else
            {
                this.backgroundWorker1.RunWorkerAsync(0);
            }
            this.toolStripProgressBar1.Text    = "In Progress...";
            this.toolStripProgressBar1.Visible = true;
            //this.startButton.Enabled = false;
            this.exitButton.Enabled = false;
        }
Ejemplo n.º 2
0
        public JobAllocationHandlerMain(ArchProcessForm mainForm, BackgroundWorker worker, DoWorkEventArgs e,
                                        BgWorkerJobAllocationEventHandler _jobAllocationEventHandler, int totalRecords, bool isRecovery)
        {
            this.mainForm = mainForm;
            this.worker   = worker;
            this.e        = e;
            this._jobAllocationEventHandler = _jobAllocationEventHandler;
            archDocIndex    = 0;
            this.totalCount = totalRecords;
            this.isRecovery = isRecovery;

            srcCouchVO    = this.mainForm.getMainForm().getSourceCouch();
            targetCouchVO = this.mainForm.getMainForm().getTargetCouch();
            //maxAllowedThread = noOfThreads - 20;
            //maxAllowedThread = noOfThreads + 10;
            if (Properties.Settings.Default.MaxThreads != 0)
            {
                noOfThreads = Properties.Settings.Default.MaxThreads;
            }

            if (Properties.Settings.Default.MaxAllowedMemory != 0)
            {
                maxAllowedMemory = Properties.Settings.Default.MaxAllowedMemory;
            }

            log.Info("Max process threads: " + noOfThreads);
            log.Info("Max Threads Allowed including sys threads: " + noOfThreads + 20);
        }
 //duplicate ell
 //private int duplCount=0;
 //private Dictionary<int, string> filteredDocDict = new Dictionary<int, string>();
 //duplicate ell
 public JobAllocationHandler(ArchProcessForm mainForm, BackgroundWorker worker,
                             DoWorkEventArgs e, BgWorkerJobAllocationEventHandler _jobAllocationEventHandler, int totalRecords, bool isRecovery)
 {
     this.mainForm = mainForm;
     this.worker   = worker;
     this.e        = e;
     this._jobAllocationEventHandler = _jobAllocationEventHandler;
     archDocIndex    = 0;
     this.totalCount = totalRecords;
     this.isRecovery = isRecovery;
 }