public void NavigateTo(object rawViewModel)
        {
            IObjectInstance viewModel = ForView.Wrap(rawViewModel);

            _viewModel = viewModel;
            DisplayView(viewModel);
        }
Esempio n. 2
0
        private static INotifyDataErrorInfo GivenNotifyDataErrorInfo(TestViewModel testViewModel)
        {
            var viewModel = ForView.Wrap(testViewModel);
            var notify    = viewModel as INotifyDataErrorInfo;

            return(notify);
        }
 public FrmEditerHabilitationProfil()
 {
     InitializeComponent();
     InitializeComponent();
     DataContext = ForView.Wrap(new DesignTimeData().Root);
     GetData();
 }
Esempio n. 4
0
        public object GetSessionEvaluationViewModel(string sessionId)
        {
            Guid           sessionGuid = new Guid(sessionId);
            Attendee       attendee    = _synchronizationService.Attendee;
            List <Session> sessions    = attendee.Conference.Sessions.Ensure().Where(s => s.Unique == sessionGuid).ToList();

            if (sessions.Count != 1)
            {
                return(null);
            }

            Session session = sessions[0];

            if (session.CurrentSessionPlaces.Ensure().Count() != 1)
            {
                return(null);
            }

            List <Schedule> schedules = attendee.CurrentSchedules.Ensure().Where(s => s.SessionPlace.Session.Unique == sessionGuid).ToList();

            if (schedules.Count != 1)
            {
                return(null);
            }

            Schedule          schedule          = schedules[0];
            SessionEvaluation sessionEvaluation = schedule.CreateEvaluation();

            if (sessionEvaluation == null)
            {
                return(null);
            }

            return(ForView.Wrap(new SessionEvaluationViewModel(sessionEvaluation, _imageCache)));
        }
        public static void ShowCardDetail(CardDetailModel cardDetail, Action <CardDetailModel> completed)
        {
            Popup popup = new Popup()
            {
                ChildTransitions = new TransitionCollection {
                    new PopupThemeTransition()
                }
            };
            var detail = new CardDetailControl()
            {
                Width       = Window.Current.Bounds.Width,
                Height      = Window.Current.Bounds.Height,
                DataContext = ForView.Wrap(cardDetail)
            };

            detail.Ok += delegate
            {
                popup.IsOpen = false;
                completed(cardDetail);
            };
            detail.Cancel += delegate
            {
                popup.IsOpen = false;
            };
            popup.Child  = detail;
            popup.IsOpen = true;
        }
Esempio n. 6
0
        public object GetSlotViewModel(string startTime)
        {
            Attendee attendee = _synchronizationService.Attendee;
            DateTime start;

            if (!DateTime.TryParse(startTime, out start))
            {
                return(null);
            }

            Day day = attendee.Conference.Days.Ensure().FirstOrDefault(d => d.ConferenceDate == start.Date);

            if (day == null)
            {
                return(null);
            }

            Time time = day.Times.Ensure().FirstOrDefault(t => t.Start == start);

            if (time == null)
            {
                return(null);
            }

            Slot slot = attendee.NewSlot(time);

            return(ForView.Wrap(new SlotViewModel(slot, _imageCache)));
        }
Esempio n. 7
0
        public MainPage()
        {
            // Required to initialize variables
            InitializeComponent();

            DataContext = ForView.Wrap(new MainViewModel(new PageNavigationModel()));

            VisualStateManager.GoToState(this, ViewModel.CurrentPageTag, false);
        }
Esempio n. 8
0
        public MainWindow()
        {
            InitializeComponent();
            var view = new LogView();

            view.DataContext = ForView.Wrap(new LogViewModel(App.LogModel));
            view.ShowAsDocument(dockManager);
            view.Focus();
        }
Esempio n. 9
0
        private void EditSurvey_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            ConferenceViewModel dataContext = ForView.Unwrap <ConferenceViewModel>(this.DataContext);

            if (dataContext != null)
            {
                SurveyEditChildWindow childWindow = new SurveyEditChildWindow();
                childWindow.DataContext = ForView.Wrap(dataContext.SurveyEdit);
                childWindow.Show();
            }
        }
Esempio n. 10
0
        private void HomeView_Loaded(object sender, RoutedEventArgs e)
        {
            var viewModel = new VendingMachineViewModel(
                new Catalog()
                .AddProduct("Doritos")
                .AddProduct("Cheezits"),
                new Order(),
                new VendingMachineNavigationModel());

            DataContext = ForView.Wrap(viewModel);
        }
