public static void Main() { bugsnagClient = new Bugsnag.Client(new Bugsnag.Configuration { ApiKey = "fa43381b116de659fcf1cfda14884d98", AppVersion = Application.ProductVersion, AutoNotify = false }); // install custom handler for fatal exceptions AppDomain.CurrentDomain.UnhandledException += UnhandledException; // route UI thread exceptions to the fatal exception handler Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); RemoveOldVersionSettings(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var mainForm = new MainForm(); var tileCache = new BitmapCache(); var dialogService = new DialogService(mainForm); var featureService = new FeatureService(); var sectionsService = new SectionService(); var sectionFactory = new SectionFactory(tileCache); var sectionBitmapService = new SectionBitmapService(sectionFactory); var mapModelFactory = new MapModelFactory(tileCache); var mapLoadingService = new MapLoadingService(sectionFactory, mapModelFactory); var imageImportingService = new ImageImportService(tileCache); var model = new CoreModel(); // Unsure if I should get the SectionViews to register themselves, or pass the dispatcher the SectionViews as params mainForm.SectionView.SetModel(new SectionViewViewModel(sectionsService)); mainForm.FeatureView.SetModel(new FeatureViewViewModel(featureService)); var dispatcher = new Dispatcher( model, dialogService, sectionsService, sectionBitmapService, featureService, mapLoadingService, imageImportingService, tileCache, mainForm); mainForm.SetModel(new MainFormViewModel(model, dispatcher)); mainForm.MapViewPanel.SetModel(new MapViewViewModel(model, dispatcher, featureService)); var minimapForm = new MinimapForm(); minimapForm.Owner = mainForm; minimapForm.SetModel(new MinimapFormViewModel(model, dispatcher)); Application.Run(mainForm); }
public Dispatcher( CoreModel model, IDialogService dialogService, SectionService sectionService, SectionBitmapService sectionBitmapService, FeatureService featureService, MapLoadingService mapLoadingService, ImageImportService imageImportingService, BitmapCache tileCache, MainForm mainForm) { this.model = model; this.dialogService = dialogService; this.sectionService = sectionService; this.sectionBitmapService = sectionBitmapService; this.featureService = featureService; this.mapLoadingService = mapLoadingService; this.imageImportingService = imageImportingService; this.tileCache = tileCache; this.mainForm = mainForm; this.sectionView = mainForm.SectionView; this.featureView = mainForm.FeatureView; this.accessibleFeatures = new AccessibleFeatures(); }