Esempio n. 1
0
 private void mergeAnotherLoadedSet_Click(object sender, EventArgs e)
 {
     loadinList(true);
     list.addList(tempLoadList);
     tempLoadList = null;
     PrintToExcelSheets.printDataSetToExcel(workbook, list, sheetNumber++);
     readData.Enabled = true;
 }
Esempio n. 2
0
        private void loadinList(bool alreadyLoadedOne)
        {
            OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
            folderBrowserDialog.Description = "Select the directory that you want to use as the default.";
            folderBrowserDialog.ShowNewFolderButton = false;
            openFileDialog.DefaultExt = "osl";
            openFileDialog.Filter = "osl files (*.osl)|*.osl";
            folderBrowserDialog.RootFolder = Environment.SpecialFolder.Personal;
            openFileDialog.InitialDirectory = folderBrowserDialog.SelectedPath;
            openFileDialog.FileName = null;
            DialogResult result = openFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                string openFileName = openFileDialog.FileName;
                try
                {

                    Stream stream = File.Open(openFileName, FileMode.Open);
                    BinaryFormatter bformatter = new BinaryFormatter();
                    if (!alreadyLoadedOne)
                    {
                        list = (ListSerializableDataStruct)bformatter.Deserialize(stream);
                    }
                    else
                        tempLoadList = (ListSerializableDataStruct)bformatter.Deserialize(stream);
                    stream.Close();

                }
                catch (Exception exp)
                {
                    MessageBox.Show("An error occurred while attempting to load the file. The error is:"
                                    + System.Environment.NewLine + exp.ToString() + System.Environment.NewLine);
                }
                Invalidate();

            }

            // Cancel button was pressed. 
            else if (result == DialogResult.Cancel)
            {
                return;
            }
            if (!alreadyLoadedOne)
                PrintToExcelSheets.printDataSetToExcel(workbook, list, sheetNumber++);
        }
Esempio n. 3
0
 private void mergeDataSets_Click(object sender, EventArgs e)
 {
     list.addList(ProcessExcelData.getDataSet(sheet.UsedRange, workbook));
     PrintToExcelSheets.printDataSetToExcel(workbook, list, sheetNumber++);
     readData.Enabled = true;
 }