private void Page_Loaded(object sender, RoutedEventArgs e) { ForView.Unwrap(DataContext, delegate(ContactListViewModel viewModel) { viewModel.Init(); }); }
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; } }
private void GlobalHookKeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { if (!IsKeyboardFocusWithin) { ForView.Unwrap <MainViewModel>(DataContext, vm => vm.KeyUp(e)); } }
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; } }
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; }
public JoinMessageBoardView() { InitializeComponent(); ForView.BindAppBarItem( ApplicationBar.Buttons[0], ForView.Unwrap <JoinMessageBoardViewModel>(DataContext).Join); }
private void Window_Unloaded(object sender, RoutedEventArgs e) { ForView.Unwrap <MainViewModel>(DataContext, vm => vm.Close()); _globalHook.KeyDown -= GlobalHookKeyDown; _globalHook.KeyUp -= GlobalHookKeyUp; _globalHook.Dispose(); }
private void Submit_Click(object sender, EventArgs e) { CommitText(); SessionEvaluationViewModel viewModel = ForView.Unwrap <SessionEvaluationViewModel>(DataContext); viewModel.Submit(); NavigationService.GoBack(); }
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)); } }
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { var viewModel = ForView.Unwrap <TracksViewModel>(DataContext); if (viewModel != null) { TracksPivot.SelectedIndex = viewModel.SelectedTrackIndex; } }
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)); } }
private void Remove_Click(object sender, EventArgs e) { SessionDetailsViewModel viewModel = ForView.Unwrap <SessionDetailsViewModel>(DataContext); if (viewModel != null) { viewModel.Remove(); } NavigationService.GoBack(); }
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)); }
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)); }
private void Cancel_Click(object sender, EventArgs e) { JoinMessageBoardViewModel viewModel = ForView.Unwrap <JoinMessageBoardViewModel>(DataContext); if (viewModel != null) { viewModel.Topic = null; } NavigationService.GoBack(); }
private void Session_ItemClick(object sender, ItemClickEventArgs e) { var viewModel = ForView.Unwrap <SessionHeaderViewModel>(e.ClickedItem); viewModel.Select(); if (SessionSelected != null) { SessionSelected(); } }
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); }
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)); } }
protected override void OnNavigatedFrom(NavigationEventArgs e) { var viewModel = ForView.Unwrap <ConferenceDetailsViewModel>(DataContext); if (viewModel != null) { viewModel.NavigatedFrom(); } base.OnNavigatedFrom(e); }
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); }
private void InitializeViewModel() { if (_viewModel == null) { _viewModel = ForView.Unwrap <CompanySelectionViewModel>(DataContext); if (_viewModel != null) { _viewModel.DisplayCompanyEdit += DisplayCompanyEdit; _viewModel.HideCompanyEdit += HideCompanyEdit; } } }
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); } } }
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); }
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)); } }
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; } }