示例#1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var container = new CompositionContainer(
                new AggregateCatalog(
                    new AssemblyCatalog(Assembly.GetExecutingAssembly()),
                    new AssemblyCatalog(typeof(IDialogService).Assembly)));

            var defaults = new UIServicesDefaults();

            container.ComposeExportedValue(container);
            container.ComposeExportedValue(defaults.DialogService);
            container.ComposeExportedValue(defaults.FileDialogService);
            container.ComposeExportedValue(defaults.MessageBoxService);

            var vm  = _mainViewModel = container.GetExportedValue <MainViewModel>();
            var win = new MainWindow {
                DataContext = vm
            };

            win.Show();
            if (e.Args.Length > 0)
            {
                vm.OpenInternal(e.Args[0], false);
            }
        }
示例#2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var ui  = new UIServicesDefaults();
            var vm  = new MainViewModel(ui);
            var win = new MainWindow {
                DataContext = vm
            };

            win.Show();
            ui.MessageBoxService.SetOwner(win);
        }
示例#3
0
        public void InitTray()
        {
            var ui = new UIServicesDefaults();

            _tray = Application.Current.FindResource("TrayIcon") as TaskbarIcon;
            var vm = new TaskbarIconViewModel(this, ui);

            _tray.DataContext = vm;

            TaskbarIcon.SetParentTaskbarIcon(Application.Current.MainWindow, _tray);
        }
示例#4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var ui  = new UIServicesDefaults();
            var vm  = new MainViewModel(ui);
            var win = new MainWindow {
                DataContext = vm
            };

            win.Show();
        }
示例#5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            IUIServices ui  = new UIServicesDefaults();
            var         win = new MainWindow();

            ui.MessageBoxService.SetOwner(win);
            _mainViewModel  = new MainViewModel(ui);
            win.DataContext = _mainViewModel;
            win.Show();
        }
示例#6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;

            var ui  = new UIServicesDefaults();
            var vm  = new MainViewModel(ui);
            var win = new MainWindow {
                DataContext = vm
            };

            ui.MessageBoxService.SetOwner(win);

            win.Show();
        }
示例#7
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var ui = new UIServicesDefaults();

            MainViewModel = new MainViewModel(ui);
            var win = new MainWindow {
                DataContext = MainViewModel
            };

            win.Show();
            ui.MessageBoxService.SetOwner(win);

            //SfSkinManager.ApplyStylesOnApplication = true;
            //SfSkinManager.SetVisualStyle(win, VisualStyles.Metro);
        }
示例#8
0
        public App()
        {
            var container = new CompositionContainer(
                new AggregateCatalog(
                    new AssemblyCatalog(typeof(IFileDialogService).Assembly),
                    new AssemblyCatalog(typeof(IWindow).Assembly),
                    new AssemblyCatalog(Assembly.GetExecutingAssembly())));

            var defaults = new UIServicesDefaults();

            container.ComposeExportedValue(defaults.DialogService);
            container.ComposeExportedValue(defaults.FileDialogService);
            container.ComposeExportedValue(defaults.MessageBoxService);
            container.ComposeExportedValue(container);

            var appManager = container.GetExportedValue <AppManager>();
        }
示例#9
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var ui = new UIServicesDefaults();

            MainViewModel = new MainViewModel(ui);
            var win = new MainWindow {
                DataContext = MainViewModel
            };

            win.Show();
            ui.MessageBoxService.SetOwner(win);

            DispatcherUnhandledException += (s, args) => {
                MainViewModel.Dispose();

                ui.MessageBoxService.ShowMessage($"Unhandled exception: {args.Exception.Message}. Exiting", App.Title);
                Shutdown(1);
            };
        }
示例#10
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Catalog = new AggregateCatalog(
                new AssemblyCatalog(Assembly.GetExecutingAssembly()),
                new DirectoryCatalog(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.modules.*.dll"));

            Container = new CompositionContainer(Catalog);
            var ui = new UIServicesDefaults();

            Container.ComposeExportedValue <IUIServices>(ui);
            Container.ComposeExportedValue(Container);
            var vm  = Container.GetExportedValue <MainViewModel>();
            var win = new MainWindow {
                DataContext = vm
            };

            win.Show();
            ui.MessageBoxService.SetOwner(win);
        }