示例#1
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     ForView.Unwrap(DataContext, delegate(ContactListViewModel viewModel)
     {
         viewModel.Init();
     });
 }
示例#2
0
        private void UpdateAllSessionsView()
        {
            var viewModel = ForView.Unwrap <MainViewModel>(DataContext);

            if (viewModel == null)
            {
                viewModel = DataContext as MainViewModel;
            }
            if (viewModel == null)
            {
                return;
            }

            bool visible = viewModel.SelectedView == MainViewModel.ViewOption.AllSessionsView;

            if (visible && _allSessionsView == null)
            {
                _allSessionsView = new AllSessionsView();
                Container.Children.Add(_allSessionsView);
                StartLayoutUpdates(_allSessionsView);
                _allSessionsView.SessionSelected += SessionSelected;
            }

            if (!visible && _allSessionsView != null)
            {
                _allSessionsView.SessionSelected -= SessionSelected;
                StopLayoutUpdates(_allSessionsView);
                Container.Children.Remove(_allSessionsView);
                _allSessionsView = null;
            }
        }
示例#3
0
 private void GlobalHookKeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (!IsKeyboardFocusWithin)
     {
         ForView.Unwrap <MainViewModel>(DataContext, vm => vm.KeyUp(e));
     }
 }
示例#4
0
        private void UpdateMyScheduleView()
        {
            var viewModel = ForView.Unwrap <MainViewModel>(DataContext);

            if (viewModel == null)
            {
                viewModel = DataContext as MainViewModel;
            }
            if (viewModel == null)
            {
                return;
            }

            bool visible = viewModel.SelectedView == MainViewModel.ViewOption.MyScheduleView;

            if (visible && _myScheduleView == null)
            {
                _myScheduleView = new MyScheduleView();
                Container.Children.Add(_myScheduleView);
                StartLayoutUpdates(_myScheduleView);
            }

            if (!visible && _myScheduleView != null)
            {
                StopLayoutUpdates(_myScheduleView);
                Container.Children.Remove(_myScheduleView);
                _myScheduleView = null;
            }
        }
示例#5
0
        private void TvListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0)
            {
                return;
            }

            var device = ForView.Unwrap <ConnectableDevice>(e.AddedItems[0]);

            if (device == null)
            {
                return;
            }

            App.ApplicationModel.SelectedDevice = device;

            var netCastService = (NetcastTvService)device.GetServiceByName(NetcastTvService.Id);

            if (netCastService != null)
            {
                if (!(netCastService.ServiceConfig is NetcastTvServiceConfig))
                {
                    netCastService.ServiceConfig = new NetcastTvServiceConfig(netCastService.ServiceConfig.ServiceUuid);
                }
                netCastService.ShowPairingKeyOnTv();
            }
        }
        private void RemoveFromList(ListView listView)
        {
            TransitionCollection saveTransitions = listView.ItemContainerTransitions;

            listView.ItemContainerTransitions = new TransitionCollection();

            var observableCollection = listView.ItemsSource as ObservableCollection <object>;

            if (observableCollection == null)
            {
                return;
            }

            var removed = observableCollection
                          .Where(wrapper =>
            {
                CardViewModel viewModel = ForView.Unwrap <CardViewModel>(wrapper);
                if (viewModel == null)
                {
                    return(false);
                }
                return(viewModel.Card == _draggingCard);
            })
                          .ToList();

            foreach (var obj in removed)
            {
                observableCollection.Remove(obj);
            }

            listView.ItemContainerTransitions = saveTransitions;
        }
示例#7
0
        public JoinMessageBoardView()
        {
            InitializeComponent();

            ForView.BindAppBarItem(
                ApplicationBar.Buttons[0],
                ForView.Unwrap <JoinMessageBoardViewModel>(DataContext).Join);
        }
示例#8
0
        private void Window_Unloaded(object sender, RoutedEventArgs e)
        {
            ForView.Unwrap <MainViewModel>(DataContext, vm => vm.Close());
            _globalHook.KeyDown -= GlobalHookKeyDown;
            _globalHook.KeyUp   -= GlobalHookKeyUp;

            _globalHook.Dispose();
        }
示例#9
0
        private void Submit_Click(object sender, EventArgs e)
        {
            CommitText();
            SessionEvaluationViewModel viewModel = ForView.Unwrap <SessionEvaluationViewModel>(DataContext);

            viewModel.Submit();
            NavigationService.GoBack();
        }
示例#10
0
        private void SessionsByTime_Click(object sender, EventArgs e)
        {
            SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                NavigationService.Navigate(new Uri(viewModel.SearchByTimeUri, UriKind.Relative));
            }
        }
示例#11
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            var viewModel = ForView.Unwrap <TracksViewModel>(DataContext);

            if (viewModel != null)
            {
                TracksPivot.SelectedIndex = viewModel.SelectedTrackIndex;
            }
        }
示例#12
0
        private void SessionsBySpeaker_Click(object sender, EventArgs e)
        {
            SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                NavigationService.Navigate(new Uri(String.Format("/Views/SpeakerView.xaml?SpeakerId={0}", Uri.EscapeUriString(viewModel.SpeakerId)), UriKind.Relative));
            }
        }
示例#13
0
        private void Remove_Click(object sender, EventArgs e)
        {
            SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.Remove();
            }
            NavigationService.GoBack();
        }
示例#14
0
        private void Search_Click(object sender, EventArgs e)
        {
            ScheduleViewModel viewModel = ForView.Unwrap <ScheduleViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.ClearSearch();
            }
            NavigationService.Navigate(new Uri("/Views/SearchView.xaml", UriKind.Relative));
        }
示例#15
0
        private void SessionsByTrack_Click(object sender, EventArgs e)
        {
            SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.SearchByTrack();
            }
            NavigationService.Navigate(new Uri("/Views/TracksView.xaml", UriKind.Relative));
        }
示例#16
0
        private void Cancel_Click(object sender, EventArgs e)
        {
            JoinMessageBoardViewModel viewModel = ForView.Unwrap <JoinMessageBoardViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.Topic = null;
            }
            NavigationService.GoBack();
        }
示例#17
0
        private void Session_ItemClick(object sender, ItemClickEventArgs e)
        {
            var viewModel = ForView.Unwrap <SessionHeaderViewModel>(e.ClickedItem);

            viewModel.Select();
            if (SessionSelected != null)
            {
                SessionSelected();
            }
        }
示例#18
0
        public MiniTimeLogDialog()
        {
            InitializeComponent();
            manualPlacement();

            KeyUp   += OnKeyUp;
            Closing += OnClosing;

            ForView.Unwrap <TimeFormBrowserViewModel>(DataContext).OnEmpty += OnOnEmpty;
        }
 private void InitializeViewModel()
 {
     if (_viewModel == null)
     {
         _viewModel = ForView.Unwrap <NewGameViewModel>(DataContext);
         if (_viewModel != null)
         {
             _viewModel.HideNewGame += HideNewGame;
         }
     }
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var viewModel = ForView.Unwrap <SearchViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.Search();
            }

            base.OnNavigatedTo(e);
        }
示例#21
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            var viewModel = ForView.Unwrap <ConferenceListViewModel>(DataContext);

            if (viewModel == null)
            {
                return;
            }

            viewModel.ConferenceSelected += ViewModel_ConferenceSelected;
        }
        private void CardList_DragItemsStarting(object sender, DragItemsStartingEventArgs e)
        {
            var cardViewModel = ForView.Unwrap <CardViewModel>(e.Items.FirstOrDefault());

            if (cardViewModel != null)
            {
                var card = cardViewModel.Card;
                _draggingCard = card;
                e.Data.SetApplicationLink(BoardViewModel.UriOfCard(card));
            }
        }
示例#23
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            var viewModel = ForView.Unwrap <ConferenceDetailsViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.NavigatedFrom();
            }

            base.OnNavigatedFrom(e);
        }
示例#24
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();
            }
        }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values[1] == DependencyProperty.UnsetValue)
            {
                return(Visibility.Collapsed);
            }

            FilterFlagViewModel <ClassModel> filter = ForView.Unwrap <FilterFlagViewModel <ClassModel> >(values[0]);
            bool showAllClasses = (bool)values[1];

            return(showAllClasses || filter.Filter.HasSpells ? Visibility.Visible : Visibility.Collapsed);
        }
示例#26
0
 private void InitializeViewModel()
 {
     if (_viewModel == null)
     {
         _viewModel = ForView.Unwrap <CompanySelectionViewModel>(DataContext);
         if (_viewModel != null)
         {
             _viewModel.DisplayCompanyEdit += DisplayCompanyEdit;
             _viewModel.HideCompanyEdit    += HideCompanyEdit;
         }
     }
 }
示例#27
0
 private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         var viewModel    = ForView.Unwrap <MainViewModel>(DataContext);
         var messageBoard = ForView.Unwrap <MessageBoardViewModel>(e.AddedItems[0]);
         if (viewModel != null && messageBoard != null)
         {
             viewModel.SetSelectedMessageBoard(messageBoard);
         }
     }
 }
示例#28
0
        private void PinToStart_Click(object sender, EventArgs e)
        {
            var viewModel = ForView.Unwrap <ScheduleViewModel>(DataContext);

            if (viewModel == null)
            {
                return;
            }

            ShellTileData tileData = viewModel.GetTileData();

            ShellTile.Create(NavigationService.CurrentSource, tileData);
        }
示例#29
0
        private void File_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog()
            {
                DefaultExt      = "scr",
                Title           = "RoboCoder",
                CheckFileExists = false
            };

            if (dialog.ShowDialog() ?? false)
            {
                ForView.Unwrap <MainViewModel>(DataContext, vm => vm.OpenFile(dialog.FileName));
            }
        }
示例#30
0
        public MainPage()
        {
            this.InitializeComponent();

            var viewModel = ForView.Unwrap <MainViewModel>(DataContext);

            if (viewModel != null)
            {
                viewModel.ProjectAdded     += ProjectAdded;
                viewModel.CanDeleteProject += CanDeleteProject;
                viewModel.ActionAdded      += ActionAdded;
                viewModel.CanDeleteAction  += viewModel_CanDeleteAction;
            }
        }