Пример #1
0
        private void findToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DirectoryListFilterDialog filter_dialog = new DirectoryListFilterDialog(true);

            if (filter_dialog.ShowDialog() == DialogResult.OK)
            {
                DirectorySearchResultDialog result_dialog = new DirectorySearchResultDialog();
                result_dialog.Show();
                result_dialog.BeginSearch(filter_dialog.DirectoryListFilter);
            }
        }
Пример #2
0
        private void find_files(mFilePanel target_panel)
        {
            if (target_panel == null)
            {
                target_panel = doublePanel1.PanelActive;
            }

            DirectoryListFilterDialog filter_dialog = null;
            var filter = new DirectoryListFilter();

            filter.Load();

            if (doublePanel1.PanelActive.Source is DirectoryList)
            {
                filter.InCurrentDirectory            = true;
                filter.InCurrentDirectoryWithSubdirs = true;
                filter.CurrentDirectory = ((DirectoryList)doublePanel1.PanelActive.Source).DirectoryPath;
                filter.CurrentDrive     = Path.GetPathRoot(filter.CurrentDirectory);
            }

            filter_dialog      = new DirectoryListFilterDialog(true, filter);
            filter_dialog.Text = Options.GetLiteral(Options.LANG_FIND);
            if (filter_dialog.ShowDialog() == DialogResult.OK)
            {
                var result_dialog = new DirectorySearchResultDialog(filter_dialog.DirectoryListFilter);
                //result_dialog.BeginSearch(filter_dialog.DirectoryListFilter);
                if (result_dialog.ShowDialog() == DialogResult.OK)
                {
                    //go to...
                    var sel_file_name = result_dialog.SelectedResult;
                    if (string.IsNullOrEmpty(sel_file_name))
                    {
                        return;
                    }
                    var sel_dir  = Path.GetDirectoryName(sel_file_name);
                    var sel_file = Path.GetFileName(sel_file_name);
                    var dl       = new DirectoryList(target_panel.Source.SortCriteria, target_panel.Source.SortReverse, sel_dir);
                    target_panel.Source = dl;
                    dl.Refill();
                    var foc_index = dl.FindIndexOfName(sel_file);
                    if (foc_index != -1)
                    {
                        doublePanel1.PanelActive.FocusedIndex = foc_index;
                    }
                }
            }
        }