void uploadFile(object obj)
        {
            ImportStudentSelectionWindow window = obj as ImportStudentSelectionWindow;

            // 上传文件
            System.Windows.Forms.OpenFileDialog open = new System.Windows.Forms.OpenFileDialog();
            //openFileDialog1.InitialDirectory = "c:\\";
            open.Filter           = "Microsoft Excel files(*.xls)|*.xls;*.xlsx";
            open.FilterIndex      = 1;
            open.RestoreDirectory = true;
            open.AddExtension     = true;
            open.CheckFileExists  = true;
            open.CheckPathExists  = true;
            open.ShowHelp         = true;

            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var excelResult = NPOIClass.ExcelToDataTable(open.FileName, false);
                if (excelResult.Item1 == null)
                {
                    this.ShowDialog("提示信息", excelResult.Item2, CustomControl.Enums.DialogSettingType.OnlyOkButton, CustomControl.Enums.DialogType.Error);
                    return;
                }
                else
                {
                    window.DT           = excelResult.Item1;
                    window.DialogResult = true;
                }
            }
        }
Пример #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.main = ((OSKernel.Presentation.Arranging.Mixed.Dialog.ImportStudentSelectionWindow)(target));
                return;

            case 2:

            #line 27 "..\..\..\..\Mixed\Dialog\ImportStudentSelectionWindow.xaml"
                ((System.Windows.Controls.Grid)(target)).Drop += new System.Windows.DragEventHandler(this.Grid_Drop);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }