Beispiel #1
0
 public Constant()
 {
     //
     // TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼­
     //
     WaitingForm = new WaitingForm();
     if (m_RunPath.Trim().Length == 0)
     {
         m_RunPath = System.Environment.CurrentDirectory;
     }
 }
Beispiel #2
0
        public static void ExportGrid2Excel(System.Windows.Forms.Form Form,
                                            Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter ExcelExporter,
                                            Infragistics.Win.UltraWinGrid.UltraGrid Grid)
        {
            Cursor oldCursor = Form.Cursor;

            Form.Cursor = Cursors.WaitCursor;

            if (Constant.WaitingForm == null)
            {
                Constant.WaitingForm = new WaitingForm();
            }

            Constant.WaitingForm.ShowToUser = true;
            Constant.WaitingForm.Show();
            Constant.WaitingForm.Update();

            try
            {
                if (!System.IO.Directory.Exists(System.Environment.CurrentDirectory + "\\temp"))
                {
                    System.IO.Directory.CreateDirectory(System.Environment.CurrentDirectory + "\\temp");
                }

                string StrfileName = string.Format(System.Environment.CurrentDirectory + "\\temp\\" + Form.Text + ".xls");
                ExcelExporter.Export(Grid, StrfileName);

                ProcessStartInfo p = new ProcessStartInfo(StrfileName);
                p.WorkingDirectory = Path.GetDirectoryName(StrfileName);
                Process.Start(p);

                Form.Cursor = oldCursor;
                Constant.WaitingForm.ShowToUser = false;
                Constant.WaitingForm.Close();
            }
            catch (Exception ex)
            {
                Form.Cursor = oldCursor;
                Constant.WaitingForm.ShowToUser = false;
                Constant.WaitingForm.Close();
                MessageBox.Show(ex.Message);
            }
        }