コード例 #1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            PersonInfoDialog dialog = new PersonInfoDialog();

            dialog.Closed += Dialog_Closed;
            dialog.ShowDialog();
        }
コード例 #2
0
        private void buttonImportClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            //openFile.Filter = "Excel(*.xlsx)|*.xlsx|Excel(*.xls)|*.xls";

            //openFile.InitialDirectory = System.Windows.Forms.Application.StartupPath;

            openFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            openFile.Multiselect = false;

            openFile.RestoreDirectory = true;


            DialogResult dr = openFile.ShowDialog();


            if (dr == DialogResult.Cancel)
            {
                //var openFileDialog = new Microsoft.Win32.OpenFileDialog()
                //{
                //    Filter = "Excel Files (*.sql)|*.sql"
                //};
                //var result = openFileDialog.ShowDialog();
                //if (result == true)
                //{
                //string  aa = openFileDialog.FileName;
                //}



                return;
            }
            var filePath = openFile.FileName;
            //  var filePath = "C:\\刘坤.xls";
            string fileType = System.IO.Path.GetExtension(filePath);

            if (string.IsNullOrEmpty(fileType))
            {
                return;
            }


            PersonInfoDialog dialog = new PersonInfoDialog(filePath);

            dialog.Closed += Dialog_Closed;
            dialog.ShowDialog();
        }