Beispiel #1
0
        static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Connecting the Calculator UI to the Calculator Operations Methods
            DIAdapter.PlugAdapter();
            ISimpleCalcRepository res = DIAdapter.IAdapter;

            Application.Run(new CalculatorUI(res));
        }
        protected override void OnStartup([CanBeNull] StartupEventArgs e)
        {
            base.OnStartup(e);

            VisualComposition.Trace += (sender, args) => Trace.WriteLine(args.Text);
            BindingErrorTracer.Start(BindingErrorCallback);

            _diAdapter = new DIAdapter();

            var exportProvider = _diAdapter.Initialize();

            Resources.MergedDictionaries.Insert(0, WpfStyles.GetDefaultStyles().RegisterDefaultWindowStyle());
            Resources.MergedDictionaries.Add(DataTemplateManager.CreateDynamicDataTemplates(exportProvider));

            var mainWindow = exportProvider.GetExportedValue <MainWindow>();

            MainWindow = mainWindow;

            mainWindow.Show();
        }