コード例 #1
0
        void ListUsage_BackgroundEventHandler(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            BackgroundWorker backgroundWorker = sender as BackgroundWorker;

            if (backgroundWorker.CancellationPending)
            {
                e.Cancel = true; return;
            }                                                                    //user pressed Cancel button: stop the process and allow progress indicator to set dialog result to Cancel

            for (int i = 0; i < _selectedComponents.Count; ++i)                  //run over selected components, i.e. all taxunits, all incomelists, ...
            {
                string selectedComponent = _selectedComponents.ElementAt(i).Key; //e.g. tu_household_sl, ils_dispy, ...

                if (backgroundWorker.CancellationPending)
                {
                    e.Cancel = true; return;
                }                                                                      //user pressed Cancel button

                //check wheter component (e.g. tu_household_sl, ils_dispy, ...) is used in any parameters
                CheckComponentUse componentUseChecker = new CheckComponentUse(selectedComponent, chkIgnoreIfSwitchedOff.Checked, _selectedSystemIDs);
                _mainForm.treeList.NodesIterator.DoOperation(componentUseChecker);

                foreach (UsedComponent usedComponent in componentUseChecker.GetUsedComponents())
                {                                                                                                 //store usages of component for later display in listview (see btnRun_Click): cannot be added to listview here, because listview does not belong to this thread
                    usedComponent._tag = selectedComponent + _separator + _selectedComponents.ElementAt(i).Value; //store component and its type for display
                    _usedComponenets.Add(usedComponent);
                }

                backgroundWorker.ReportProgress(Convert.ToInt32((i + 1.0) / (_selectedComponents.Count * 1.0) * 100.0));
            }
        }
コード例 #2
0
        void DoPatternSearchForSingleComponent()
        {
            if (!IsPatternSearchForSingleComponent())
            {
                return;
            }
            CheckComponentUse componentUseChecker = new CheckComponentUse(txtComponentName.Text, chkIgnoreIfSwitchedOff.Checked, _selectedSystemIDs, true);

            _mainForm.treeList.NodesIterator.DoOperation(componentUseChecker);

            foreach (UsedComponent usedComponent in componentUseChecker.GetUsedComponents())
            {
                usedComponent._tag = txtComponentName.Text + _separator + _componentType_Unknown; //store component and its type for display
                _usedComponenets.Add(usedComponent);
            }
        }