Exemplo n.º 1
0
        private async void SelectRowDataExcelButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Multiselect      = false;
            fd.CheckFileExists  = true;
            fd.RestoreDirectory = true;
            fd.InitialDirectory = "D:\\孙思杰\\桌面\\女王大人の任务\\花王\\新建文件夹";
            if (fd.ShowDialog() == DialogResult.OK)
            {
                statusLabel.Text = "正在读取数据";
                string filename = fd.FileName;
                bool   success  = false;
                try
                {
                    consumerPanelList = await ConsumerPanel.ReadConsumerPanelsAsync(app, filename);

                    summaryPanelList = await SummaryPanel.ReadSummaryPanelsAsync(app, filename);

                    filePath = filename;
                    success  = true;
                }
                catch (Exception exc)
                {
                    statusLabel.Text = "失败:" + exc.Message;
                    Trace.TraceError(exc.ToString());
                }
                if (success)
                {
                    statusLabel.Text            = "读取成功";
                    OutputModelButton.Enabled   = true;
                    OutputSummaryButton.Enabled = true;
                }
            }
            ;
        }