public IEnumerable <IResult> Load(Action onloaded) { if (!persistanceManager.Load()) { var message = result.ShowMessageBox("Cockpitbuilder settings are corrupted", "Continuing your use of the program will reset it to default settings. Continue anyway?", MessageBoxButton.OKCancel); yield return(message); if (message.Result == MessageBoxResult.Cancel) { yield return(result.CloseApp()); } } onloaded(); }
public MainShellViewModel(IResultFactory resultFactory, IEventAggregator eventAggregator, IPersistanceManager persistanceManager, ISettingsManager settingsManager, MainMenuViewModel mainMenuViewModel, ScriptEditorViewModel scriptEditorViewModel, OutputViewModel outputViewModel) : base(resultFactory) { persistanceManager.Load(); this.eventAggregator = eventAggregator; eventAggregator.Subscribe(this); this.persistanceManager = persistanceManager; Menu = mainMenuViewModel; Menu.Plugins = settingsManager.ListConfigurablePluginSettings().Select(ps => new PluginSettingsMenuViewModel(ps)); ScriptEditor = scriptEditorViewModel; Output = outputViewModel; DisplayName = "FreePIE - Programmable Input Emulator"; }
public void Start(string[] args) { try { string script = null; if (args.Length == 0) { PrintHelp(); return; } try { script = fileSystem.ReadAllText(args[0]); } catch (IOException) { System.Console.WriteLine("Can't open script file"); throw; } System.Console.TreatControlCAsInput = false; System.Console.CancelKeyPress += (s, e) => Stop(); persistanceManager.Load(); System.Console.WriteLine("Starting script parser"); scriptEngine.Start(script, args[0]); waitUntilStopped.WaitOne(); } catch (Exception e) { System.Console.WriteLine(e); } }