예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="frmAddPreset"/> class.
        /// </summary>
        /// <param name="mainWindow">
        /// The Main Window
        /// </param>
        /// <param name="presetHandler">
        /// The preset handler.
        /// </param>
        public frmAddPreset(frmMain mainWindow, PresetService presetHandler)
        {
            InitializeComponent();
            this.mainWindow = mainWindow;
            presetCode      = presetHandler;

            cb_usePictureSettings.SelectedIndex = 0;
        }
예제 #2
0
 public PresetsViewModel(PresetService presetService)
     : base(presetService)
 {
     ImportInstalledFilesCommand = new RelayCommand(ImportInstalledFiles, CanAdd);
     SyncEnabledPresetsCommand   = new RelayCommand(SyncEnabledPresets, () => Models.Any(preset => preset.IsEnabled));
     ChangeImageCommand          = new RelayCommand <Preset>(ChangeImage);
     ClearImageCommand           = new RelayCommand <Preset>(ClearImage);
     AddGlobalEnbLocalCommand    = new RelayCommand(() => _dialogService.ShowDialog(DialogName.GlobalEnbLocal), CanAdd);
     SwitchGlobalENBLocalCommand = new RelayCommand <Preset>(SwitchGlobalENBLocal);
     OpenAddENBoostPresetCommand = new RelayCommand(() => _dialogService.ShowDialog(DialogName.AddENBoostPreset));
 }
예제 #3
0
        public EditPresetViewModel(PresetService presetService, FileSystemService <Binary> binaryService)
        {
            _presetService = presetService;
            _binaryService = binaryService;
            _binaryService.ItemsChanged      += _binaryService_ItemsChanged;
            _settingsService.PropertyChanged += _settingsService_PropertyChanged;

            MessengerInstance.Register <Preset>(this, OnPresetReceived);

            ValidatedProperties = new List <string> {
                nameof(Name)
            };

            LoadBinaries();
        }
예제 #4
0
        public AddENBoostPresetViewModel(FileSystemService <Binary> binaryService, PresetService presetService)
        {
            _presetService = presetService;
            _binaryService = binaryService;
            _binaryService.ItemsChanged      += _binaryService_ItemsChanged;
            _settingsService.PropertyChanged += _settingsService_PropertyChanged;

            IsVsyncEnabled = true;

            ValidatedProperties = new List <string> {
                nameof(Name)
            };

            Binaries = new ObservableCollection <Binary>();
            LoadBinaries();
        }
예제 #5
0
        public AddPresetViewModel(PresetService presetService, FileSystemService <Binary> binaryService)
        {
            _presetService = presetService;
            _binaryService = binaryService;
            _binaryService.ItemsChanged      += _binaryService_ItemsChanged;
            _settingsService.PropertyChanged += _settingsService_PropertyChanged;

            BrowseForDirectoryCommand = new RelayCommand(BrowseForDirectory);
            BrowseForArchiveCommand   = new RelayCommand(BrowseForArchive);

            ValidatedProperties = new List <string>
            {
                nameof(Name),
                nameof(SourcePath)
            };

            LoadBinaries();
        }
예제 #6
0
        public PresetsViewModel(IDialogService dialogService, IEventAggregator ea, PresetService presetService, Config config)
        {
            if (ea is null)
            {
                throw new ArgumentNullException(nameof(ea));
            }
            if (config is null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            this.presetService = presetService;
            ea.GetEvent <KeyEvent>().Subscribe(CheckIfPresetShouldBeActivated);
            Presets = new ObservableCollection <Preset>(config.Presets);
            ActivatePresetCommand = new DelegateCommand <Preset>(i => presetService.ActivatePreset(i, SelectedTime.Value));
            TimeSettings          = config.TransitionTimes;
            SelectedTime          = config.TransitionTimes.FirstOrDefault();
            //OpenPresetDiagonal = new DelegateCommand(() => dialogService.)
        }
예제 #7
0
        public static void Main(string[] args)
        {
            InstanceId = Process.GetProcessesByName("HandBrake").Length;

            // Handle any unhandled exceptions
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;

            // Check that HandBrakeCLI is availabl.
            string failedInstall = "HandBrake is not installed properly. Please reinstall HandBrake. \n\n";
            string missingFiles  = string.Empty;

            // Verify HandBrakeCLI.exe exists
            if (!File.Exists(Path.Combine(Application.StartupPath, "HandBrakeCLI.exe")))
            {
                missingFiles += "\"HandBrakeCLI.exe\" was not found.";
            }

            if (missingFiles != string.Empty)
            {
                MessageBox.Show(
                    failedInstall + missingFiles,
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }

            // Attempt to upgrade / keep the users settings between versions
            try
            {
                if (Settings.Default.UpdateRequired)
                {
                    Settings.Default.Upgrade();
                    Settings.Default.UpdateRequired = false;
                    Settings.Default.Save();

                    // Re-detect the CLI version data.
                    Functions.Main.SetCliVersionData();
                }
            }
            catch (Exception)
            {
                Functions.Main.RecoverFromCorruptedLocalApplicationConfig();
                return;
            }

            // Check were not running on a screen that's going to cause some funnies to happen.
            Screen scr = Screen.PrimaryScreen;

            if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 620))
            {
                MessageBox.Show(
                    "Your system does not meet the minimum requirements for HandBrake. \n" +
                    "Your screen is running at: " + scr.Bounds.Width + "x" + scr.Bounds.Height +
                    " \nScreen resolution is too Low. Must be 1024x620 or greater.\n\n",
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            else
            {
                string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\logs");
                if (!Directory.Exists(logDir))
                {
                    Directory.CreateDirectory(logDir);
                }

                if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\presets.xml")))
                {
                    PresetService x = new PresetService();
                    x.UpdateBuiltInPresets(string.Empty);
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new frmMain(args));
            }
        }
예제 #8
0
 public BinariesViewModel(FileSystemService <Binary> binaryService, PresetService presetService)
     : base(binaryService)
 {
     _presetService = presetService;
 }