コード例 #1
0
        void backgroundWorkerLoader_DoWorkJustAddToList(object sender, DoWorkEventArgs e)
        {
            AddFoundPatientCallback d = new AddFoundPatientCallback(AddFoundPatient);

            OnSetStatusLabelValue("Processing Patients...");
            for (int i = 0; i < _listViewItems.Count; i++)
            {
                this.Invoke(d, new object[] { _listViewItems[i] });
                OnSetProgressBarValue(i * 100 / _listViewItems.Count);
            }
        }
コード例 #2
0
        void backgroundWorkerLoader_DoWork(object sender, DoWorkEventArgs e)
        {
            AddFoundPatientCallback d = new AddFoundPatientCallback(AddFoundPatient);

            OnSetStatusLabelValue("Loading Patients From Server...");

            for (int j = 0; j < _Remote_Data_Manager.PatientList.Count; j++)
            {
                _listViewItems.Add(GenerateListViewPatientItem(_Remote_Data_Manager.PatientList[j], j));
                OnSetProgressBarValue(j * 100 / _Remote_Data_Manager.PatientList.Count);
            }


            OnSetStatusLabelValue("Processing Patients...");
            for (int i = 0; i < _listViewItems.Count; i++)
            {
                this.Invoke(d, new object[] { _listViewItems[i] });
                OnSetProgressBarValue(i * 100 / _listViewItems.Count);
            }
        }
コード例 #3
0
        void backgroundWorkerSearcher_DoWork(object sender, DoWorkEventArgs e)
        {
            OnSetStatusLabelValue("Searching...");
            this.listViewPatients.ListViewItemSorter = null;
            AddFoundPatientCallback d     = new AddFoundPatientCallback(AddFoundPatient);
            List <ListViewItem>     _temp = new List <ListViewItem>();


            //build up the search terms
            string split = " ";

            string[]      initialSsearchTerms = textBoxSearch.Text.Split(split.ToCharArray());
            List <string> tempSearchTerms     = new List <string>();
            string        tempSearchTerm      = "";
            Postcode      postcode            = new Postcode();

            //check all but the last for a post code
            for (int i = 0; i < initialSsearchTerms.Length - 1; i++)
            {
                //If its a valid
                if (Postcode.TryParse(initialSsearchTerms[i] + initialSsearchTerms[i + 1], out postcode, true))
                {
                    tempSearchTerm = initialSsearchTerms[i] + " " + initialSsearchTerms[i + 1];
                    i++;
                }
                else
                {
                    tempSearchTerm = initialSsearchTerms[i];
                }
                tempSearchTerms.Add(tempSearchTerm);
            }
            //if a post code has not been found the add the last term
            if (postcode.InCode == null)
            {
                tempSearchTerm = initialSsearchTerms[initialSsearchTerms.Length - 1];
                tempSearchTerms.Add(tempSearchTerm);
            }
            else if (!postcode.InCode.StartsWith(initialSsearchTerms[initialSsearchTerms.Length - 1])) // if one has been found but doesn't match then add last term
            {
                tempSearchTerm = initialSsearchTerms[initialSsearchTerms.Length - 1];
                tempSearchTerms.Add(tempSearchTerm);
            }
            string[] searchTerms = tempSearchTerms.ToArray();


            //search for the terms, each term has to be found in an item
            bool matchedTerm = false;

            for (int i = 0; i < _listViewItems.Count; i++)
            {
                foreach (string term in searchTerms)
                {
                    matchedTerm = false;
                    for (int j = 0; j < _listViewItems[i].SubItems.Count; j++)
                    {
                        if (_listViewItems[i].SubItems[j].Text.StartsWith(term))
                        {
                            matchedTerm = true;
                        }
                    }
                    if (!matchedTerm)
                    {
                        break;
                    }
                }
                if (matchedTerm)
                {
                    this.Invoke(d, new object[] { _listViewItems[i] });
                    OnSetProgressBarValue(i * 100 / _listViewItems.Count);
                }
            }
        }
