public static DialogResult SelectFile(Tasker tasker, string[] files)
        {
            if (tasker.HostForm.Disposing)
            {
                return(DialogResult.Cancel);
            }
            if (tasker.HostForm.InvokeRequired)
            {
                return((DialogResult)tasker.HostForm.Invoke(new Func <Tasker, string[], DialogResult>(SelectFile), new object[] { tasker, files }));
            }
            try
            {
                using (var form = new SelectFileForm(files))
                {
                    tasker.PushState(Tasker.State.Paused);
                    var result = form.ShowDialog();
                    tasker.PopState();
                    selectedFile = form.listBoxFiles.SelectedItem != null?form.listBoxFiles.SelectedItem.ToString() : null;

                    return(result);
                }
            }
            catch (InvalidOperationException) { }
            return(DialogResult.Cancel);
        }
Exemplo n.º 2
0
        private void editReview_Click(object sender, EventArgs e)
        {
            string path =
                $"{Directory.GetCurrentDirectory().Replace("bin\\", string.Empty).Replace("Debug", string.Empty).Replace("Release", string.Empty)}\\CodeReviews\\";
            IList <string> paths = Directory.GetFiles(path, "*.crw");

            paths = paths.Select(x => x.Replace(path, string.Empty)).ToList();

            var form = new SelectFileForm(paths, m_CodeReview);

            form.ShowDialog();
        }
Exemplo n.º 3
0
        DialogResult SelectFile(string[] files)
        {
            var form = new SelectFileForm(files);

            var result = form.ShowDialog();

            if (form.listBoxFiles.SelectedItem != null)
            {
                selectedFile = form.listBoxFiles.SelectedItem.ToString();
            }
            else
            {
                selectedFile = null;
            }

            return(result);
        }