Example #1
0
        public MainPresenter(IMainView view)
        {
            if (view == null) {
            throw new ArgumentNullException("view");
             }
             // Load configuration
             this.configuration = Configuration.Load();
             // Initialize recorder
             this.displayProvider = new DisplayProvider();
             this.displaySettings = new DisplaySettings() {
            Mouse = this.displayProvider.MouseSettings,
            Tracking = this.displayProvider.TrackingSettings,
            Watermark = this.displayProvider.WatermarkSettings,
             };
             this.soundProvider = new SoundProvider();
             this.soundSettings = new SoundSettings() {
            DeviceId = this.soundProvider.DeviceId,
            Format = this.soundProvider.Format,
             };
             this.recorder = new Recorder();
             this.recorder.Error += new RecordErrorEventHandler(recorder_Error);

             // Initialize view
             this.view = view;
             this.InitializeView();

             // Apply configuration
             this.ApplyConfiguration(null);

             // Update View
             this.view.AllowUpdate = true;
             // this.UpdateView();
        }
Example #2
0
 private void Options()
 {
     RecordingState state = this.recorder.State;
      Debug.Assert(state == RecordingState.Idle);
      if (state != RecordingState.Idle) {
     return;
      }
      IOptionsView optionsView = ViewFactory.Create<IOptionsView>();
      optionsView.Configuration = this.configuration.Clone();
      if (optionsView.ShowDialog(this.view)) {
     Configuration old = this.configuration;
     this.configuration = optionsView.Configuration;
     this.ApplyConfiguration(old);
      }
 }
Example #3
0
 private void ApplyConfiguration(Configuration oldConfiguration)
 {
     // General
      GeneralSettings general = this.configuration.General;
      this.view.HideFromTaskbar = general.HideFromTaskbar;
      // Display (Mouse, Tracking and Watermark)
      this.DisplaySettings = new DisplaySettings() {
     Mouse = configuration.Mouse,
     Tracking = configuration.Tracking,
     Watermark = configuration.Watermark,
      };
      this.view.TrackingSettings = configuration.Tracking;
      // Hot Keys
      HotKeySettings hotKey = this.configuration.HotKeys;
      this.view.CancelHotKey = hotKey.Cancel;
      this.view.PauseHotKey = hotKey.Pause;
      this.view.RecordHotKey = hotKey.Record;
      this.view.StopHotKey = hotKey.Stop;
      this.UpdateHotKeys(oldConfiguration != null ? oldConfiguration.HotKeys : null);
      // Sound
      SoundSettings sound = this.configuration.Sound;
      SoundDevice[] soundDevices = SoundProvider.GetDevices();
      this.view.SoundDevices = soundDevices;
      string soundDeviceId = sound.DeviceId;
      SoundDevice soundDevice = null;
      if (!string.IsNullOrEmpty(soundDeviceId)) {
     soundDevice = SoundProvider.GetDeviceOrDefault(soundDeviceId);
     if (soundDevice != null) {
        // Update configuration if device id is invalid
        sound.DeviceId = soundDevice.Id;
     }
      }
      this.view.SoundDevice = soundDevice;
      this.SoundSettings = this.configuration.Sound;
      // Get updated (valid) configuration from recorder
      this.configuration.Sound = this.SoundSettings;
      // Video
      this.recorder.VideoSettings = this.configuration.Video;
      // Get updated (valid) configuration from recorder
      this.configuration.Video = this.recorder.VideoSettings;
      this.UpdateView();
 }