Exemplo n.º 1
0
        /// <summary>
        /// save camera changes to database
        /// check if model is valid and undo updates if not valid
        /// </summary>
        /// <param name="currentCamera"></param>
        internal void CurrentCameraChanged(ICameraViewModel currentCamera)
        {
            CameraViewModel cvm = (CameraViewModel)currentCamera;

            if (!cvm.IsValid)
            {
                Error(cvm.ValidationSummary);
                cvm.UndoUpdate();
                return;
            }
            Save(cvm.CameraModel);
        }
Exemplo n.º 2
0
        public void Add(CameraModel p)
        {
            if (p == null)
            {
                return;
            }
            CameraViewModel pvm = new CameraViewModel(p);

            _List.Add(pvm);
            CurrentIndex = Count - 1;
            OnPropertyChanged("List");
            OnPropertyChanged("Count");
        }
Exemplo n.º 3
0
        public PictureViewModel(PictureModel mdl)
        {
            this.mdl = mdl;
            _camera  = new CameraViewModel();
            _iptc    = new IPTCViewModel();
            EXIFModel em = new EXIFModel();

            em.Make       = "Hi";
            em.ISOValue   = 30;
            em.Flash      = true;
            _exif         = new EXIFViewModel(em);
            _picTitle     = "";
            _photographer = new PhotographerViewModel(new PhotographerModel());
        }
Exemplo n.º 4
0
        private void Camerabox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (CameraBox.SelectedItem != null)
            {
                var CameraModel = (CameraViewModel)CameraBox.SelectedItem;
                lastSelectedViewModel = CameraModel;

                Producer.Text           = CameraModel.Producer;
                Make.Text               = CameraModel.Make;
                BoughtOn.Text           = CameraModel.BoughtOn.ToString();
                Notes.Text              = CameraModel.Notes;
                ISOLimitGood.Text       = CameraModel.ISOLimitGood.ToString();
                ISOLimitAcceptable.Text = CameraModel.ISOLimitAcceptable.ToString();
            }
        }
Exemplo n.º 5
0
        private void BtnSaveChanges_Click(object sender, RoutedEventArgs e)
        {
            if (lastSelectedViewModel != null)
            {
                CameraViewModel cameraViewModel = lastSelectedViewModel;

                cameraViewModel.Producer = Producer.Text;
                cameraViewModel.Make     = Make.Text;
                cameraViewModel.BoughtOn = DateTime.Parse(BoughtOn.Text);
                cameraViewModel.Notes    = Notes.Text;
                Decimal.TryParse(ISOLimitGood.Text, out decimal isoLimitGood);
                cameraViewModel.ISOLimitGood = isoLimitGood;
                Decimal.TryParse(ISOLimitAcceptable.Text, out decimal isoLimitAcceptable);
                cameraViewModel.ISOLimitAcceptable = isoLimitAcceptable;

                _controller.UpdateCamera(cameraViewModel);
            }
        }
Exemplo n.º 6
0
        private void SaveBtn_Clicked(object sender, RoutedEventArgs e)
        {
            var     camera   = new CameraViewModel();
            var     boughtOn = DateTime.Now;
            decimal isoLimits;

            if (DateTime.TryParse(BoughtOn.Text, out boughtOn))
            {
                camera.BoughtOn = boughtOn;
            }
            if (!string.IsNullOrWhiteSpace(Producer.Text))
            {
                camera.Producer = Producer.Text;
            }
            if (!string.IsNullOrWhiteSpace(Make.Text))
            {
                camera.Make = Make.Text;
            }
            if (!string.IsNullOrWhiteSpace(Notes.Text))
            {
                camera.Notes = Notes.Text;
            }

            if (!string.IsNullOrWhiteSpace(ISOLimitAcceptable.Text))
            {
                if (decimal.TryParse(ISOLimitAcceptable.Text, out isoLimits))
                {
                    camera.ISOLimitAcceptable = isoLimits;
                }
            }

            if (!string.IsNullOrWhiteSpace(ISOLimitGood.Text))
            {
                if (decimal.TryParse(ISOLimitGood.Text, out isoLimits))
                {
                    camera.ISOLimitGood = isoLimits;
                }
            }


            _controller.SaveCamera(camera);
            this.Close();
        }