/// <summary>
 /// Initializes a new instance of the <see cref="LogViewModel"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode service.
 /// </param>
 /// <param name="scanService">
 /// The scan service.
 /// </param>
 public LogViewModel(IEncodeServiceWrapper encodeService, IScan scanService)
 {
     this.encodeService  = encodeService;
     this.scanService    = scanService;
     this.Title          = "Log Viewer";
     this.encodeLogIndex = 0;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationService"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode Service.
 /// </param>
 /// <param name="queueProcessor">
 /// The queue Processor.
 /// </param>
 /// <param name="userSettingService">
 /// The user Setting Service.
 /// </param>
 public NotificationService(IEncodeServiceWrapper encodeService, IQueueProcessor queueProcessor, IUserSettingService userSettingService)
 {
     this.userSettingService = userSettingService;
     encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
     queueProcessor.QueueCompleted += this.QueueProcessorQueueCompleted;
     GrowlCommunicator.Register();
 }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueProcessor"/> class.
        /// </summary>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Services are not setup
        /// </exception>
        public QueueProcessor(IEncodeServiceWrapper encodeService)
        {
            this.EncodeService = encodeService;

            // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename.
            this.queueFile = string.Format("hb_queue_recovery{0}.xml", GeneralUtilities.ProcessId);
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueProcessor"/> class.
        /// </summary>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Services are not setup
        /// </exception>
        public QueueProcessor(IEncodeServiceWrapper encodeService)
        {
            this.EncodeService = encodeService;

            // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename.
            this.queueFile = string.Format("hb_queue_recovery{0}.xml", GeneralUtilities.ProcessId);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="LogViewModel"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode service.
 /// </param>
 /// <param name="scanService">
 /// The scan service.
 /// </param>
 public LogViewModel(IEncodeServiceWrapper encodeService, IScanServiceWrapper scanService)
 {
     this.encodeService = encodeService;
     this.scanService = scanService;
     this.Title = "Log Viewer";
     this.encodeLogIndex = 0;
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationService"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode Service.
 /// </param>
 /// <param name="queueProcessor">
 /// The queue Processor.
 /// </param>
 /// <param name="userSettingService">
 /// The user Setting Service.
 /// </param>
 public NotificationService(IEncodeServiceWrapper encodeService, IQueueProcessor queueProcessor, IUserSettingService userSettingService)
 {
     this.userSettingService        = userSettingService;
     encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
     queueProcessor.QueueCompleted += this.QueueProcessorQueueCompleted;
     GrowlCommunicator.Register();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PreviewViewModel"/> class.
        /// </summary>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <param name="errorService">
        /// The error Service.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        public PreviewViewModel(IEncodeServiceWrapper encodeService, IErrorService errorService, IUserSettingService userSettingService)
        {
            this.encodeService = encodeService;
            this.errorService = errorService;
            this.userSettingService = userSettingService;
            this.Title = "Preview";
            this.Percentage = "0.00%";
            this.PercentageValue = 0;
            this.StartAt = 1;
            this.Duration = 30;

            UseSystemDefaultPlayer = userSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);
        }
Exemple #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PreviewViewModel"/> class.
        /// </summary>
        /// <param name="errorService">
        /// The error Service.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        public PreviewViewModel(IErrorService errorService, IUserSettingService userSettingService)
        {
            // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point
            this.encodeService = new EncodeServiceWrapper(userSettingService);

            this.errorService       = errorService;
            this.userSettingService = userSettingService;
            this.Title           = "Preview";
            this.Percentage      = "0.00%";
            this.PercentageValue = 0;
            this.StartAt         = 1;
            this.Duration        = 30;
            this.CanPlay         = true;

            UseSystemDefaultPlayer = userSettingService.GetUserSetting <bool>(UserSettingConstants.DefaultPlayer);
            this.Duration          = userSettingService.GetUserSetting <int>(UserSettingConstants.LastPreviewDuration);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PreviewViewModel"/> class.
        /// </summary>
        /// <param name="errorService">
        /// The error Service.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        public PreviewViewModel(IErrorService errorService, IUserSettingService userSettingService)
        {
            // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point
            this.encodeService = new EncodeServiceWrapper(userSettingService);

            this.errorService = errorService;
            this.userSettingService = userSettingService;
            this.Title = "Preview";
            this.Percentage = "0.00%";
            this.PercentageValue = 0;
            this.StartAt = 1;
            this.Duration = 30;
            this.CanPlay = true;

            UseSystemDefaultPlayer = userSettingService.GetUserSetting<bool>(UserSettingConstants.DefaultPlayer);
            this.Duration = userSettingService.GetUserSetting<int>(UserSettingConstants.LastPreviewDuration);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StaticPreviewViewModel"/> class.
        /// </summary>
        /// <param name="scanService">
        /// The scan service.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        public StaticPreviewViewModel(IScan scanService, IUserSettingService userSettingService)
        {
            this.scanService          = scanService;
            this.selectedPreviewImage = 1;
            this.Title = Properties.Resources.Preview;
            this.PreviewNotAvailable = true;

            // Live Preview
            this.userSettingService = userSettingService;
            this.encodeService      = new EncodeServiceWrapper(userSettingService); // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point

            this.Title           = "Preview";
            this.Percentage      = "0.00%";
            this.PercentageValue = 0;
            this.Duration        = 30;
            this.CanPlay         = true;

            UseSystemDefaultPlayer = userSettingService.GetUserSetting <bool>(UserSettingConstants.DefaultPlayer);
            this.Duration          = userSettingService.GetUserSetting <int>(UserSettingConstants.LastPreviewDuration);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InstantViewModel"/> class.
        /// </summary>
        /// <param name="userSettingService">
        /// The user setting service.
        /// </param>
        /// <param name="scanService">
        /// The scan service.
        /// </param>
        /// <param name="encodeService">
        /// The encode service.
        /// </param>
        /// <param name="presetService">
        /// The preset service.
        /// </param>
        /// <param name="errorService">
        /// The error service.
        /// </param>
        /// <param name="shellViewModel">
        /// The shell view model.
        /// </param>
        /// <param name="updateService">
        /// The update service.
        /// </param>
        /// <param name="notificationService">
        /// The notification service.
        /// </param>
        /// <param name="whenDoneService">
        /// The when done service.
        /// </param>
        public InstantViewModel(
            IUserSettingService userSettingService,
            IScan scanService,
            IEncodeServiceWrapper encodeService,
            IPresetService presetService,
            IErrorService errorService,
            IShellViewModel shellViewModel,
            IUpdateService updateService,
            INotificationService notificationService,
            IPrePostActionService whenDoneService)
        {
            this.userSettingService = userSettingService;
            this.scanService        = scanService;
            this.encodeService      = encodeService;
            this.presetService      = presetService;
            this.errorService       = errorService;
            this.shellViewModel     = shellViewModel;
            this.updateService      = updateService;

            this.queueProcessor = IoC.Get <IQueueProcessor>();

            // Setup Properties
            this.TitleList     = new BindingList <SelectionTitle>();
            this.ScannedSource = new Source();

            // Setup Events
            this.scanService.ScanStared              += this.ScanStared;
            this.scanService.ScanCompleted           += this.ScanCompleted;
            this.scanService.ScanStatusChanged       += this.ScanStatusChanged;
            this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
            this.queueProcessor.QueueCompleted       += this.QueueCompleted;
            this.queueProcessor.QueueChanged         += this.QueueChanged;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;

            this.Presets           = this.presetService.Presets;
            this.CancelScanCommand = new CancelScanCommand(this.scanService);
        }
Exemple #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// The viewmodel for HandBrakes main window.
        /// </summary>
        /// <param name="userSettingService">
        /// The User Setting Service
        /// </param>
        /// <param name="scanService">
        /// The scan Service.
        /// </param>
        /// <param name="encodeService">
        /// The encode Service.
        /// </param>
        /// <param name="presetService">
        /// The preset Service.
        /// </param>
        /// <param name="errorService">
        /// The Error Service
        /// </param>
        /// <param name="shellViewModel">
        /// The shell View Model.
        /// </param>
        /// <param name="updateService">
        /// The update Service.
        /// </param>
        /// <param name="notificationService">
        /// The notification Service.
        /// *** Leave in Constructor. *** 
        /// </param>
        /// <param name="whenDoneService">
        /// The when Done Service.
        /// *** Leave in Constructor. *** 
        /// </param>
        public MainViewModel(IUserSettingService userSettingService, IScanServiceWrapper scanService, IEncodeServiceWrapper encodeService, IPresetService presetService,
            IErrorService errorService, IShellViewModel shellViewModel, IUpdateService updateService, INotificationService notificationService,
            IPrePostActionService whenDoneService)
        {
            this.scanService = scanService;
            this.encodeService = encodeService;
            this.presetService = presetService;
            this.errorService = errorService;
            this.shellViewModel = shellViewModel;
            this.updateService = updateService;
            this.userSettingService = userSettingService;
            this.queueProcessor = IoC.Get<IQueueProcessor>();

            // Setup Properties
            this.WindowTitle = "HandBrake";
            this.CurrentTask = new EncodeTask();
            this.CurrentTask.PropertyChanged += this.CurrentTask_PropertyChanged;
            this.ScannedSource = new Source();

            // Setup Events
            this.scanService.ScanStared += this.ScanStared;
            this.scanService.ScanCompleted += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;
            this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
            this.queueProcessor.QueueCompleted += this.QueueCompleted;
            this.queueProcessor.QueueChanged += this.QueueChanged;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;
            this.userSettingService.SettingChanged += this.UserSettingServiceSettingChanged;

            this.Presets = this.presetService.Presets;
            this.CancelScanCommand = new CancelScanCommand(this.scanService);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationService"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode Service.
 /// </param>
 /// <param name="queueProcessor">
 /// The queue Processor.
 /// </param>
 /// <param name="userSettingService">
 /// The user Setting Service.
 /// </param>
 public NotificationService(IEncodeServiceWrapper encodeService, IQueueProcessor queueProcessor, IUserSettingService userSettingService)
 {
     this.userSettingService = userSettingService;
        // encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
        // queueProcessor.QueueCompleted += this.QueueProcessorQueueCompleted;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="InstantViewModel"/> class.
        /// </summary>
        /// <param name="userSettingService">
        /// The user setting service.
        /// </param>
        /// <param name="scanService">
        /// The scan service.
        /// </param>
        /// <param name="encodeService">
        /// The encode service.
        /// </param>
        /// <param name="presetService">
        /// The preset service.
        /// </param>
        /// <param name="errorService">
        /// The error service.
        /// </param>
        /// <param name="shellViewModel">
        /// The shell view model.
        /// </param>
        /// <param name="updateService">
        /// The update service.
        /// </param>
        /// <param name="notificationService">
        /// The notification service.
        /// </param>
        /// <param name="whenDoneService">
        /// The when done service.
        /// </param>
        public InstantViewModel(
            IUserSettingService userSettingService,
            IScan scanService,
            IEncodeServiceWrapper encodeService,
            IPresetService presetService,
            IErrorService errorService,
            IShellViewModel shellViewModel,
            IUpdateService updateService,
            INotificationService notificationService,
            IPrePostActionService whenDoneService)
        {
            this.userSettingService = userSettingService;
            this.scanService = scanService;
            this.encodeService = encodeService;
            this.presetService = presetService;
            this.errorService = errorService;
            this.shellViewModel = shellViewModel;
            this.updateService = updateService;

            this.queueProcessor = IoC.Get<IQueueProcessor>();

            // Setup Properties
            this.TitleList = new BindingList<SelectionTitle>();
            this.ScannedSource = new Source();

            // Setup Events
            this.scanService.ScanStared += this.ScanStared;
            this.scanService.ScanCompleted += this.ScanCompleted;
            this.scanService.ScanStatusChanged += this.ScanStatusChanged;
            this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
            this.queueProcessor.QueueCompleted += this.QueueCompleted;
            this.queueProcessor.QueueChanged += this.QueueChanged;
            this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;

            this.Presets = this.presetService.Presets;
            this.CancelScanCommand = new CancelScanCommand(this.scanService);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationService"/> class.
 /// </summary>
 /// <param name="encodeService">
 /// The encode Service.
 /// </param>
 /// <param name="queueProcessor">
 /// The queue Processor.
 /// </param>
 /// <param name="userSettingService">
 /// The user Setting Service.
 /// </param>
 public NotificationService(IEncodeServiceWrapper encodeService, IQueueProcessor queueProcessor, IUserSettingService userSettingService)
 {
     this.userSettingService = userSettingService;
     // encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
     // queueProcessor.QueueCompleted += this.QueueProcessorQueueCompleted;
 }