Esempio n. 11
0
        protected override void OnActivated(EventArgs e)
        {
            base.OnActivated(e);

            if (_model == null)
            {
                _model = new ObservableClock();
                var viewModel = new TimeDisplay(_model);
                MainWindow.DataContext = ForView.Wrap(viewModel);
            }
        }
        public CloudTabItem(CloudTabViewModel viewModel)
        {
            _viewModel = viewModel;

            Content = new CloudView {
                DataContext = ForView.Wrap(_viewModel.Content)
            };

            _depHeader              = new Dependent(() => Header = _viewModel.Header);
            _depHeader.Invalidated += () => Deployment.Current.Dispatcher.BeginInvoke(() => _depHeader.OnGet());
            _depHeader.Touch();
        }
Esempio n. 13
0
        public object GetSpeakerViewModel(string speakerId)
        {
            Attendee attendee = _synchronizationService.Attendee;
            Speaker  speaker  = attendee.Conference.Speakers.Ensure().FirstOrDefault(s => s.Name == speakerId);

            if (speaker == null)
            {
                return(null);
            }

            return(ForView.Wrap(new SpeakerViewModel(attendee, speaker, _imageCache)));
        }
Esempio n. 14
0
        public object GetScheduleViewModel(Guid conferenceId)
        {
            Attendee attendee = GetAttendee(conferenceId);

            if (attendee == null)
            {
                return(null);
            }

            return(ForView.Wrap(new ScheduleViewModel(
                                    _synchronizationService,
                                    attendee,
                                    _imageCache,
                                    _searchModel)));
        }
Esempio n. 15
0
 private object WrapValue(object value)
 {
     if (value == null)
     {
         return(null);
     }
     else if (_provider.IsPrimitive)
     {
         return(value);
     }
     else
     {
         return(ForView.Wrap(value));
     }
 }
Esempio n. 16
0
        public object GetConferenceDetailsViewModel(Guid conferenceId)
        {
            var catalog          = _synchronizationService.Community.AddFact(new Catalog(Environment));
            var conferenceHeader = catalog.ConferenceHeaders.Ensure()
                                   .FirstOrDefault(c => c.Conference.Unique == conferenceId);

            if (conferenceHeader == null)
            {
                return(null);
            }

            return(ForView.Wrap(new ConferenceDetailsViewModel(
                                    _synchronizationService.Individual,
                                    conferenceHeader,
                                    _conferenceSelection)));
        }
Esempio n. 17
0
        public object GetSlotViewModel(Guid conferenceId, Guid timeId)
        {
            var attendee = GetAttendee(conferenceId);

            if (attendee == null)
            {
                return(null);
            }

            var time = attendee.Conference.Times.Ensure()
                       .FirstOrDefault(t => t.Unique == timeId);

            if (time == null)
            {
                return(null);
            }

            return(ForView.Wrap(new SlotViewModel(time, _imageCache)));
        }
Esempio n. 18
0
        public object GetSessionDetailsViewModel(string sessionId)
        {
            Attendee attendee    = _synchronizationService.Attendee;
            Guid     sessionGuid = new Guid(sessionId);
            Session  session     = attendee.Conference.Sessions.Ensure().FirstOrDefault(s => s.Unique == sessionGuid);

            if (session == null)
            {
                return(null);
            }
            if (session.CurrentSessionPlaces.Ensure().Count() != 1)
            {
                return(null);
            }

            SessionPlace sessionPlace = session.CurrentSessionPlaces.Single();
            Slot         slot         = attendee.NewSlot(sessionPlace.Place.PlaceTime);

            return(ForView.Wrap(new SessionDetailsViewModel(slot, sessionPlace, _imageCache, _searchModel, _clock)));
        }
 public FrmModuleFonction()
 {
     InitializeComponent();
     DataContext = ForView.Wrap(new DesignTimeData().Root);
     GetData();
 }
Esempio n. 20
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     DataContext = ForView.Wrap(new MainViewModel(new Model(), new LoadTester()));
 }
 public static object Wrap(object model)
 {
     return(ForView.Wrap(model));
 }
Esempio n. 22
0
 public Search()
 {
     this.InitializeComponent();
     model       = App.ApplicationModel;
     DataContext = ForView.Wrap(model);
 }
 public MainWindow()
 {
     InitializeComponent();
     DataContext = ForView.Wrap(new MainWindowViewModel());
 }
Esempio n. 24
0
 private void BindAndShow(DockableContent view, object viewModel)
 {
     view.DataContext = ForView.Wrap(viewModel);
     view.ShowAsDocument(dockManager);
     view.Focus();
 }