Ejemplo n.º 1
0
        public SettingsShadersPatch()
        {
            Instance = this;

            // Logging.Here();
            PatchHelper.Reload();
            KeyBindingsController = new LocalKeyBindingsController(this);

            /*InputBindings.Add(new InputBinding(new DelegateCommand(() => {
             *  Model.SelectedApp?.ViewInExplorerCommand.Execute(null);
             * }), new KeyGesture(Key.F, ModifierKeys.Control)));
             * InputBindings.Add(new InputBinding(new DelegateCommand(() => {
             *  Model.SelectedApp?.ReloadCommand.Execute(null);
             * }), new KeyGesture(Key.R, ModifierKeys.Control)));*/

            // Logging.Here();
            InitializeComponent();
            DataContext = new ViewModel();
            // Logging.Here();
            Model.MainModel.PropertyChanged += OnModelPropertyChanged;
            // Logging.Here();
            SetKeyboardInputs();
            // Logging.Here();
            UpdateConfigsTabs();
            // Logging.Here();

            InputBindings.AddRange(new[] {
                new InputBinding(Model.ShareCommand, new KeyGesture(Key.PageUp, ModifierKeys.Control)),
                new InputBinding(Model.ShareSectionCommand, new KeyGesture(Key.PageUp, ModifierKeys.Control | ModifierKeys.Shift)),
                PresetsControl != null ? new InputBinding(PresetsControl.SaveCommand, new KeyGesture(Key.S, ModifierKeys.Control)) : null
            }.NonNull().ToList());
            // Logging.Here();

            ShadersPatchEntry.InstallationStart += OnPatchInstallationStart;
            ShadersPatchEntry.InstallationEnd   += OnPatchInstallationEnd;
            // Logging.Here();

            if (PatchHelper.OptionPatchSupport)
            {
                PatchUpdater.Instance.PropertyChanged += OnPatchUpdaterPropertyChanged;
                // Logging.Here();
            }

            // Logging.Here();
            this.OnActualUnload(() => {
                Model?.Dispose();
                if (PatchHelper.OptionPatchSupport)
                {
                    PatchUpdater.Instance.PropertyChanged -= OnPatchUpdaterPropertyChanged;
                }
                Instance = null;
            });
            // Logging.Here();
        }
Ejemplo n.º 2
0
        public SettingsShadersPatch()
        {
            Instance = this;

            PatchHelper.Reload();
            KeyBindingsController = new LocalKeyBindingsController(this);

            /*InputBindings.Add(new InputBinding(new DelegateCommand(() => {
             *  Model.SelectedApp?.ViewInExplorerCommand.Execute(null);
             * }), new KeyGesture(Key.F, ModifierKeys.Control)));
             * InputBindings.Add(new InputBinding(new DelegateCommand(() => {
             *  Model.SelectedApp?.ReloadCommand.Execute(null);
             * }), new KeyGesture(Key.R, ModifierKeys.Control)));*/

            InitializeComponent();
            DataContext            = new ViewModel(false);
            Model.PropertyChanged += OnModelPropertyChanged;
            SetKeyboardInputs();
            UpdateConfigsTabs();

            ShadersPatchEntry.InstallationStart += OnPatchInstallationStart;
            ShadersPatchEntry.InstallationEnd   += OnPatchInstallationEnd;

            if (PatchHelper.OptionPatchSupport)
            {
                PatchUpdater.Instance.PropertyChanged += OnPatchUpdaterPropertyChanged;
            }

            this.OnActualUnload(() => {
                Model?.Dispose();
                if (PatchHelper.OptionPatchSupport)
                {
                    PatchUpdater.Instance.PropertyChanged -= OnPatchUpdaterPropertyChanged;
                }
                Instance = null;
            });
        }