Example #1
0
        public void SearchAA(FindAsync f, string dName)
        {
            f.Close();

            string data = f.DATA;
            double time = f.TIME;

            if (data != null)
            {
                string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                              Path.DirectorySeparatorChar + Path.GetFileName(dName) + "_LICHNYE_DANNIE" + @".txt";
                using (StreamWriter file = new StreamWriter(path, false, Encoding.UTF8)) {
                    file.WriteLine(data);
                }
                MessageBox.Show("Готово!\nВремя поиска: " + time + " секунд");
            }
        }
Example #2
0
        private void WhichSearch(string path, StreamWriter file)
        {
            WhichFindPD window = new WhichFindPD();
            string      which;

            if (window.ShowDialog() == DialogResult.OK)
            {
                which = window.ITEM;
                switch (which)
                {
                case "Thread": {
                    SearhThread(path, file);
                    break;
                }

                case "Parallel.ForEach": {
                    SearcParallelForEach(path, file);
                    break;
                }

                case "Tasks": {
                    SearchTasks(path, file);
                    break;
                }

                case "Async/await": {
                    FindAsync wind = new FindAsync(this, path);
                    wind.Show();
                    wind.Start(path, file);
                    break;
                }

                default:
                    break;
                }
            }
        }