Ejemplo n.º 1
0
 /// <summary>
 /// Copies properties from other instance
 /// </summary>
 /// <param name="other">Other Binocular instance</param>
 public void CopyFrom(Binocular other)
 {
     Id            = other.Id;
     Name          = other.Name;
     Aperture      = other.Aperture;
     Magnification = other.Magnification;
     FieldOfView   = other.FieldOfView;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets Field Of View parameters as seen by eye with binocular or optical finder
        /// </summary>
        /// <param name="binocular">Binocular or optical finder parameters</param>
        /// <returns>
        /// Field Of View parameters as seen by eye with equipment provided
        /// </returns>
        public static BinocularFieldOfView GetBinocularView(Binocular binocular)
        {
            float exitPupil      = binocular.Aperture / binocular.Magnification;
            float dawesLimit     = GetDawesLimit(binocular.Aperture);
            float magnitudeLimit = GetManitudeLimit(binocular.Aperture);

            return(new BinocularFieldOfView()
            {
                DawesLimit = dawesLimit,
                ExitPupil = exitPupil,
                Magnification = binocular.Magnification,
                Size = binocular.FieldOfView,
                VisualMagnitudeLimit = magnitudeLimit
            });
        }
Ejemplo n.º 3
0
 private void EditEquipment(Type equipmentType, bool isNew)
 {
     if (equipmentType == typeof(Telescope))
     {
         var vm = ViewManager.CreateViewModel <TelescopeVM>();
         vm.Telescopes = Telescopes;
         if (!isNew)
         {
             vm.Telescope.CopyFrom(Telescope);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Telescopes.Add(vm.Telescope);
             }
             TelescopeId = Guid.Empty;
             TelescopeId = vm.Telescope.Id;
             Telescope.CopyFrom(vm.Telescope);
             _Equipment.Telescopes = new ObservableCollection <Telescope>(Telescopes.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Telescopes), nameof(TelescopeId), nameof(Telescope));
             Calculate();
             SaveEquipment();
         }
     }
     else if (equipmentType == typeof(Eyepiece))
     {
         var vm = ViewManager.CreateViewModel <EyepieceVM>();
         vm.Eyepieces = Eyepieces;
         if (!isNew)
         {
             vm.Eyepiece.CopyFrom(Eyepiece);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Eyepieces.Add(vm.Eyepiece);
             }
             EyepieceId = Guid.Empty;
             EyepieceId = vm.Eyepiece.Id;
             Eyepiece.CopyFrom(vm.Eyepiece);
             _Equipment.Eyepieces = new ObservableCollection <Eyepiece>(Eyepieces.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Eyepieces), nameof(EyepieceId), nameof(Eyepiece));
             Calculate();
             SaveEquipment();
         }
     }
     else if (equipmentType == typeof(Camera))
     {
         var vm = ViewManager.CreateViewModel <CameraVM>();
         vm.Cameras = Cameras;
         if (!isNew)
         {
             vm.Camera.CopyFrom(Camera);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Cameras.Add(vm.Camera);
             }
             CameraId = Guid.Empty;
             CameraId = vm.Camera.Id;
             Camera.CopyFrom(vm.Camera);
             _Equipment.Cameras = new ObservableCollection <Camera>(Cameras.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Cameras), nameof(CameraId), nameof(Camera));
             Calculate();
             SaveEquipment();
         }
     }
     else if (equipmentType == typeof(Binocular))
     {
         var vm = ViewManager.CreateViewModel <BinocularVM>();
         vm.Binoculars = Binoculars;
         if (!isNew)
         {
             vm.Binocular.CopyFrom(Binocular);
         }
         if (ViewManager.ShowDialog(vm) ?? false)
         {
             if (isNew)
             {
                 Binoculars.Add(vm.Binocular);
             }
             BinocularId = Guid.Empty;
             BinocularId = vm.Binocular.Id;
             Binocular.CopyFrom(vm.Binocular);
             _Equipment.Binoculars = new ObservableCollection <Binocular>(Binoculars.OrderBy(t => t.Name));
             NotifyPropertyChanged(nameof(Binoculars), nameof(BinocularId), nameof(Binocular));
             Calculate();
             SaveEquipment();
         }
     }
 }