Esempio n. 1
0
 public static void Main(String[] args)
 {
     if (args.Length == 0)
     {
         // GUI, with new empty workbook
         new WorkbookForm(new Workbook(), display: true);
         return;
     }
     if (args.Length == 1)
     {
         FileInfo fi = new FileInfo(args[0]);
         Console.WriteLine(fi);
         switch (fi.Extension)
         {
         case ".xml":                         // Attempt to open existing workbook in GUI
             Workbook wb = new WorkBookIO().Read(fi.FullName);
             if (wb != null)
             {
                 new WorkbookForm(wb, display: true);
             }
             return;
         }
     }
     Console.WriteLine("Usage: Funcalc [workbook.xml]\n");
 }
Esempio n. 2
0
        private void importSheetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd        = new OpenFileDialog();
            WorkBookIO     workbookio = new WorkBookIO();

            ofd.Filter      = workbookio.SupportedFormatFilter();
            ofd.FilterIndex = workbookio.DefaultFormatIndex();
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                Clear();
                Workbook wb = workbookio.Read(ofd.FileName);
                if (wb != null)
                {
                    SetWorkbook(wb);
                    DisplayWorkbook();
                }
            }
        }