protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); //System.Threading.Thread.Sleep(1 * 1000); //System.Diagnostics.Debugger.Launch(); //System.Diagnostics.Debugger.Break(); string cscsScript = e.Args.Length == 0 ? GetConfiguration("CSCS_Init", "../../scripts/defaultWindow.cscs") : e.Args[0]; var pathName = Path.GetFullPath(cscsScript); if (!File.Exists(pathName)) { MessageBox.Show("File " + pathName + " doesn't exist.", "Invalid file path", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(1); } //cscsScript = "../../scripts/start.cscs"; Console.WriteLine("Running CSCS script: " + pathName); CSCS_SQL.Init(); try { CSCS_GUI.RunScript(pathName); } catch (Exception exc) { MessageBox.Show("Error running " + pathName + ": " + exc.Message, "Error running script", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(1); } //StartupUri = new Uri("../MainWindow.xaml", UriKind.Relative); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CSCS_SQL.Init(); CSCS_GUI.TheForm = new Form1(); CSCS_GUI.RunScript("../../scripts/start.cscs"); Application.Run(CSCS_GUI.TheForm); }
void MainView_Loaded(object sender, RoutedEventArgs e) { CSCS_SQL.Init(); CSCS_GUI.MainWindow = this; CSCS_GUI.AddActions(CSCS_GUI.MainWindow, true); var win = NewWindowFunction.CreateNew("../../scripts/Sample.xaml"); CSCS_GUI.AddActions(win.Instance, true); var res = this.Resources; var cscsScript = (string)res["CSCS"]; //CSCS_GUI.MainWindow.Tag = "MainWindow"; Console.WriteLine("Running CSCS script: " + cscsScript); CSCS_GUI.RunScript(cscsScript); CSCS_GUI.MainWindow = this; /*string[] cmdArgs = Environment.GetCommandLineArgs(); * if (cmdArgs.Length <= 2) * { * CSCS_GUI.RunScript(cscsScript); * return; * } * * var cmdLineParams = cmdArgs[2].Split(new char[] { ',' }); * var scriptName = cmdLineParams[0]; * /*string msg = "StartArgs:"; * for (int i = 0; i < cmdArgs.Length; i++) * { * msg += " [" + cmdArgs[i] + "]"; * } * msg += " Script: [" + scriptName + "]"; * MessageBox.Show(msg, cmdArgs.Length + " args", MessageBoxButton.OK, MessageBoxImage.Asterisk);*/ //CSCS_GUI.RunScript("../../scripts/" + scriptName); }