Наследование: INotifyPropertyChanged
Пример #1
0
        public MainWindow(MainWindowModel model)
        {
            _model = model;
            this.Closing += OnClosing;

            InitializeComponent();
            this.DataContext = _model;
            var version = Assembly.GetExecutingAssembly().GetName().Version;
            _model.WindowTitle = "GTA V Eye Tracking Mod Installer " + version.Major + "." + version.Minor + "." + version.Build;
            _model.UpdateText();

            Task.Run(() =>
            {
                _model.CheckForUpdates();
            });
        }
Пример #2
0
        public MainWindow(MainWindowModel model)
        {
            _model        = model;
            this.Closing += OnClosing;

            InitializeComponent();
            this.DataContext = _model;
            var version = Assembly.GetExecutingAssembly().GetName().Version;

            _model.WindowTitle = "GTA V Eye Tracking Mod Installer " + version.Major + "." + version.Minor + "." + version.Build;
            _model.UpdateText();

            Task.Run(() =>
            {
                _model.CheckForUpdates();
            });
        }
        protected override void Run()
        {
            this.Engine.Log(LogLevel.Verbose, "Launching InstallerBootstrapperApplication");
            BootstrapperDispatcher = Dispatcher.CurrentDispatcher;

            var viewModel = new MainWindowModel(this);

            viewModel.Bootstrapper.Engine.Detect();

            Util.Log("Installer running: " + this.Command.Action + " " + this.Command.Display);
            if (this.Command.Action == LaunchAction.Uninstall && this.Command.Display == Display.Embedded)
            {
                Util.Log("viewModel.Uninstall");
                viewModel.Uninstall();
                Util.Log("BootstrapperDispatcher.InvokeShutdown");
                BootstrapperDispatcher.InvokeShutdown();
            }
            else
            {
                var view = new MainWindow(viewModel);
                view.Closed += (sender, e) =>
                {
                    Util.Log("BootstrapperDispatcher.InvokeShutdown");
                    BootstrapperDispatcher.InvokeShutdown();
                    Util.Log("Engine.Quit");
                    viewModel.Dispose();
                    Engine.Quit((int)ActionResult.Success);
                };
                Util.Log("view.Show");
                view.Show();
                Util.Log("Dispatcher.Run");
                Dispatcher.Run();
            }
            Util.Log("viewModel.Dispose");
            viewModel.Dispose();

            this.Engine.Quit((int)ActionResult.Success);
        }
        protected override void Run()
        {
            this.Engine.Log(LogLevel.Verbose, "Launching InstallerBootstrapperApplication");
            BootstrapperDispatcher = Dispatcher.CurrentDispatcher;

            var viewModel = new MainWindowModel(this);
            viewModel.Bootstrapper.Engine.Detect();

            Util.Log("Installer running: " + this.Command.Action + " " + this.Command.Display);
            if (this.Command.Action == LaunchAction.Uninstall && this.Command.Display == Display.Embedded)
            {
                Util.Log("viewModel.Uninstall");
                viewModel.Uninstall();
                Util.Log("BootstrapperDispatcher.InvokeShutdown");
                BootstrapperDispatcher.InvokeShutdown();
            }
            else
            {
                var view = new MainWindow(viewModel);
                view.Closed += (sender, e) =>
                {
                    Util.Log("BootstrapperDispatcher.InvokeShutdown");
                    BootstrapperDispatcher.InvokeShutdown();
                    Util.Log("Engine.Quit");
                    viewModel.Dispose();
                    Engine.Quit((int)ActionResult.Success);
                };
                Util.Log("view.Show");
                view.Show();
                Util.Log("Dispatcher.Run");
                Dispatcher.Run();
            }
            Util.Log("viewModel.Dispose");
            viewModel.Dispose();

            this.Engine.Quit((int)ActionResult.Success);
        }