public void Initialize(UserDTO user, CustomerDTO customer)
        {
            Guid?userId = (user != null ? user.GlobalId : (Guid?)null);

            Items.Clear();
            foreach (var exercise in ExercisesReposidory.Instance.Items.Values)
            {
                if (exercise.ExerciseType != ExerciseType.Cardio)
                {
                    var item = new CheckListItem <ExerciseLightDTO>(exercise.GetLocalizedName(), exercise);
                    item.Group = EnumLocalizer.Default.Translate(exercise.ExerciseType);
                    Items.Add(item);
                }
            }
            CollectionView           myView           = (CollectionView)CollectionViewSource.GetDefaultView(listView1.ItemsSource);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Group");

            myView.GroupDescriptions.Add(groupDescription);
            myView.SortDescriptions.Add(new SortDescription("Text", ListSortDirection.Ascending));

            ParentWindow.RunAsynchronousOperation((x) =>
            {
                myPlacesCache = MyPlacesReposidory.GetCache(userId);
                myPlacesCache.EnsureLoaded();
                UIHelper.BeginInvoke(() =>
                {
                    chkPlaces.ItemsSource = myPlacesCache.Items.Values;
                }, Dispatcher);
            });
        }
        private void fillRelatedObjects()
        {
            IsInProgress = true;
            parentView.RunAsynchronousOperation(delegate
            {
                var myPlacesCache    = MyPlacesReposidory.GetCache(null);
                var activitiesHandle = ActivitiesReposidory.Instance.BeginEnsure();
                var customersHandle  = CustomersReposidory.Instance.BeginEnsure();
                var groupsHandle     = CustomerGroupsReposidory.Instance.BeginEnsure();
                var myPlacesHandle   = myPlacesCache.BeginEnsure();

                WaitHandle.WaitAll(new WaitHandle[] { activitiesHandle, customersHandle, groupsHandle, myPlacesHandle });


                parentView.SynchronizationContext.Send(delegate
                {
                    Activities     = ActivitiesReposidory.Instance.Items.Values;
                    Customers      = CustomersReposidory.Instance.Items.Values;
                    CustomerGroups = CustomerGroupsReposidory.Instance.Items.Values;
                    MyPlaces       = myPlacesCache.Items.Values;
                    IsInProgress   = false;
                }, null);
            });
        }
        public void EntryObjectCreated(EntryObjectDTO entryObject)
        {
            if (reservation != null)
            {
                entryObject.ReservationId = reservation.GlobalId;
            }
            StrengthTrainingEntryDTO strength = entryObject as StrengthTrainingEntryDTO;
            SizeEntryDTO             size     = entryObject as SizeEntryDTO;

            if (strength != null)
            {
                strength.StartTime = scheduleEntry.StartTime.ToLocalTime();
                strength.EndTime   = scheduleEntry.EndTime.ToLocalTime();
                if (scheduleEntry.MyPlaceId.HasValue)
                {
                    var myPlacesCache = MyPlacesReposidory.GetCache(null);
                    strength.MyPlace = myPlacesCache.GetItem(scheduleEntry.MyPlaceId.Value);
                }
            }
            if (size != null)
            {
                size.Wymiary.Time.DateTime = scheduleEntry.StartTime.ToLocalTime();
            }
        }
Ejemplo n.º 4
0
 public ScheduleEntryBaseViewModel(ScheduleEntryBaseDTO entry, ScheduleEntriesCalendar calendar)
 {
     this.entry    = entry;
     this.calendar = calendar;
     myPlacesCache = MyPlacesReposidory.GetCache(null);
 }