public static void WireupDependenciesAndInitMainWindow(MainWindowAdapter mainWindow) { ISynchronizationContext invokingSynchronization = new NSInvokeSynchronization(); Properties.WebContentConfig webContentConfig = new Properties.WebContentConfig(); var model = ModelFactory.Create( new ModelConfig { WorkspacesUrl = Properties.Settings.Default.WorkspacesUrl, TelemetryUrl = Properties.Settings.Default.TelemetryUrl, IssuesUrl = Properties.Settings.Default.IssuesUrl, AutoUpdateUrl = Properties.Settings.Default.AutoUpdateUrl, PluginsUrl = Properties.Settings.Default.PluginsUrl, WebContentCacheConfig = webContentConfig, LogsDownloaderConfig = webContentConfig }, invokingSynchronization, (storageManager) => new PreprocessingCredentialsCache( mainWindow.Window, storageManager.GlobalSettingsEntry, invokingSynchronization ), (shutdown, webContentCache, traceSourceFactory) => new Presenters.WebViewTools.Presenter( new WebBrowserDownloaderWindowController(), invokingSynchronization, webContentCache, shutdown, traceSourceFactory ) ); var viewsFactory = new Presenters.ViewsFactory(mainWindow, model); mainWindow.Init(model.InstancesCounter); mainWindow.SourcesManagementControlAdapter.SourcesListControlAdapter.Init(viewsFactory); var presentation = Presenters.Factory.Create( model, new ClipboardAccess(), new ShellOpen(), new AlertPopup(), new FileDialogs(), new PromptDialogController(), new AboutDialogConfig(), new DragDropHandler( model.LogSourcesPreprocessings, model.PreprocessingStepsFactory, model.LogSourcesManager ), mainWindow, viewsFactory ); CustomURLSchemaEventsHandler.Instance.Init( presentation.MainFormPresenter, model.CommandLineHandler, invokingSynchronization ); // todo: consider not depending on mono in the system. // It's required 2 times: // 1. Formats' user code compilation // 2. Start of updater tool during auto-update var monoChecker = new MonoChecker( presentation.MainFormPresenter, presentation.AlertPopup, model.TelemetryCollector, presentation.ShellOpen ); model.PluginsManager.LoadPlugins(new Application( model.ExpensibilityEntryPoint, presentation.ExpensibilityEntryPoint, viewsFactory )); }
static Form WireupDependenciesAndCreateMainForm() { var mainForm = new UI.MainForm(); Properties.WebContentConfig webContentConfig = new Properties.WebContentConfig(); ISynchronizationContext modelSynchronizationContext = new WinFormsSynchronizationContext(mainForm); var model = ModelFactory.Create( new ModelConfig { WorkspacesUrl = Properties.Settings.Default.WorkspacesUrl, TelemetryUrl = Properties.Settings.Default.TelemetryUrl, IssuesUrl = Properties.Settings.Default.IssuesUrl, AutoUpdateUrl = Properties.Settings.Default.AutoUpdateUrl, PluginsUrl = Properties.Settings.Default.PluginsUrl, WebContentCacheConfig = webContentConfig, LogsDownloaderConfig = webContentConfig }, modelSynchronizationContext, (storageManager) => new UI.LogsPreprocessorCredentialsCache( modelSynchronizationContext, storageManager.GlobalSettingsEntry, mainForm ), (shutdown, webContentCache, traceSourceFactory) => new UI.Presenters.WebViewTools.Presenter( new UI.WebViewTools.WebBrowserDownloaderForm(), modelSynchronizationContext, webContentCache, shutdown, traceSourceFactory ) ); var viewsFactory = new UI.Presenters.ViewsFactory(mainForm, model); mainForm.sourcesListView.SourcesListView.Init(viewsFactory); var presentation = UI.Presenters.Factory.Create( model, new ClipboardAccess(model.TelemetryCollector), new ShellOpen(), new Alerts(), new Alerts(), new UI.PromptDialog.Presenter(), new AboutDialogConfig(), new DragDropHandler( model.LogSourcesManager, model.LogSourcesPreprocessings, model.PreprocessingStepsFactory ), new UI.Presenters.StaticSystemThemeDetector(UI.Presenters.ColorThemeMode.Light), viewsFactory ); var pluginEntryPoint = new Extensibility.Application( model.ExpensibilityEntryPoint, presentation.ExpensibilityEntryPoint, new Extensibility.View( mainForm, viewsFactory ) ); model.PluginsManager.LoadPlugins(pluginEntryPoint); new PluggableProtocolManager( model.TraceSourceFactory, model.InstancesCounter, model.Shutdown, model.TelemetryCollector, model.FirstStartDetector, model.LaunchUrlParser ); Telemetry.WinFormsUnhandledExceptionsReporter.Setup(model.TelemetryCollector); AppInitializer.WireUpCommandLineHandler(presentation.MainFormPresenter, model.CommandLineHandler); return(mainForm); }