context: using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Xml.Serialization;
  using CameraControl.Devices;
  using CameraControl.Devices.Classes;
  
  namespace CameraControl.Core.Classes
  {
      public class PhotoSession : BaseFieldClass
      {
          private object _locker = new object();
          private string _lastFilename = null;
  
          [XmlIgnore]
          public List<string> SupportedExtensions = new List<string> { ".jpg", ".nef", ".tif", ".png", ".cr2" };
          [XmlIgnore]
          public List<string> RawExtensions = new List<string> { ".cr2", ".nef" };
  
          private string _name;
          public string Name
          {
              get { return _name; }
              set
              {
                  _name = value;
                  NotifyPropertyChanged("Name");
              }
          }
  
          private bool _alowFolderChange;
          public bool AlowFolderChange
          {
              get { return _alowFolderChange; }
              set
              {
                  _alowFolderChange = value;
                  NotifyPropertyChanged("AlowFolderChange");
              }
          }
  
  
          private string _folder;
          public string Folder
          {
              get { return _folder; }
              set
              {
                  if (_folder != value)
                  {
                      if (!Directory.Exists(value))
                      {
                          try
                          {
                              Directory.CreateDirectory(value);
                          }
                          catch (Exception exception)
                          {
                              string folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), Name);
                              if (value != folder)
                                  value = folder;
                              Log.Error("Error creating session folder", exception);
                          }
                      }
                      _systemWatcher.Path = value;
                      _systemWatcher.EnableRaisingEvents = true;
                      _systemWatcher.IncludeSubdirectories = true;
                  }
                  _folder = value;
                  NotifyPropertyChanged("Folder");
              }
          }
  
          private string _fileNameTemplate;
  
          public string FileNameTemplate
          {
              get { return _fileNameTemplate; }
              set
              {
                  _fileNameTemplate = value;
                  NotifyPropertyChanged("FileNameTemplate");
              }
          }
  
          private int _counter;
          public int Counter
          {
              get { return _counter; }
              set
              {
                  _counter = value;
                  NotifyPropertyChanged("Counter");
              }
          }
  
          private bool _useOriginalFilename;
          public bool UseOriginalFilename
          {
              get { return _useOriginalFilename; }
              set
              {
                  _useOriginalFilename = value;
                  NotifyPropertyChanged("UseOriginalFilename");
              }
          }
  
  
          private AsyncObservableCollection<FileItem> _files;
  
          public AsyncObservableCollection<FileItem> Files
          {
              get { return _files; }
              set
              {
                  _files = value;
                  NotifyPropertyChanged("Files");
              }
          }
  
          private TimeLapseClass _timeLapse;
          public TimeLapseClass TimeLapse
          {
              get { return _timeLapse; }
              set
              {
                  _timeLapse = value;
                  NotifyPropertyChanged("TimeLapse");
              }
          }
  
          private BraketingClass _braketing;
          public BraketingClass Braketing
          {
              get { return _braketing; }
              set
              {
                  _braketing = value;
                  NotifyPropertyChanged("Braketing");
              }
          }
  
          private AsyncObservableCollection<TagItem> _tags;
          public AsyncObservableCollection<TagItem> Tags
          {
              get { return _tags; }
              set
              {
                  _tags = value;
                  NotifyPropertyChanged("Tags");
              }
          }
  
          private bool _retainCameraCopy;
          public bool RetainCameraCopy
          {
              get { return _retainCameraCopy; }
              set
              {
                  _retainCameraCopy = value;
                  NotifyPropertyChanged("RetainCameraCopy");
              }
          }
  
          private int _barcodeClearDelay;
          public int BarcodeClearDelay
          {
              get { return _barcodeClearDelay; }
              set
              {
                  _barcodeClearDelay = value;
                  NotifyPropertyChanged("BarcodeClearDelay");
              }
          }
  
          private string _lastBarcode = "";
          public string LastBarcode
          {
              get { return _lastBarcode; }
              set
              {
                  _lastBarcode = value;
                  NotifyPropertyChanged("LastBarcode");
              }
          }
  
          private string _barcodeRegex = "";
          public string BarcodeRegex
          {
              get { return _barcodeRegex; }
              set
              {
                  _barcodeRegex = value;
                  NotifyPropertyChanged("BarcodeRegex");
              }
          }
  
          private string _barcodeDelimiter = "-";
          public string BarcodeDelimiter
          {
              get { return _barcodeDelimiter; }
              set
              {
                  _barcodeDelimiter = (value + "-").Substring(0, 1);
                  NotifyPropertyChanged("BarcodeDelimiter");
              }
          }
  
          private int _barcodeLengthMax;
          public int BarcodeLengthMax
          {
              get { return _barcodeLengthMax; }
              set
              {
                  _barcodeLengthMax = value;
                  NotifyPropertyChanged("BarcodeLengthMax");
              }
          }
  
          private int _barcodeLengthMin;
          public int BarcodeLengthMin
          {
              get { return _barcodeLengthMin; }
              set
              {
                  _barcodeLengthMin = value;
                  NotifyPropertyChanged("BarcodeLengthMin");
              }
          }
  
          private QuickTagOptions _quickTagOption;
          public QuickTagOptions QuickTagOption
          {
              get { return _quickTagOption; }
              set
              {   
                  _quickTagOption = value;
                  QuickTagMainEditable = _quickTagOption==QuickTagOptions.Set_From_Main;
                  NotifyPropertyChanged("QuickTagOption");
              }
          }
          [XmlIgnore]
          public bool QuickTagMainEditable
          {
              get { return (_quickTagOption==QuickTagOptions.Set_From_Main); }
              set 
              {
                  NotifyPropertyChanged("QuickTagMainEditable");
              }
          }
  
          private string _quickTag = "";
          public string QuickTag
          {
              get { return _quickTag; }
              set
              {
                  _quickTag = value;
                  NotifyPropertyChanged("QuickTag");
              }
          }
  
          private TagItem _selectedTag1;
          public TagItem SelectedTag1
          {
              get { return _selectedTag1; }
              set
              {
                  _selectedTag1 = value;
                  NotifyPropertyChanged("SelectedTag1");
              }
          }
  
          private TagItem _selectedTag2;
          public TagItem SelectedTag2
          {
  
gt:             get { return _selectedTag2; }