Example #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            MainWindow win;

            //Start with commandline parameters
            if (e.Args.Any() && e.Args.First().EndsWith(".xml"))
            {
                string fileName = Path.ChangeExtension(e.Args[0], null);
                string patchFile = e.Args.Count() > 1 ? e.Args[1] : fileName + "-patch.xml";
                string reportFile = e.Args.Count() > 2 ? e.Args[2] : fileName + "-report.xml";
                win = new MainWindow(e.Args[0], patchFile, reportFile);

            }
             			//Start without parameters
            else
            {
                OpenDlgWindow opendWin = new OpenDlgWindow();
                while (!File.Exists(opendWin.Dump))
                {
                    opendWin = new OpenDlgWindow();
                    bool? result = opendWin.ShowDialog();
                    if(result==false)
                    {
                        Shutdown();
                        return;
                    }

                }
                win = new MainWindow(opendWin.Dump,opendWin.Patch,opendWin.Report);
            }

            win.ShowDialog();

            if ((win.dumpChanged || win.patchChanged || win.reportChanged)
                && MessageBox.Show("Save changes?","Something changed",MessageBoxButton.YesNo,MessageBoxImage.Question)==MessageBoxResult.Yes)
            {
                win.SaveAll(null,null);
            }

            Shutdown();
        }
 private void ShowOpenDialog(object sender, RoutedEventArgs e)
 {
     var dialog = new OpenDlgWindow();
     dialog.ShowDialog();
     LoadTree(dialog.Dump, dialog.Patch, dialog.Report);
     dumpFile = dialog.Dump;
     reportFile = dialog.Report;
     patchFile = dialog.Patch;
 }