public MainWindow(OrcusPluginProject orcusPluginProject, string path) { _orcusPluginProject = orcusPluginProject; _path = path; InitializeComponent(); OrcusPluginStudioSettings.LoadSettings(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var p = new FluentCommandLineParser <CommandLineSettings> { IsCaseSensitive = false }; p.Setup(x => x.Project).As('p', "Project"); p.Setup(x => x.Compile).As('c', "Compile"); var result = p.Parse(Environment.GetCommandLineArgs()); if (result.HasErrors) { MessageBox.Show(result.ErrorText, "Command Line Parser", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(-1); } AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve; OrcusPluginProject pluginProject = null; if (!string.IsNullOrEmpty(p.Object.Project)) { var pluginFile = new FileInfo(p.Object.Project); if (pluginFile.Exists) { try { pluginProject = OrcusPluginProjectUtilities.LoadPluginProject(p.Object.Project); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Project could not be loaded", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(-1); } if (!string.IsNullOrEmpty(p.Object.Compile)) { try { Builder.BuildPlugin(pluginProject, p.Object.Compile); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Build", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(-1); } Environment.Exit(0); } } } new MainWindow(pluginProject, p.Object.Project).Show(); }
public MainViewModel(OrcusPluginProject project, string path) { _path = path; PluginProject = project; RequireTwoLibraries = project.PluginType == PluginType.CommandFactory || project.PluginType == PluginType.CommandView; if (!string.IsNullOrEmpty(project.ThumbnailPath) && File.Exists(project.ThumbnailPath)) { ThumbnailImage = new BitmapImage(new Uri(project.ThumbnailPath, UriKind.Absolute)); } if (!string.IsNullOrEmpty(project.Library1Path)) { _library1Watcher = new LibraryWatcher(project.Library1Path); _library1Watcher.ReloadFile += LibraryWatcher_ReloadFile; } if (RequireTwoLibraries && !string.IsNullOrEmpty(project.Library2Path)) { _library2Watcher = new LibraryWatcher(project.Library2Path); _library2Watcher.ReloadFile += LibraryWatcher_ReloadFile; } ReloadTest(); }