示例#1
0
        private void btn_load_Click(object sender, EventArgs e)
        {
            if (binding == null)
            {
                return;
            }

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
            ofd.Filter           = binding.Filter;
            ofd.FilterIndex      = 2;
            ofd.Multiselect      = false;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var filepath = ofd.FileName;
                binding.SetAbsolutePath(filepath);

                System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(filepath));
            }
            else
            {
                return;
            }

            Read();
        }
示例#2
0
        private void Path_DragDrop(object sender, DragEventArgs e)
        {
            string filePath = GetDragFile(e);

            if (filePath != null)
            {
                if (CheckExtension(filePath))
                {
                    binding.SetAbsolutePath(filePath);
                    Read();
                }
            }
        }