Пример #1
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            Application.Current.DispatcherUnhandledException += UnhandledExceptionHndlr.OnCurrentDispatcherUnhandledException;
            EventManager.RegisterClassHandler(typeof(TextBox), UIElement.GotFocusEvent, new RoutedEventHandler((s, re) => { (s as TextBox)?.SelectAll(); })); //tu: TextBox
            //2020Feb SetupTracingOptions("AAV.VPC", new TraceSwitch("OnlyUsedWhenInConfig", "This is the trace for all               messages... but who cares?   See ScrSvr for a model.") { Level = TraceLevel.Verbose });
            //DevOp.TestIsoAccessibilty("VPC");

            base.OnStartup(e);

            //var version = //System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();			////System.Deployment.			//Application.ApplicationDeployment.CurrentDeployment.CurrentVersion;			//dbIni();

            init0(e, _view = new MainPlayerWindow {
                DataContext = new VPViewModel()
            });                                                                   // OnStartup_Simple(e);

            saveSettings(_view, _viewModel.PlayerMargin);

            await Task.Delay(222);

            Current.Shutdown();
        }
Пример #2
0
        //void OnStartup_Unity(StartupEventArgs e)
        //{
        //  IUnityContainer container = new UnityContainer();
        //  container.RegisterType<IVPViewModel, VPViewModel>();      //container.RegisterType<IPerson, Person>();			//container.RegisterType<ICustomer, Customer>();

        //  init0(e, container.Resolve<MainPlayerWindow>());
        //}

        void init0(StartupEventArgs args, MainPlayerWindow vw)
        {
            _viewModel            = vw.DataContext as VPViewModel;
            _viewModel.Player     = vw.wmp;
            _viewModel.Window     = vw;
            _viewModel.LayoutRoot = vw.LayoutRoot;
            _viewModel.Fvc        = vw.fuc;
            //closeEvent(window, _viewModel);

            //if (!string.IsNullOrEmpty(Settings.Default.AppSetting))
            //{
            //  _settings = Serializer.LoadFromString<AppSettings>(Settings.Default.AppSetting) as AppSettings;
            //  //vw.Left = _settings.windowLeft;
            //  //vw.Top = _settings.windowTop;
            //  //vw.Width = _settings.windowWidth;
            //  //vw.Height = _settings.windowHeight;
            //  _viewModel.PlayerMargin = _settings.PlayerMargin;
            //}

            autoPlay(args, _viewModel);

            BindableBaseViewModel.ShowModalMvvm(_viewModel, vw); // window.ShowDialog();
        }