0
votes

I have got an excel application running which on parsing the excel sheet displays a wpf window (from other project however in same workspace).

[STAThread]
        public void Run()
        {
            TableStructure = null;

            parser = new ExcelParser.WorksheetParser(TableStructure);

            GeneralTree<string> rawRBS = parser.GetRawTree();

            MainWindow main = new MainWindow(rawRBS, parser.WorkSheet);
            main.ShowDialog();
        }

The problem here is when i close the mainwindow.. closing mainwindow shuts the whole application down along with excel workbook too. I want excel workbook opened even when main window is closed.

Can someone help me here?

1
how do you open excel workbook? - Brijesh Mishra

1 Answers

0
votes

Replace main.ShowDialog() with:

var app = new Application();
app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
app.Run(main);

You should note that unless you've setup a tray icon or some other kind of UI, you'll have no way of shutting down the app (short of killing the process).