コード例 #4
0
        void backgroundWorkerSearcher_DoWork(object sender, DoWorkEventArgs e)
        {
            OnSetStatusLabelValue("Searching...");
            this.listViewPatients.ListViewItemSorter = null;
            AddFoundPatientCallback d = new AddFoundPatientCallback(AddFoundPatient);
            List<ListViewItem> _temp = new List<ListViewItem>();


            //build up the search terms
            string split = " ";
            string[] initialSsearchTerms = textBoxSearch.Text.Split(split.ToCharArray());
            List<string> tempSearchTerms = new List<string>();
            string tempSearchTerm = "";
            Postcode postcode = new Postcode();
            //check all but the last for a post code
            for (int i = 0; i < initialSsearchTerms.Length -1; i++)
            {
                //If its a valid
                if (Postcode.TryParse(initialSsearchTerms[i] + initialSsearchTerms[i + 1], out postcode, true))
                {
                    tempSearchTerm = initialSsearchTerms[i] + " "+ initialSsearchTerms[i+1];
                    i++;
                }
                else
                    tempSearchTerm = initialSsearchTerms[i];
                tempSearchTerms.Add(tempSearchTerm);
            }
            //if a post code has not been found the add the last term
            if (postcode.InCode == null)
            {
                tempSearchTerm = initialSsearchTerms[initialSsearchTerms.Length - 1];
                tempSearchTerms.Add(tempSearchTerm);
            }
            else if (!postcode.InCode.StartsWith(initialSsearchTerms[initialSsearchTerms.Length - 1])) // if one has been found but doesn't match then add last term
            {
                tempSearchTerm = initialSsearchTerms[initialSsearchTerms.Length - 1];
                tempSearchTerms.Add(tempSearchTerm);
            }
            string[] searchTerms = tempSearchTerms.ToArray();


            //search for the terms, each term has to be found in an item
            bool matchedTerm = false;
            for (int i = 0; i < _listViewItems.Count; i++)
            {
                foreach (string term in searchTerms)
                {
                    matchedTerm = false;
                    for (int j = 0; j < _listViewItems[i].SubItems.Count; j++)
                    {
                        if (_listViewItems[i].SubItems[j].Text.StartsWith(term))
                        {
                            matchedTerm = true;
                        }
                    }
                    if (!matchedTerm)
                        break;
                }
                if (matchedTerm)
                {
                    this.Invoke(d, new object[] { _listViewItems[i] });
                    OnSetProgressBarValue(i * 100 / _listViewItems.Count);
                }
                
            }
            
        }
コード例 #5
0
        void backgroundWorkerLoader_DoWorkJustAddToList(object sender, DoWorkEventArgs e)
        {

            AddFoundPatientCallback d = new AddFoundPatientCallback(AddFoundPatient);
            OnSetStatusLabelValue("Processing Patients...");
            for (int i = 0; i < _listViewItems.Count; i++)
            {
                this.Invoke(d, new object[] { _listViewItems[i] });
                OnSetProgressBarValue(i * 100 / _listViewItems.Count);
            }

        }
コード例 #6
0
        void backgroundWorkerLoader_DoWork(object sender, DoWorkEventArgs e)
        {
            AddFoundPatientCallback d = new AddFoundPatientCallback(AddFoundPatient);

            OnSetStatusLabelValue("Loading Patients From Server...");

            for (int j = 0; j < _Remote_Data_Manager.PatientList.Count; j++)
            {
                _listViewItems.Add(GenerateListViewPatientItem(_Remote_Data_Manager.PatientList[j], j));
                OnSetProgressBarValue(j * 100 / _Remote_Data_Manager.PatientList.Count);
            }


            OnSetStatusLabelValue("Processing Patients...");
            for (int i = 0; i < _listViewItems.Count; i++)
            {
                this.Invoke(d, new object[] { _listViewItems[i] });
                OnSetProgressBarValue(i * 100 / _listViewItems.Count);
            }

        }