Esempio n. 1
0
 public AddPhotoView(handphone selectedItem, PhotoType phototype)
 {
     InitializeComponent();
     this.selectedhandphone = selectedItem;
     this.photoType         = phototype;
     this.ChangePhoto();
 }
Esempio n. 2
0
        public AddHandphoneVM(ChangeStatus status, ObservableCollection <handphone> source, CollectionView sourceView, handphone selectedItem)
        {
            var        date = DateTime.Now.Year;
            List <int> list = new List <int>();

            for (var i = date; i > date - 10; i--)
            {
                list.Add(i);
            }

            Tahuns = (CollectionView)CollectionViewSource.GetDefaultView(list);


            this.status       = status;
            this.source       = source;
            this.sourceView   = sourceView;
            this.selectedItem = selectedItem;


            this.StoregeView         = (CollectionView)CollectionViewSource.GetDefaultView(dal.Storages);
            this.StoregeExternalView = (CollectionView)CollectionViewSource.GetDefaultView(dal.Storages);
            this.MemoryView          = (CollectionView)CollectionViewSource.GetDefaultView(dal.Rams);
            this.CameraBackView      = (CollectionView)CollectionViewSource.GetDefaultView(dal.CamBacks);
            this.CameraFrontView     = (CollectionView)CollectionViewSource.GetDefaultView(dal.CamFronts);
            this.OsView = (CollectionView)CollectionViewSource.GetDefaultView(dal.OSs);


            IDataCollection <producent> pr = new ProducentCollections();

            this.ProducentView = (CollectionView)CollectionViewSource.GetDefaultView(pr.GetData());

            SaveCommand = new CommandHandler {
                CanExecuteAction = SaveValidation, ExecuteAction = SaveAction
            };


            if (status == ChangeStatus.Edit)
            {
                this.Id            = selectedItem.Id;
                this.Memory        = selectedItem.Memory;
                this.Name          = selectedItem.Name;
                this.Price         = selectedItem.Price;
                this.ProducentId   = selectedItem.ProducentId;
                this.CameraBack    = selectedItem.CameraBack;
                this.CameraFront   = selectedItem.CameraFront;
                this.Os            = selectedItem.Os;
                this.ProducentId   = selectedItem.ProducentId;
                this.ProducentName = selectedItem.ProducentName;
                this.Storage       = selectedItem.Storage;
            }
        }