private void MainMenuPanorama_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count < 1) { return; } if (!(e.AddedItems[0] is PanoramaItem)) { return; } PanoramaItem selectedItem = (PanoramaItem)e.AddedItems[0]; string strTag = (string)selectedItem.Tag; if (strTag.Equals("highscores")) { if (g_LastHighScoreUpdate < App.DataStore.AllHighScores.LastHighScoreUpdate) { this.LoadingGrid.Visibility = System.Windows.Visibility.Visible; this.HighScoresGrid.Visibility = System.Windows.Visibility.Collapsed; App.MainPageViewModel.LoadHighscoreData(); g_LastHighScoreUpdate = App.DataStore.AllHighScores.LastHighScoreUpdate; this.LoadingGrid.Visibility = System.Windows.Visibility.Collapsed; this.HighScoresGrid.Visibility = System.Windows.Visibility.Visible; } } }
private void CreateItems() { // dictionary 的遍历 foreach (KeyValuePair<string, WeatherDataModel> c in _dataModel.GetWeatherDictionary()) { PanoramaItem item = new PanoramaItem(); WeatherDataModel city = c.Value; item.HeaderTemplate = this.ItemHeaderTemplate; item.Header = city.cityinfo; ListBox lb = new ListBox(); lb.ItemTemplate = this.ListBoxTemplate; //!!! Listbox 绑定数据源是用itemSource 而不是 DataContext!!!!! lb.ItemsSource = city.DC_WeatherByDay; item.Content = lb; //item.DataContext = channel_data; // assign channel data to the current item, this.PanoramaCtrl.Items.Add(item); } PanoramaItem item2 = new PanoramaItem(); item2.Header = "城市管理"; this.PanoramaCtrl.Items.Add(item2); }
private void LoadData() { var linea = Uri.EscapeUriString(NavigationContext.QueryString["id"]); var colectivoRecorrido = DataColectivos.AllByCode(linea); GeneralPanorama.Title = "Línea " + linea; /* * <phone:PanoramaItem Header="recorrido" HeaderTemplate="{StaticResource SmallHomePanoramaTitle}"> * <ScrollViewer Margin="12,0,0,0"> * <TextBlock x:Name="TxtRecorrido"></TextBlock> * </ScrollViewer> * </phone:PanoramaItem> */ foreach (var colectivo in colectivoRecorrido) { var text = new TextBlock { Text = colectivo.Value, TextWrapping = TextWrapping.Wrap }; var scroll = new ScrollViewer { Margin = new Thickness(12, 0, 0, 40), Content = text }; var item = new PanoramaItem { HeaderTemplate = Application.Current.Resources["SmallHomePanoramaTitle"] as DataTemplate, Header = colectivo.Key, Content = scroll }; GeneralPanorama.Items.Add(item); } }
public ExerciseList() { InitializeComponent(); HashSet<string> aTypes = ExerciseType.ExerciseTypes; foreach (string type in aTypes) { PanoramaItem pi = new PanoramaItem(); PanoramaUserControl puc = new PanoramaUserControl(); List<string> ll = new List<string>(); List<ExerciseType> let = ExerciseType.getByType(type); foreach (ExerciseType et in let) { ll.Add(et.Name); _got.Add(et.Name, et); } LongListSelector LLS = puc.lSelector; LLS.SelectionChanged+= LLS_SelectionChanged; LLS.ItemsSource = ll; pi.Header = type; pi.Content = puc; myP.Items.Add(pi); } }
private void RemovePano(PanoramaItem item) { if (MainPano.Items.IndexOf(item) > -1) { MainPano.Items.Remove(item); } }
private void Panorama_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count < 1) { return; } if (!(e.AddedItems[0] is PanoramaItem)) { return; } PanoramaItem selectedItem = (PanoramaItem)e.AddedItems[0]; string strTag = (string)selectedItem.Tag; if (strTag.Equals("events")) { this.ApplicationBar.Mode = ApplicationBarMode.Default; } else //if (strTag.Equals("mission")) { this.ApplicationBar.Mode = ApplicationBarMode.Minimized; } }
//When accessing page, refresh sprints and stories protected override void OnNavigatedTo(NavigationEventArgs e) { //select sprints in selected project string selectedProjectIdString = ""; if (NavigationContext.QueryString.TryGetValue("selectedProjectId", out selectedProjectIdString)) { var selectedProjectSprints = from sprint in DataProvider.getSprints() where sprint.projectId == int.Parse(selectedProjectIdString) select sprint; //make a panorama item for each sprint foreach (Sprint sp in selectedProjectSprints) { PanoramaItem sprintView = new PanoramaItem() { Header = sp.name }; sprintView.Content = new Grid() { Margin = new Thickness(12, 0, 12, 0) }; App.ViewModel.LoadSprint(sp); //create listBox ListBox sprintList = new ListBox() { Margin = new Thickness(0, 0, -12, 0), ItemsSource = App.ViewModel.Sprints[sp.id] }; sprintList.SelectionChanged += new SelectionChangedEventHandler(tasksList_SelectionChanged); sprintList.ItemTemplate = (DataTemplate)Resources["SprintsListBoxDataTemplate"]; ((Grid)sprintView.Content).Children.Add(sprintList); SprintsPanorama.Items.Add(sprintView); } } }
protected void Item_Loaded(object sender, RoutedEventArgs e) { Period period; ListBox WorkListBox = null; PanoramaItem pi = FindParentRecursive(sender as FrameworkElement, typeof(PanoramaItem)) as PanoramaItem; if (pi == Day) { period = Period.Day; WorkListBox = PostsDay; } else if (pi == Week) { period = Period.Week; WorkListBox = PostsWeek; } else if (pi == Month) { period = Period.Month; WorkListBox = PostsMonth; } else { period = Period.Now; WorkListBox = PostsNow; } loadedPosts[(int)period] += 1; if (WorkListBox.Items.Count() == loadedPosts[(int)period]) { lastPosts[(int)period] = sender as StackPanel; busyPicsLoader[(int)period] = false; } }
public MainPage() { InitializeComponent(); PanoramaItem eventsPage = new PanoramaItem() { Name = "eventsPage", Header = "Upcoming" }; PanoramaItem artistsPage = new PanoramaItem() { Name = "artistsPage", Header = "Artists" }; PanoramaItem venuesPage = new PanoramaItem() { Name = "venuesPage", Header = "Venues" }; mainView.Items.Add(eventsPage); mainView.Items.Add(artistsPage); mainView.Items.Add(venuesPage); AdControl concertsAd = new AdControl() { ApplicationId = "33c7fa47-c859-47f1-8903-f745bf749ce0", AdUnitId = "10016302", Width = 300, Height = 50, Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White), Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black) }; LayoutRoot.Children.Add(concertsAd); Grid.SetRow(concertsAd, 1); ApplicationBar = new ApplicationBar(); ApplicationBar.IsMenuEnabled = true; ApplicationBar.IsVisible = true; ApplicationBar.Opacity = 1.0; events = new List <Event>(); artists = new List <Artist>(); venues = new List <Venue>(); eventsStorageHelper = new StorageHelper <Event>("Events.xml", "Stale.txt"); artistsStorageHelper = new StorageHelper <Artist>("Artists.xml"); venuesStorageHelper = new StorageHelper <Venue>("Venues.xml"); ApplicationBarIconButton refresh = new ApplicationBarIconButton(new Uri("/Icons/appbar.refresh.rest.png", UriKind.Relative)); refresh.Text = "refresh"; refresh.Click += new EventHandler(refresh_Click); ApplicationBarIconButton settings = new ApplicationBarIconButton(new Uri("/Icons/appbar.feature.settings.rest.png", UriKind.Relative)); settings.Text = "settings"; settings.Click += new EventHandler(settings_Click); ApplicationBar.Buttons.Add(refresh); ApplicationBar.Buttons.Add(settings); ApplicationBar.BackgroundColor = System.Windows.Media.Colors.Black; ApplicationBar.ForegroundColor = System.Windows.Media.Colors.White; this.Loaded += new RoutedEventHandler(MainPage_Loaded); }
private void InitializeAppBarpanoramadesserts_List(PanoramaItem panoramaItem) { if (Resources.Contains(panoramaItem.Name + "AppBar")) { PhonePage.SetApplicationBar(this, Resources[panoramaItem.Name + "AppBar"] as BindableApplicationBar); ApplicationBar.IsVisible = true; } else if(ApplicationBar != null) ApplicationBar.IsVisible = false; }
private void InitializeAppBarpanoramaCnetNEWS_Detail(PanoramaItem panoramaItem) { if (Resources.Contains(panoramaItem.Name + "AppBar")) { PhonePage.SetApplicationBar(this, Resources[panoramaItem.Name + "AppBar"] as BindableApplicationBar); ApplicationBar.IsVisible = true; } else if (ApplicationBar != null) { ApplicationBar.IsVisible = false; } }
private PanoramaItem panoramaItemFromSection(Section section) { PanoramaItem panoramaItem = new PanoramaItem(); ScrollViewer scrollViewer = new ScrollViewer(); panoramaItem.Content = scrollViewer; Grid grid = new Grid() { Margin = new Thickness(0, 10, 0, 0) }; grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); TextBlock headerText = new TextBlock() { Text = section.Header, FontFamily = new FontFamily("Segoe WP Black"), FontSize = 65, Foreground = new SolidColorBrush((Color)Resources["PhoneForegroundColor"]), HorizontalAlignment = System.Windows.HorizontalAlignment.Left }; Grid.SetRow(headerText, 0); grid.Children.Add(headerText); TextBlock captionText = new TextBlock() { Text = section.Caption, FontFamily = new FontFamily("Segoe WP Black"), FontSize = 20, Foreground = new SolidColorBrush((Color)Resources["PhoneForegroundColor"]), HorizontalAlignment = System.Windows.HorizontalAlignment.Right }; Grid.SetRow(captionText, 1); grid.Children.Add(captionText); Boolean alternate = section.AlternateSeed; for (int i = 0; i < section.Entries.Count; i++) { grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid.Children.Add(rowFromEntry(section.Entries[i], 2 + i, alternate, section.DefaultColor, section.AlternateColor)); alternate = !alternate; } scrollViewer.Content = grid; return(panoramaItem); }
public MainPage() { InitializeComponent(); PanoramaItem panItem = new PanoramaItem(); List <ImageList> imgList = new List <ImageList>(); imgList.Add(new ImageList() { ImageName = ImagePath.Image4 }); lbImages.ItemsSource = imgList; }
private void AddPano(PanoramaItem item, int?atPosition = null) { if (MainPano.Items.IndexOf(item) < 0) { if (atPosition.HasValue) { MainPano.Items.Insert(atPosition.Value, item); } else { MainPano.Items.Add(item); } } }
private void AddPano(PanoramaItem item, int? atPosition = null) { if (MainPano.Items.IndexOf(item) < 0) { if (atPosition.HasValue) { MainPano.Items.Insert(atPosition.Value, item); } else { MainPano.Items.Add(item); } } }
/// <summary> /// Searching..... /// </summary> /// <param name="e"></param> protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); string query = "", fileName = ""; var store = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication(); EnsureDirectoryExists(store); // IF we have a new query, check to see if it's still cached if (NavigationContext.QueryString.TryGetValue("query", out query) && !string.IsNullOrEmpty(query)) { string slug = query.Slugify(); fileName = string.Format("{0}{1}", Settings.GetSettings().CachedQueriesFilePath, slug); JObject cached = CheckCache(fileName); if (cached != null) { ProcessBugZillaResults(cached); } else { PanoramaItem pItem = new PanoramaItem() { Name = slug, Header = query, Content = CreateProgressBar() }; PanoView.Items.Add(pItem); PanoView.DefaultItem = pItem; QueryZilla(query, slug, fileName, ProcessBugZillaResults); } } // //Load cached searches // foreach (string file in store.GetFileNames(Settings.GetSettings().CachedQueriesFilePath + "*")) { var fullName = Settings.GetSettings().CachedQueriesFilePath + file; if (fullName == fileName) continue; using (var stream = store.OpenFile(fullName, FileMode.Open)) { JObject jsonObj = ConvertJsonStreamToJObject(stream); ProcessBugZillaResults(jsonObj); } } }
protected void UpdateSelectedPanoramaItem(PanoramaItem selectedItem) { if (selectedItem != null) { if (selectedItem.Name == "PanActivity") { var activitiesVM = (ActivitiesViewModel)selectedItem.DataContext; if (!activitiesVM.LoadStarted) { activitiesVM.Load(false); selectedItem.DataContext = activitiesVM; } } } }
private void Panorama_SelectionChanged(object sender, SelectionChangedEventArgs e) { PanoramaItem pItem = e.AddedItems[0] as PanoramaItem; var panorama = pItem.Parent as Panorama; var selectedIndex = panorama.SelectedIndex; if (selectedIndex == 0) { //appBar.IsVisible = true; } else if (selectedIndex == 1) { //appBar.IsVisible = false; } }
private void validateInputs(object sender, EventArgs e) { this.Focus(); foreach (FormItem item in page.FormItemList) { if (item.State == FormItemState.Blank.ToString() && item.Important) { Debug.WriteLine("Das FormItem " + item.ID + " ist noch nicht editiert wurden"); ScrollViewer scrollViewer = new ScrollViewer(); PanoramaItem panoramaItem = new PanoramaItem(); bool found = false; var parent = ((FrameworkElement)this.FindName(item.ID)).Parent; while (parent.GetType() != typeof(PanoramaItem)) { if (parent.GetType() == typeof(ScrollViewer)) { scrollViewer = (ScrollViewer)parent; found = true; } parent = ((FrameworkElement)parent).Parent; } panoramaItem = (PanoramaItem)parent; if (found) { itemID = item.ID; var transform = ((FrameworkElement)(this.FindName(item.ID))).TransformToVisual(Application.Current.RootVisual); Point offset = transform.Transform(new Point(0, 0)); Debug.WriteLine("PositionY=" + offset.Y + " mit Offset=" + scrollViewer.VerticalOffset); double height = Application.Current.RootVisual.RenderSize.Height; if (offset.Y > height) { double center = height / 2; double diff = offset.Y - center; scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset + diff); } showQuestionMark(offset); //((FrameworkElement)(this.FindName(item.ID))).LayoutUpdated += updateOpenPoint; //pagePanorama.ManipulationDelta += updateOpenPoint; //pagePanorama.ManipulationStarted += updateOpenPoint; //pagePanorama.ManipulationCompleted += updateOpenPoint; //pagePanorama.LayoutUpdated += updateOpenPoint; timer.Start(); } return; } } }
/// <summary> /// Handler called when user taps one of the RSS feed icons /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; int pageIndex = RSSFeedsPanorama.SelectedIndex; PanoramaItem item = RSSFeedsPanorama.SelectedItem as PanoramaItem; RSSPage page = item.DataContext as RSSPage; RSSFeed feed = button.DataContext as RSSFeed; int feedIndex = page.Feeds.IndexOf(feed); if (feedIndex >= 0) // Act only on buttons on current page { NavigationService.Navigate(new Uri("/Views/FeedPivot.xaml?id=" + feedIndex.ToString() + "&page=" + pageIndex.ToString(), UriKind.Relative)); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (panorama.Items.Count <= 0) { foreach (Photo p in photos) { PanoramaItem pi = new PanoramaItem(); pi.Header = p.PhotoTile; Image img = new Image(); img.Source = p.PhotoSource; pi.Content = img; panorama.Items.Add(pi); } } panorama.DefaultItem = panorama.Items[int.Parse(NavigationContext.QueryString["selectedImage"])]; base.OnNavigatedTo(e); }
private void addParaItem() { PanoramaItem panoItem = new PanoramaItem(); WebBrowser webBrower = new WebBrowser(); Common common = new Common(); common.SaveFilesToIsoStore(category.pageURL); for(int i = 0; i < category.pageName.Count; i++) { panoItem = new PanoramaItem(); panoItem.Header = category.pageName[i]; PageView.Items.Add(panoItem); webBrower = new WebBrowser(); webBrower.Navigate(new Uri(category.pageURL[i], UriKind.Relative)); panoItem.Content = webBrower; } //panoItem.Header = }
protected void UpdateSelectedPanoramaItem(PanoramaItem selectedItem) { if (selectedItem != null) { if (selectedItem.Name == "PanDiscussions") { _discussionsViewModel.Load(); selectedItem.DataContext = _discussionsViewModel; } else if (selectedItem.Name == "PanCourses") { if (selectedItem.DataContext == null || !(selectedItem.DataContext is CoursesViewModel)) { selectedItem.DataContext = App.Model.Courses; } } } }
void InsertItem(object item, int index, bool newItem) { DependencyObject pageContent = PageTemplate.LoadContent(); var pageItem = (Page)item; PanoramaItem container = GetPageContainer(pageItem); if (container == null) { container = new PanoramaItem { DataContext = item, Content = pageContent }; SetPageContainer(pageItem, container); } Items.Insert(index, container); }
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) { PanoramaItem panoramaItem = Panorama.SelectedItem as PanoramaItem; if (panoramaItem.Name == "UserPanorama") { //if back button is pressed and the screen isnt showing the profile grid //then that means we are viewing another grid. so close all other grids //and show the user profile grid if (userProfileGrid.Visibility == System.Windows.Visibility.Collapsed && loggedIn == true && showFriendProfileGrid.Visibility == System.Windows.Visibility.Collapsed) { userProfileGrid.Visibility = System.Windows.Visibility.Visible; CheckInGrid.Visibility = System.Windows.Visibility.Collapsed; friendShowGrid.Visibility = System.Windows.Visibility.Collapsed; showTipGrid.Visibility = System.Windows.Visibility.Collapsed; showMayorGrid.Visibility = System.Windows.Visibility.Collapsed; showFriendProfileGrid.Visibility = System.Windows.Visibility.Collapsed; //e.cancel stops app frem going back or backing out e.Cancel = true; } //if the friend profile is currently visible else if (showFriendProfileGrid.Visibility == System.Windows.Visibility.Visible) { //close the friend profile view and show the list of all your friends showFriendProfileGrid.Visibility = System.Windows.Visibility.Collapsed; friendShowGrid.Visibility = System.Windows.Visibility.Visible; e.Cancel = true; } } else if (panoramaItem.Name == "ActivityPanorama") { //if back button pressed and activity isnt visible then make it visible. but if the back button is pressed //and activityfeedgrid is visible then exit the app. if (ActivityFeedGrid.Visibility == System.Windows.Visibility.Collapsed && loggedIn == true) { //set venueviewmode to null so we can reclaim the memory venueViewModel = null; ActivityFeedGrid.Visibility = System.Windows.Visibility.Visible; venuePageGrid.Visibility = System.Windows.Visibility.Collapsed; ActivitySignInGrid.Visibility = System.Windows.Visibility.Collapsed; e.Cancel = true; } } }
public MainPage() { InitializeComponent(); PanoramaItem eventsPage = new PanoramaItem() { Name = "eventsPage", Header = "Upcoming" }; PanoramaItem artistsPage = new PanoramaItem() { Name = "artistsPage", Header = "Artists" }; PanoramaItem venuesPage = new PanoramaItem() { Name = "venuesPage", Header = "Venues" }; mainView.Items.Add(eventsPage); mainView.Items.Add(artistsPage); mainView.Items.Add(venuesPage); AdControl concertsAd = new AdControl() { ApplicationId = "33c7fa47-c859-47f1-8903-f745bf749ce0", AdUnitId = "10016302", Width = 300, Height = 50, Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.White), Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black) }; LayoutRoot.Children.Add(concertsAd); Grid.SetRow(concertsAd, 1); ApplicationBar = new ApplicationBar(); ApplicationBar.IsMenuEnabled = true; ApplicationBar.IsVisible = true; ApplicationBar.Opacity = 1.0; events = new List<Event>(); artists = new List<Artist>(); venues = new List<Venue>(); eventsStorageHelper = new StorageHelper<Event>("Events.xml", "Stale.txt"); artistsStorageHelper = new StorageHelper<Artist>("Artists.xml"); venuesStorageHelper = new StorageHelper<Venue>("Venues.xml"); ApplicationBarIconButton refresh = new ApplicationBarIconButton(new Uri("/Icons/appbar.refresh.rest.png", UriKind.Relative)); refresh.Text = "refresh"; refresh.Click += new EventHandler(refresh_Click); ApplicationBarIconButton settings = new ApplicationBarIconButton(new Uri("/Icons/appbar.feature.settings.rest.png", UriKind.Relative)); settings.Text = "settings"; settings.Click += new EventHandler(settings_Click); ApplicationBar.Buttons.Add(refresh); ApplicationBar.Buttons.Add(settings); ApplicationBar.BackgroundColor = System.Windows.Media.Colors.Black; ApplicationBar.ForegroundColor = System.Windows.Media.Colors.White; this.Loaded += new RoutedEventHandler(MainPage_Loaded); }
/// <summary> /// 선택된 PanoramaItem 페이지를 활성화 한다. /// </summary> private void ActivateSelectedPanoramaItem() { PanoramaItem panoItem = panoramaMain.SelectedItem as PanoramaItem; if (panoItem == null) { return; } string panoItemTag = panoItem.Tag.ToString(); if (string.IsNullOrWhiteSpace(panoItemTag)) { return; } switch (panoItemTag) { case "panoItemTextLibrary": ApplicationBar.Mode = ApplicationBarMode.Default; //ApplicationBarMenuItem menuitem = new ApplicationBarMenuItem("menu|"); //ApplicationBar.Buttons.Add(seledtedDeleteButton); ApplicationBar.IsVisible = true; ApplicationBar.Mode = ApplicationBarMode.Minimized; ReadFileList(); break; case "panoItemDropBoxDownload": ApplicationBar.IsVisible = false; if (!DropboxConnected) { DropboxConnect(); } break; case "panoItemSettings": case "panoItemAbout": ApplicationBar.IsVisible = false; break; } }
public ImagePage() { InitializeComponent(); imageCollection = App.imageCollectionPassed; imageIndex = imageCollection.IndexOf(App.imagePassed); pivotIndex = 0; currentImage = null; if (imageCollection.Count == 1) { pivotNum = 1; } else { pivotNum = 3; } panoramaItems = new PanoramaItem[pivotNum]; images = new Image[pivotNum]; progressBars = new ProgressBar[pivotNum]; grids = new Grid[pivotNum]; for (int i = 0; i < pivotNum; i++) { panoramaItems[i] = new PanoramaItem(); images[i] = new Image(); images[i].Tap += onImageTap; progressBars[i] = new ProgressBar(); progressBars[i].Foreground = new SolidColorBrush(Colors.White); progressBars[i].IsIndeterminate = true; progressBars[i].Visibility = System.Windows.Visibility.Collapsed; grids[i] = new Grid(); grids[i].Children.Add(progressBars[i]); grids[i].Children.Add(images[i]); panoramaItems[i].Content = grids[i]; panorama.Items.Add(panoramaItems[i]); } panorama.SelectionChanged += Pivot_SelectionChanged; createApplicationBar(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { string type = this.NavigationContext.QueryString["q"]; // change the title to query string. this.LayoutRoot.Children.Clear(); //Initializing the Panorama Control and Assigning base values Panorama panoramactrl = new Panorama(); panoramactrl.Title = type; string[] types = { "草原", "花卉", "建筑", "山景", "水景", "夜景" }; int nResIdx = 0; for (int j = 0; j < types.Length; j++) { if (types[j].Equals(type)) { nResIdx = j; break; } } for (int i = 1; i <= 3; i++) { //Initializing the Panorama Control Items PanoramaItem panoramaCtrlItem = new PanoramaItem(); panoramaCtrlItem.Header = type + i.ToString(); //Initializing Textblock to display some text Image img = new Image(); string fname = "/Assets/" + nResIdx + "/" + i.ToString() + ".jpg"; img.Source = new BitmapImage(new Uri(fname, UriKind.Relative)); panoramaCtrlItem.Content = img; panoramactrl.Items.Add(panoramaCtrlItem); } this.LayoutRoot.Children.Add(panoramactrl); }
private void vgroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { // possible states: "CompressionTop", "NoVerticalCompression" Period period; ListBox WorkListBox = null; PanoramaItem pi = FindParentRecursive(sender as FrameworkElement, typeof(PanoramaItem)) as PanoramaItem; if (pi == Day) { period = Period.Day; WorkListBox = PostsDay; } else if (pi == Week) { period = Period.Week; } else if (pi == Month) { period = Period.Month; } else { period = Period.Now; WorkListBox = PostsNow; } if (!busyPicsLoader[(int)period]) { if (e.NewState.Name == "CompressionBottom") { UIElement pb = FindElementRecursive(lastPosts[(int)period] as FrameworkElement, typeof(ProgressBar)); pb.Visibility = Visibility.Visible; busyPicsLoader[(int)period] = true; PData.GetPosts(period); } } }
public void setupBrowsers() { ViewModels.TheModel TM = ViewModels.TheModel.GetModel(); pis = new PanoramaItem[TM.selectedCount]; browsers = new WebBrowser[TM.selectedCount]; DataTemplate dt = (DataTemplate)App.Current.Resources["SmallPanoramaItemTitle"]; for (int i = 0, j = 0; i < TM.linkCount; i++) { if (!TM.linksSelected[i]) continue; int mySelectedIndex = j; int myIndex = i; j++; pis[mySelectedIndex] = new PanoramaItem(); pis[mySelectedIndex].Header = ""; pis[mySelectedIndex].HeaderTemplate = dt; browsers[mySelectedIndex] = new WebBrowser(); browsers[mySelectedIndex].Source = new Uri(TM.links[i]); browsers[mySelectedIndex].IsScriptEnabled = true; browsers[mySelectedIndex].Margin = new Thickness(0, -25, 0, 0); browsers[mySelectedIndex].Navigated += new EventHandler<NavigationEventArgs>((object sender, NavigationEventArgs e) => { WebBrowser b = (WebBrowser)sender; TM.links[myIndex] = b.Source.ToString(); }); pis[mySelectedIndex].Content = browsers[mySelectedIndex]; MainPanorama.Items.Add(pis[mySelectedIndex]); pis[mySelectedIndex].GotFocus += new RoutedEventHandler((object o, RoutedEventArgs a) => { TM.defaultPanoramaItem = mySelectedIndex; }); } }
private void LoadImages() { MediaLibrary ml = new MediaLibrary(); List <Picture> pc = ml.Pictures.Where(x => x.Name.Contains("_stickie")).ToList <Picture>(); foreach (var item in pc) { Image img = new Image(); BitmapImage bi = new BitmapImage(); bi.SetSource(item.GetImage()); img.Source = bi; img.Name = Guid.NewGuid().ToString(); img.Width = bi.PixelWidth; img.Height = bi.PixelHeight; PanoramaItem pi = new PanoramaItem() { Content = img }; pi.Tap += pi_Tap; panorama1.Items.Add(pi); } }
// Constructor public MainPage() { InitializeComponent(); _inProgressPano = InProgressPano; _userViewsPano = UserViews; _libraryFoldersPano = LibraryFolders; _libraryViewsPano = LibraryViews; ShowHideInProgress(false); ShowHideViewPanos(); Messenger.Default.Register <NotificationMessage>(this, m => { if (m.Notification.Equals(Constants.Messages.ShowHideInProgressMsg)) { var showInProgress = (bool)m.Sender; ShowHideInProgress(showInProgress); } if (m.Notification.Equals(Constants.Messages.UseLibraryFoldersMsg)) { ShowHideViewPanos(); } }); }
// Constructor public MainPage() { InitializeComponent(); _inProgressPano = InProgressPano; _userViewsPano = UserViews; _libraryFoldersPano = LibraryFolders; _libraryViewsPano = LibraryViews; ShowHideInProgress(false); ShowHideViewPanos(); Messenger.Default.Register<NotificationMessage>(this, m => { if (m.Notification.Equals(Constants.Messages.ShowHideInProgressMsg)) { var showInProgress = (bool) m.Sender; ShowHideInProgress(showInProgress); } if (m.Notification.Equals(Constants.Messages.UseLibraryFoldersMsg)) { ShowHideViewPanos(); } }); }
private void UnpackContent() { // creating children List <FieldList> children = Content.GetItems <FieldList>(NaviAgentFieldID.BlockData); AtomicBlock title = null; List <AtomicBlock> itemTitles = new List <AtomicBlock>(); List <FrameBlock> items = new List <FrameBlock>(); for (int i = 0; i < children.Count; i++) { int childDefinitionID = children[i][MessageOutFieldID.DefinitionID].AsInteger() ?? 0; DefinitionBase definition = Core.Definitions.Find(ParentNode.ApplicationID, childDefinitionID, true); if ((definition != null) && (definition is BlockDefinition)) { BlockBase newBlock = Core.UIFactory.CreateAndInitialiseBlock(Host, ParentNode, this, definition as BlockDefinition, children[i], false); if (newBlock != null) { if (newBlock is AtomicBlock) { if (((BlockDefinition)definition).HintedType == UIHintedType.PanoramaTitle) { title = (AtomicBlock)newBlock; } else { itemTitles.Add((AtomicBlock)newBlock); } } else if (newBlock is FrameBlock) { items.Add((FrameBlock)newBlock); } } } } if ((title != null) && !String.IsNullOrWhiteSpace(title.Caption) && (itemTitles.Count > 0) && (items.Count > 0) && (itemTitles.Count == items.Count)) { panorama = new Panorama(); panorama.Title = title.Caption; for (int i = 0; i < items.Count; i++) { PanoramaItem item = new PanoramaItem(); item.Header = !String.IsNullOrWhiteSpace(itemTitles[i].Caption) ? itemTitles[i].Caption : WaveConstant.UnknownText; item.Content = items[i]; panorama.Items.Add(item); } if ((ContainerDefinition != null) && ContainerDefinition.Background.HasValue) { PaintStyleResult bgRes = ResolvePaintStyle(ContainerDefinition.Background.Value); if (bgRes.Brush != null) { panorama.Background = bgRes.Brush; } } Children.Add(panorama); for (int i = 0; i < items.Count; i++) { WaveChildren.Add(items[i]); } } }
private void UpdateButtonsByPanoramaItem(PanoramaItem panoramaSelected) { if (panoramaSelected != null) { if (panoramaSelected.Name == "TasksPanoramaItem" && !mainApplicationBar.Buttons.Contains(filterButton)) { mainApplicationBar.Buttons.Add(filterButton); } else if (panoramaSelected.Name == "StatusPanoramaItem" && !mainApplicationBar.Buttons.Contains(syncButton)) { mainApplicationBar.Buttons.Add(syncButton); } else if (panoramaSelected.Name == "ProjectsPanoramaItem" && !mainApplicationBar.Buttons.Contains(addProjectIconButton) && !mainApplicationBar.Buttons.Contains(updateAllIconButton)) { mainApplicationBar.Buttons.Add(updateAllIconButton); mainApplicationBar.Buttons.Add(addProjectIconButton); } else if (panoramaSelected.Name == "NewsPanoramaItem" && !mainApplicationBar.Buttons.Contains(updateNewsIconButton)) { mainApplicationBar.Buttons.Add(updateNewsIconButton); } } }
public void updateUi() { IsolatedStorageFileStream file = new IsolatedStorageFileStream("coin.xml", FileMode.Open, IsolatedStorageFile.GetUserStoreForApplication()); XDocument doc = XDocument.Load(file); file.Close(); XElement root = (from cur in doc.Descendants("{http://www.ecb.int/vocabulary/2002-08-01/eurofxref}Cube") select cur).FirstOrDefault(); XElement subroot = root.Elements().FirstOrDefault(); foreach (XElement currency in subroot.DescendantNodes()) { String name = currency.Attribute("currency").Value; if (!filter.Contains(name.ToLower())) { continue; } float value; if (float.TryParse(currency.Attribute("rate").Value, out value)) { currencies.Add(name, value); } } for (int i = 0; i < currencies.Count; i++) { String fromName = currencies.ElementAt(i).Key.ToString(); String fromValue = currencies.ElementAt(i).Value.ToString(); PanoramaItem temp = new PanoramaItem() { Header = fromName, Name = "panoramaItem" + fromName }; Grid innerGrid = new Grid() { Name = "innerGrid" + fromName }; innerGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(80) }); innerGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(290) }); innerGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100, GridUnitType.Auto) }); TextBox tempTextBox = new TextBox() { Name = fromName }; tempTextBox.TextChanged += new TextChangedEventHandler(textChangedHandler); InputScopeNameValue numbersOnly = InputScopeNameValue.TelephoneNumber; tempTextBox.InputScope = new InputScope() { Names = { new InputScopeName() { NameValue = numbersOnly } } }; innerGrid.Children.Add(tempTextBox); Grid.SetRow(tempTextBox, 0); ScrollViewer tempScroll = new ScrollViewer() { Name = "scroll" + fromName }; Grid tempGrid = new Grid(); int rowIndex = 0; for (int j = 0; j < currencies.Count; j++) { if (i != j) { tempGrid.RowDefinitions.Add(new RowDefinition()); StackPanel tempStack = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal }; Image tempImage = new Image() { Source = new BitmapImage(new Uri("../images/" + currencies.ElementAt(j).Key.ToString() + ".png", UriKind.Relative)), Stretch = Stretch.Fill, Width = 70, Height = 45, Margin = new Thickness(10) }; tempStack.Children.Add(tempImage); TextBlock tempText = new TextBlock() { Name = "textBlockFrom" + fromName + "For" + currencies.ElementAt(j).Key.ToString(), Text = currencies.ElementAt(j).Key.ToString() + " = ...", FontSize = 42 }; tempStack.Children.Add(tempText); tempGrid.Children.Add(tempStack); Grid.SetRow(tempStack, rowIndex); rowIndex++; } } tempScroll.Content = tempGrid; innerGrid.Children.Add(tempScroll); Grid.SetRow(tempScroll, 1); temp.Content = innerGrid; RootView.Items.Add(temp); AdControl.TestMode = false; //ApplicationID = "4fd1b245-b648-44de-add5-1a6408f4618a", AdUnitID = "10016135", //AdModel = Contextual, RotationEnabled = true AdControl adControl = new AdControl("4fd1b245-b648-44de-add5-1a6408f4618a", // ApplicationID "10016135", // AdUnitID AdModel.Contextual, // AdModel true); // RotationEnabled // Make the AdControl size large enough that it can contain the image adControl.Width = 300; adControl.Height = 80; innerGrid.Children.Add(adControl); Grid.SetRow(adControl, rowIndex++); } }
private void updateUi() { DataTemplate eventsListItemTemplate = (DataTemplate)XamlReader.Load( "<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'>" + "<StackPanel Orientation=\"Vertical\">" + "<TextBlock Text=\"{Binding ArtistNameUpper}\" TextWrapping=\"Wrap\" FontSize=\"48\" FontWeight=\"Bold\" Foreground=\"White\"/>" + "<TextBlock Text=\"{Binding EventDateAndLocation}\" TextWrapping=\"Wrap\" FontSize=\"22\" Foreground=\"#FF1BA1E2\"/>" + "</StackPanel>" + "</DataTemplate>"); ListBox eventsListBox = new ListBox() { Name = "eventsListBox", ItemTemplate = eventsListItemTemplate }; eventsListBox.Items.Clear(); foreach (Event tempEvent in this.events) { eventsListBox.Items.Add(tempEvent); } eventsListBox.SelectionChanged += new SelectionChangedEventHandler(eventsListBox_SelectionChanged); DataTemplate artistsListItemTemplate = (DataTemplate)XamlReader.Load( "<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'>" + "<TextBlock Text=\"{Binding NameUpper}\" TextWrapping=\"Wrap\" FontSize=\"48\" FontWeight=\"Bold\" Foreground=\"White\"/>" + "</DataTemplate>"); ListBox artistsListBox = new ListBox() { Name = "artistsListBox", ItemTemplate = artistsListItemTemplate }; artistsListBox.Items.Clear(); foreach (Artist tempArtist in this.artists) { artistsListBox.Items.Add(tempArtist); } artistsListBox.SelectionChanged += new SelectionChangedEventHandler(artistsListBox_SelectionChanged); DataTemplate venuesListItemTemplate = (DataTemplate)XamlReader.Load( "<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'>" + "<StackPanel Orientation=\"Vertical\">" + "<TextBlock Text=\"{Binding ShortNameUpper}\" TextWrapping=\"Wrap\" FontSize=\"48\" FontWeight=\"Bold\" Foreground=\"White\"/>" + "<TextBlock Text=\"{Binding CityAndRegion}\" TextWrapping=\"Wrap\" FontSize=\"22\" Foreground=\"#FFF09609\"/>" + "</StackPanel>" + "</DataTemplate>"); ListBox venuesListBox = new ListBox() { Name = "venuesListBox", ItemTemplate = venuesListItemTemplate }; venuesListBox.Items.Clear(); foreach (Venue tempVenue in this.venues) { venuesListBox.Items.Add(tempVenue); } venuesListBox.SelectionChanged += new SelectionChangedEventHandler(venuesListBox_SelectionChanged); PanoramaItem eventsPage = (PanoramaItem)this.FindName("eventsPage"); PanoramaItem artistsPage = (PanoramaItem)this.FindName("artistsPage"); PanoramaItem venuesPage = (PanoramaItem)this.FindName("venuesPage"); eventsPage.Content = eventsListBox; artistsPage.Content = artistsListBox; venuesPage.Content = venuesListBox; }
private void RequestCompleted(object sender, DownloadStringCompletedEventArgs e) { if (e.Error == null) { XDocument oXDocTemp = XDocument.Parse(e.Result); //Go to Carrier Level foreach (XElement oCarrierXElement in oXDocTemp.Root .Elements("Carrier")) { //Pick that Carrier if ((string)oCarrierXElement.Attribute("Name").Value == "Go Phone") { // Get and add the Plan Info XElement oPlanInfoXElement = oCarrierXElement.Element("PlanInfo"); PanoramaItem oNewCarrierInfoItem = new PanoramaItem(); //set the background color and opacity of the Info oNewCarrierInfoItem.Background = new SolidColorBrush(Color.FromArgb(127, 33, 31, 31)); // Set my new panorama item properties oNewCarrierInfoItem.Header = oCarrierXElement.Attribute("Name").Value; Carrier_Page.Items.Add(oNewCarrierInfoItem); PanoramaGrid2 oGrid2 = new PanoramaGrid2(); oGrid2.Name = "PlanInfoGrid"; oNewCarrierInfoItem.Content = oGrid2; //for pages with info //string i = ""; string s = oPlanInfoXElement.Attribute("Retail_Stores").Value; string t = oPlanInfoXElement.Attribute("Type").Value; string n = oPlanInfoXElement.Attribute("Name").Value; string p = oPlanInfoXElement.Attribute("ParentCO").Value; string tel = oPlanInfoXElement.Attribute("TEL").Value; string w = oPlanInfoXElement.Attribute("Website").Value; //for pages with info //i = (string)oChildElement.Attribute("Info").Value; oGrid2.RetailAvail.Text = s; oGrid2.Celltype.Text = t; PlanInfo.Header = n; oGrid2.ParentC.Text = p; oGrid2.Telo1.Content = tel; oGrid2.Website.Content = w; //special sets the title from our own text for specific pages so we only load a generic page //Carrier_Page.Title = "U Prepaid"; //for pages with info //Infobox.Text = i; int iCount = 0; foreach (XElement oPlanXElement in oCarrierXElement.Elements("Plan")) { iCount++; //for pages with info //string i = ""; string sName = oPlanXElement.Element("Name").Value; string sData = oPlanXElement.Element("Data").Value; string sInfo = oPlanXElement.Element("Info").Value; // Get and add the Plan Info PanoramaItem oNewItem = new PanoramaItem(); //set the background color and opacity of all Panorama Items oNewItem.Background = new SolidColorBrush(Color.FromArgb(127, 33, 31, 31)); // Header oNewItem.Header = sName; // Add Feature Text Block PanoramaGrid oGrid = new PanoramaGrid(); oGrid.Name = "PlanGridDynamic" + iCount; oNewItem.Content = oGrid; oGrid.Additional_Info.Text = sInfo; oGrid.Data_Allotment.Text = sData; // Get and add the Features Info //XElement oFeaturesXElement = oPlanXElement.Element("Features"); foreach (XElement oFeaturesXElement in oPlanXElement.Elements("Features")) { string sPara = oFeaturesXElement.Element("Feature").Value; FeaturesPara.Inlines.Add(new Run() { Text = sPara }); //oGrid.FeaturesPara.Text = sPara; } // Set my new panorama item properties try { Carrier_Page.Items.Add(oNewItem); } catch (Exception oEx) { string str = oEx.Message; } //special sets the title from our own text for specific pages so we only load a generic page //Carrier_Page.Title = "U Prepaid"; //for pages with info //Infobox.Text = i; } } } } }
private void executeUpgrade() { removeTrialModeFromMenu(); PanoramaItem[] tempSug = new PanoramaItem[_basePanorama.Items.Count]; for (int i = 0; i < _basePanorama.Items.Count; ++i) { var item = _basePanorama.Items[i] as PanoramaItem; if (item != null) { tempSug[i] = item; } } _basePanorama.Items.Clear(); foreach (var item in tempSug) { var tcm = item.Content as TrialModeCtl; if (tcm == null) { _basePanorama.Items.Add(item); } } List<SuggestionList> listOfLists = App.Config.Lists; foreach (SuggestionList list in listOfLists.Where(lol => !lol.IsTrialList && lol.IsVisible)) { loadSuggestionListToUI(_basePanorama, ApplicationBar, newItem_Click, list); } App.Config.SaveXmlToFileInIS(); }
private void newItem_Click(object sender, EventArgs e) { MyApplicationBarMenuItem s = (MyApplicationBarMenuItem)sender; PanoramaItem[] tempSug = new PanoramaItem[_basePanorama.Items.Count]; int selectedItemIndex = -1; for (int i = 0; i < _basePanorama.Items.Count; ++i) { var item = _basePanorama.Items[i] as PanoramaItem; if (item != null) { tempSug[i] = item; if (item == s.MyPanoramaItem) { selectedItemIndex = i; } } } _basePanorama.Items.Clear(); foreach (var item in tempSug) { _basePanorama.Items.Add(item); } if (selectedItemIndex != -1) { _basePanorama.DefaultItem = _basePanorama.Items[selectedItemIndex]; } System.Diagnostics.Debug.WriteLine(sender.ToString()); }
public void updateUi() { IsolatedStorageFileStream file = new IsolatedStorageFileStream("coin.xml", FileMode.Open, IsolatedStorageFile.GetUserStoreForApplication()); XDocument doc = XDocument.Load(file); file.Close(); XElement root = (from cur in doc.Descendants("{http://www.ecb.int/vocabulary/2002-08-01/eurofxref}Cube") select cur).FirstOrDefault(); XElement subroot = root.Elements().FirstOrDefault(); foreach (XElement currency in subroot.DescendantNodes()) { String name = currency.Attribute("currency").Value; if (!filter.Contains(name.ToLower())) { continue; } float value; if (float.TryParse(currency.Attribute("rate").Value, out value)) { currencies.Add(name, value); } } for (int i = 0; i < currencies.Count; i++) { String fromName = currencies.ElementAt(i).Key.ToString(); String fromValue = currencies.ElementAt(i).Value.ToString(); PanoramaItem temp = new PanoramaItem() { Header = fromName, Name = "panoramaItem" + fromName}; Grid innerGrid = new Grid() { Name = "innerGrid" + fromName}; innerGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(80)}); innerGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(290)}); innerGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100, GridUnitType.Auto)}); TextBox tempTextBox = new TextBox() { Name = fromName }; tempTextBox.TextChanged += new TextChangedEventHandler(textChangedHandler); InputScopeNameValue numbersOnly = InputScopeNameValue.TelephoneNumber; tempTextBox.InputScope = new InputScope() { Names = {new InputScopeName() {NameValue = numbersOnly}} }; innerGrid.Children.Add(tempTextBox); Grid.SetRow(tempTextBox, 0); ScrollViewer tempScroll = new ScrollViewer() { Name = "scroll" + fromName }; Grid tempGrid = new Grid(); int rowIndex = 0; for (int j = 0; j < currencies.Count; j++) { if (i != j) { tempGrid.RowDefinitions.Add(new RowDefinition()); StackPanel tempStack = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal }; Image tempImage = new Image() { Source = new BitmapImage(new Uri("../images/" + currencies.ElementAt(j).Key.ToString() + ".png", UriKind.Relative)), Stretch=Stretch.Fill, Width= 70, Height=45, Margin = new Thickness(10) }; tempStack.Children.Add(tempImage); TextBlock tempText = new TextBlock() { Name = "textBlockFrom" + fromName + "For" + currencies.ElementAt(j).Key.ToString(), Text = currencies.ElementAt(j).Key.ToString() + " = ...", FontSize = 42 }; tempStack.Children.Add(tempText); tempGrid.Children.Add(tempStack); Grid.SetRow(tempStack, rowIndex); rowIndex++; } } tempScroll.Content = tempGrid; innerGrid.Children.Add(tempScroll); Grid.SetRow(tempScroll, 1); temp.Content = innerGrid; RootView.Items.Add(temp); AdControl.TestMode = false; //ApplicationID = "4fd1b245-b648-44de-add5-1a6408f4618a", AdUnitID = "10016135", //AdModel = Contextual, RotationEnabled = true AdControl adControl = new AdControl("4fd1b245-b648-44de-add5-1a6408f4618a", // ApplicationID "10016135", // AdUnitID AdModel.Contextual, // AdModel true); // RotationEnabled // Make the AdControl size large enough that it can contain the image adControl.Width = 300; adControl.Height = 80; innerGrid.Children.Add(adControl); Grid.SetRow(adControl, rowIndex++); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { //MyApplicationBarMenuItem s = (MyApplicationBarMenuItem)sender; //PanoramaItem[] tempSug = new PanoramaItem[_basePanorama.Items.Count]; //int selectedItemIndex = -1; //for (int i = 0; i < _basePanorama.Items.Count; ++i) //{ // var item = _basePanorama.Items[i] as PanoramaItem; // if (item != null) // { // tempSug[i] = item; // if (item == s.MyPanoramaItem) // { // selectedItemIndex = i; // } // } //} bool isSame = true; int nextItem = 0; var newList = App.Config.Lists.Where(l => l.IsVisible).OrderBy(l => l.SortPriority).ToList(); PanoramaItem[] tempSug = new PanoramaItem[newList.Count]; //foreach (var list in App.Config.Lists.Where(l => l.IsVisible).OrderBy(l => l.SortPriority)) foreach (var list in newList) { bool foundControl = false; for (int i = 0; i < _basePanorama.Items.Count; ++i) { var item = _basePanorama.Items[i] as PanoramaItem; var controlItem = item.Content as MakeSuggestionCtl; if ((controlItem != null) && (controlItem.Id == list.Id)) { if (nextItem != i) { isSame = false; } tempSug[nextItem++] = item; foundControl = true; break; } } if (!foundControl) { var sug = new MakeSuggestionCtl { Id = list.Id, FileName = list.ListFileName, PluralName = list.PluralName, SingularName = list.SingularName, HistoryCount = list.HistoryCount }; var panItem = new PanoramaItem { FontSize = 42 }; sug.DoSelect(); panItem.Content = sug; tempSug[nextItem++] = panItem; //foundControl = true; } } if (!isSame) { _basePanorama.Items.Clear(); foreach (var item in tempSug) { _basePanorama.Items.Add(item); } } //if (selectedItemIndex != -1) //{ // _basePanorama.DefaultItem = _basePanorama.Items[selectedItemIndex]; //} }
public void updateUi() { foreach (string name in EnumHelper.GetEnumStrings<MeasurementType>()) { PanoramaItem mainPanoramaPage = new PanoramaItem() { Name = "mainPanoramaPage" + name, Header = name, Foreground = new SolidColorBrush(Colors.Black) }; ScrollViewer scrollViewer = new ScrollViewer() { Name = "scrollViewer" + name, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden}; StackPanel innerStackPanel = new StackPanel() { Name = "innerStackPanel" + name }; TextBlock fromTextBlock = new TextBlock() { Name = "fromTextBlock" + name, Text = "from" }; TextBox inputTextBox = new TextBox() { Name = "inputTextBox" + name }; inputTextBox.TextChanged += new TextChangedEventHandler(textChangedHandler); InputScopeNameValue numbersOnly = InputScopeNameValue.TelephoneNumber; inputTextBox.InputScope = new InputScope() { Names = { new InputScopeName() { NameValue = numbersOnly } } }; DataTemplate fromFullModeItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\" FontSize=\"64\"/></DataTemplate>"); DataTemplate fromItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\"/></DataTemplate>"); ListPicker fromListPicker = new ListPicker { Name = "fromListPicker" + name, FullModeItemTemplate = fromFullModeItemTemplate, ItemTemplate = fromItemTemplate }; foreach (MeasurementUnit measurementUnit in measurementUnits) { if (measurementUnit.Type.ToString().Equals(name, StringComparison.OrdinalIgnoreCase)) { fromListPicker.Items.Add(measurementUnit); } } fromListPicker.SelectionChanged += new SelectionChangedEventHandler(selectionChangedHandler); TextBlock toTextBlock = new TextBlock() { Name = "toTextBlock" + name, Text = "to" }; DataTemplate toFullModeItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\" FontSize=\"64\"/></DataTemplate>"); DataTemplate toItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\"/></DataTemplate>"); ListPicker toListPicker = new ListPicker { Name = "toListPicker" + name, FullModeItemTemplate = toFullModeItemTemplate, ItemTemplate = toItemTemplate }; foreach (MeasurementObject measurementObject in measurementObjects) { if (measurementObject.Type.ToString().Equals(name, StringComparison.OrdinalIgnoreCase)) { toListPicker.Items.Add(measurementObject); } } toListPicker.SelectionChanged += new SelectionChangedEventHandler(selectionChangedHandler); TextBlock isAboutTextBlock = new TextBlock() { Name = "isAboutTextBlock" + name, Text = "is about", Visibility = System.Windows.Visibility.Collapsed }; TextBlock resultTextBlock = new TextBlock() { Name = "resultTextBlock" + name, FontSize = 64, TextAlignment = System.Windows.TextAlignment.Center, Visibility = System.Windows.Visibility.Collapsed, TextWrapping = TextWrapping.Wrap }; AdControl ad = new AdControl() { ApplicationId = "bb68fbc1-ad47-45b2-b045-0d5699d83b6b", AdUnitId = "10016008", Width = 300, Height = 50, Margin = new Thickness(20) }; innerStackPanel.Children.Add(fromTextBlock); innerStackPanel.Children.Add(inputTextBox); innerStackPanel.Children.Add(fromListPicker); innerStackPanel.Children.Add(toTextBlock); innerStackPanel.Children.Add(toListPicker); innerStackPanel.Children.Add(isAboutTextBlock); innerStackPanel.Children.Add(resultTextBlock); innerStackPanel.Children.Add(ad); scrollViewer.Content = innerStackPanel; mainPanoramaPage.Content = scrollViewer; mainView.Items.Add(mainPanoramaPage); } }
private void setUpPage() { int numFormParts = 0; pagePanorama.Title = page.FormPageHeader; List <PanoramaItem> itemList = new List <PanoramaItem>(); PanoramaItem panoramaItem = new PanoramaItem(); ScrollViewer scrollViewer = new ScrollViewer(); StackPanel stackPanel = new StackPanel(); scrollViewer.Content = stackPanel; ((PanoramaItem)FormPanorama.Items[numFormParts]).Content = scrollViewer; bool InOneLine = false; StackPanel OneLine = new StackPanel(); foreach (FormItem item in page.FormItemList) { if (item.ControlType == FormItemType.Header.ToString()) { item.State = FormItemState.Disabled.ToString(); //panoramaItem.Header = item.Header; //numFormParts++; if (numFormParts > 0) { //itemList.Add(panoramaItem); panoramaItem = new PanoramaItem(); stackPanel = new StackPanel(); scrollViewer = new ScrollViewer(); scrollViewer.Content = stackPanel; ((PanoramaItem)FormPanorama.Items[numFormParts]).Content = scrollViewer; ((PanoramaItem)FormPanorama.Items[numFormParts]).Header = item.Header; ((PanoramaItem)FormPanorama.Items[numFormParts]).Visibility = Visibility.Visible; } else { ((PanoramaItem)FormPanorama.Items[numFormParts]).Header = item.Header; } numFormParts++; } else { FrameworkElement element = elementFactory.getFrameworkElementFromItem(item, this); if (element != null) { if ((!item.IsEditedStateHeader || item.Input != "") && item.ShortHeader != "") { StackPanel ShortHeaderElement = new StackPanel(); ShortHeaderElement.Orientation = System.Windows.Controls.Orientation.Horizontal; TextBlock ShortHeader = new TextBlock(); Style tbStyle = (Style)App.resources["ShortHeader" + item.ShortHeaderSide]; if (tbStyle != null) { ShortHeader.Style = tbStyle; } else { Debug.WriteLine("Der Style für ShortHeaders ist nicht \"ShortHeader" + item.ShortHeaderSide + "\""); } ShortHeader.Text = item.ShortHeader; ShortHeader.Name = element.Name + "ShortHeader"; if (item.IsEditedStateHeader) { ShortHeader.Foreground = (SolidColorBrush)App.resources["ColorShortHeaderEdited"]; } ShortHeaderElement.Children.Add(element); if (item.ShortHeaderSide == FormItemShortHeaderSide.Left.ToString()) { ShortHeaderElement.Children.Insert(0, ShortHeader); } if (item.ShortHeaderSide == FormItemShortHeaderSide.Right.ToString()) { ShortHeaderElement.Children.Add(ShortHeader); } if (item.Input != "" && element.GetType() == typeof(TextBox)) { elementFactory.editedTextBox((TextBox)element, false); } element = ShortHeaderElement; } if (item.InLineWithNext) { if (InOneLine) { if (OneLine != null) { element.Margin = new Thickness(70, element.Margin.Top, element.Margin.Right, element.Margin.Bottom); } OneLine.Children.Add(element); } else { InOneLine = true; OneLine = new StackPanel(); OneLine.Orientation = System.Windows.Controls.Orientation.Horizontal; OneLine.Name = element.Name + "Panel"; OneLine.Children.Add(element); } } else { if (InOneLine) { element.Margin = new Thickness(70, element.Margin.Top, element.Margin.Right, element.Margin.Bottom); OneLine.Children.Add(element); stackPanel.Children.Add(OneLine); InOneLine = false; } else { stackPanel.Children.Add(element); } } if (item.Input != "" && element.GetType() == typeof(TextBox)) { elementFactory.editedTextBox((TextBox)element, false); } } else { Debug.WriteLine("Fehler beim generieren eines UIElements"); } } } //add Notes foreach (FormItem item in page.FormItemList) { if (item.Note != "") { makeANote(item.ID, item.Note); } } //itemList.Add(panoramaItem); //int i = 0; //while (i < itemList.Count) { // ((PanoramaItem)FormPanorama.Items[i]).Content = itemList.ElementAt(i).Content; // i++; //} }
void ParseRSSAndBindData(string RSSString, string Title) { try { XElement iNews = XElement.Parse(RSSString); var postList = from tweet in iNews.Descendants("item") select new PostMessage { title = tweet.Element("title").Value, mainImage = allFunc.GetImageFromPostContents(tweet.Element("description").Value), description = Regex.Replace(tweet.Element("description").Value, "<.*?>", String.Empty), pubDate = Convert.ToDateTime(tweet.Element("pubDate").Value).ToString(), link = tweet.Element("link").Value }; PanoramaItem iPanoramaItem = new PanoramaItem(); iPanoramaItem.Header = Title; iPanoramaItem.Orientation = System.Windows.Controls.Orientation.Horizontal; ScrollViewer iScrollViewer = new ScrollViewer(); StackPanel mStackPanel = new StackPanel(); mStackPanel.Margin = new Thickness(0, 4, 16, 0); mStackPanel.Orientation = System.Windows.Controls.Orientation.Vertical; mStackPanel.VerticalAlignment = System.Windows.VerticalAlignment.Top; SolidColorBrush backColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xDF, 0xD6, 0xAB)); SolidColorBrush foreColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x3A, 0x3A, 0x3A)); StackPanel firstStackPanel = new StackPanel(); StackPanel secondStackPanel = new StackPanel(); StackPanel thirdStackPanel = new StackPanel(); firstStackPanel.Orientation = System.Windows.Controls.Orientation.Horizontal; secondStackPanel.Orientation = System.Windows.Controls.Orientation.Horizontal; secondStackPanel.Margin = new Thickness(0, 12, 0, 0); thirdStackPanel.Orientation = System.Windows.Controls.Orientation.Horizontal; thirdStackPanel.Margin = new Thickness(0, 12, 0, 0); int i = 0; foreach (var iNew in postList) { HubTile iHubTile = new HubTile(); iHubTile.Margin = new Thickness(12, 0, 0, 0); iHubTile.Title = iNew.pubDate.ToString(); // Title; iHubTile.Message = iNew.title; iHubTile.Notification = iNew.title; iHubTile.Source = new BitmapImage(new Uri(iNew.mainImage, UriKind.Absolute)); iHubTile.Background = backColor; iHubTile.Foreground = foreColor; iHubTile.Tag = iNew.link; iHubTile.Tap += ShowWebNew; iHubTile.GroupTag = Title; iHubTile.Name = Title + i.ToString(); iHubTile.Size = TileSize.Medium; if (i > 6) { thirdStackPanel.Children.Add(iHubTile); } else if (i > 3) { secondStackPanel.Children.Add(iHubTile); } else { HubTileService.FreezeHubTile(iHubTile); firstStackPanel.Children.Add(iHubTile); } i++; } mStackPanel.Children.Add(firstStackPanel); mStackPanel.Children.Add(secondStackPanel); mStackPanel.Children.Add(thirdStackPanel); iScrollViewer.Content = mStackPanel; iPanoramaItem.Content = iScrollViewer; OneCity.Items.Add(iPanoramaItem); } catch { } }
private PanoramaItem panoramaItemFromSection(Section section) { PanoramaItem panoramaItem = new PanoramaItem(); ScrollViewer scrollViewer = new ScrollViewer(); panoramaItem.Content = scrollViewer; Grid grid = new Grid() { Margin = new Thickness(0, 10, 0, 0) }; grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); TextBlock headerText = new TextBlock() { Text = section.Header, FontFamily = new FontFamily("Segoe WP Black"), FontSize = 65, Foreground = new SolidColorBrush((Color)Resources["PhoneForegroundColor"]), HorizontalAlignment = System.Windows.HorizontalAlignment.Left }; Grid.SetRow(headerText, 0); grid.Children.Add(headerText); TextBlock captionText = new TextBlock() { Text = section.Caption, FontFamily = new FontFamily("Segoe WP Black"), FontSize = 20, Foreground = new SolidColorBrush((Color)Resources["PhoneForegroundColor"]), HorizontalAlignment = System.Windows.HorizontalAlignment.Right}; Grid.SetRow(captionText, 1); grid.Children.Add(captionText); Boolean alternate = section.AlternateSeed; for (int i = 0; i < section.Entries.Count; i++) { grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid.Children.Add(rowFromEntry(section.Entries[i], 2+i, alternate, section.DefaultColor, section.AlternateColor)); alternate = !alternate; } scrollViewer.Content = grid; return panoramaItem; }
public void updateUi() { foreach (string name in EnumHelper.GetEnumStrings <MeasurementType>()) { PanoramaItem mainPanoramaPage = new PanoramaItem() { Name = "mainPanoramaPage" + name, Header = name, Foreground = new SolidColorBrush(Colors.Black) }; ScrollViewer scrollViewer = new ScrollViewer() { Name = "scrollViewer" + name, VerticalScrollBarVisibility = ScrollBarVisibility.Hidden }; StackPanel innerStackPanel = new StackPanel() { Name = "innerStackPanel" + name }; TextBlock fromTextBlock = new TextBlock() { Name = "fromTextBlock" + name, Text = "from" }; TextBox inputTextBox = new TextBox() { Name = "inputTextBox" + name }; inputTextBox.TextChanged += new TextChangedEventHandler(textChangedHandler); InputScopeNameValue numbersOnly = InputScopeNameValue.TelephoneNumber; inputTextBox.InputScope = new InputScope() { Names = { new InputScopeName() { NameValue = numbersOnly } } }; DataTemplate fromFullModeItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\" FontSize=\"64\"/></DataTemplate>"); DataTemplate fromItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\"/></DataTemplate>"); ListPicker fromListPicker = new ListPicker { Name = "fromListPicker" + name, FullModeItemTemplate = fromFullModeItemTemplate, ItemTemplate = fromItemTemplate }; foreach (MeasurementUnit measurementUnit in measurementUnits) { if (measurementUnit.Type.ToString().Equals(name, StringComparison.OrdinalIgnoreCase)) { fromListPicker.Items.Add(measurementUnit); } } fromListPicker.SelectionChanged += new SelectionChangedEventHandler(selectionChangedHandler); TextBlock toTextBlock = new TextBlock() { Name = "toTextBlock" + name, Text = "to" }; DataTemplate toFullModeItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\" FontSize=\"64\"/></DataTemplate>"); DataTemplate toItemTemplate = (DataTemplate)XamlReader.Load("<DataTemplate xmlns='http://schemas.microsoft.com/client/2007'><TextBlock Text=\"{Binding Name}\"/></DataTemplate>"); ListPicker toListPicker = new ListPicker { Name = "toListPicker" + name, FullModeItemTemplate = toFullModeItemTemplate, ItemTemplate = toItemTemplate }; foreach (MeasurementObject measurementObject in measurementObjects) { if (measurementObject.Type.ToString().Equals(name, StringComparison.OrdinalIgnoreCase)) { toListPicker.Items.Add(measurementObject); } } toListPicker.SelectionChanged += new SelectionChangedEventHandler(selectionChangedHandler); TextBlock isAboutTextBlock = new TextBlock() { Name = "isAboutTextBlock" + name, Text = "is about", Visibility = System.Windows.Visibility.Collapsed }; TextBlock resultTextBlock = new TextBlock() { Name = "resultTextBlock" + name, FontSize = 64, TextAlignment = System.Windows.TextAlignment.Center, Visibility = System.Windows.Visibility.Collapsed, TextWrapping = TextWrapping.Wrap }; AdControl ad = new AdControl() { ApplicationId = "bb68fbc1-ad47-45b2-b045-0d5699d83b6b", AdUnitId = "10016008", Width = 300, Height = 50, Margin = new Thickness(20) }; innerStackPanel.Children.Add(fromTextBlock); innerStackPanel.Children.Add(inputTextBox); innerStackPanel.Children.Add(fromListPicker); innerStackPanel.Children.Add(toTextBlock); innerStackPanel.Children.Add(toListPicker); innerStackPanel.Children.Add(isAboutTextBlock); innerStackPanel.Children.Add(resultTextBlock); innerStackPanel.Children.Add(ad); scrollViewer.Content = innerStackPanel; mainPanoramaPage.Content = scrollViewer; mainView.Items.Add(mainPanoramaPage); } }
private static MakeSuggestionCtl addMakeSuggestionCtlToPanorama(Panorama para, IApplicationBar applicationBar, int id, string header, string fileName, string pluralName, string singularName, int historyCount, EventHandler newItemClick) { var item = new PanoramaItem { FontSize = 42 }; var sug = new MakeSuggestionCtl { Id = id, FileName = fileName, PluralName = pluralName, SingularName = singularName, HistoryCount = historyCount }; sug.DoSelect(); item.Content = sug; para.Items.Add(item); var newItem = new MyApplicationBarMenuItem { Text = pluralName, MyMakeSuggestionCtl = sug, MyPanoramaItem = item }; newItem.Click += newItemClick; applicationBar.MenuItems.Add(newItem); return sug; }
private void addTrialModeCtlToPanorama(Panorama para, IApplicationBar applicationBar, string header) { var item = new PanoramaItem { FontSize = 42 }; var tmc = new TrialModeCtl(); item.Content = tmc; para.Items.Add(item); var newItem = new MyApplicationBarMenuItem { Text = header, MyPanoramaItem = item }; newItem.Click += newItem_Click; applicationBar.MenuItems.Add(newItem); }
/// <summary> /// Process Json result from bugzilla API /// </summary> /// <param name="item"></param> private void ProcessBugZillaResults(JObject item) { var store = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication(); PanoramaItem pItem = (PanoramaItem)PanoView.FindName(item["slug"].ToString()); if (pItem == null) { pItem = new PanoramaItem(); pItem.Name = item["slug"].ToString(); pItem.Header = item["query"].ToString(); PanoView.Items.Add(pItem); } pItem.Hold += new EventHandler<GestureEventArgs>((object sender, GestureEventArgs ge) => { store.DeleteFile(item["filename"].ToString()); PanoView.Items.Remove(this); // is this enough for it to be garbage collected? }); var lb = new ListBox(); var items = ((JArray)((JObject)item)["bugs"]).Select(bug => new BugzillaItem(bug)); foreach (var b in items) { ListBoxItem li = CreateBugzillaListItem(b); lb.Items.Add(li); } pItem.Content = lb; }
public void UpdateFavoriteLinks(PanoramaItem recentItemContent, PhoneApplicationPage page, Grid sourceProvider) { if (!this.customizedTallyViewModel.HasLoadItemsInStarupPage) { System.Threading.ThreadPool.QueueUserWorkItem(delegate(object o) { System.Action a = null; if (this.isStartLoadingSummary) { while (!this.IsSummaryListLoaded) { } } if (!this.customizedTallyViewModel.HasLoadItemsInStarupPage) { this.customizedTallyViewModel.LoadItemsInStartupPage(); } bool isSummaryListLoaded = this.IsSummaryListLoaded; if (!this.hasLoadRencentItems) { if (a == null) { a = delegate { RoutedEventHandler handler = null; DataTemplate template = page.Resources["Original"] as DataTemplate; ItemsPanelTemplate template2 = page.Resources["RecentItemsPanelTemp"] as ItemsPanelTemplate; if (ViewModelLocator.CustomizedTallyViewModel.FavoritesList.Count > 0) { ListBox element = new ListBox { ItemTemplate = template, ItemsSource = ViewModelLocator.CustomizedTallyViewModel.FavoritesList }; ScrollViewer.SetVerticalScrollBarVisibility(element, ScrollBarVisibility.Disabled); element.ItemsPanel = template2; recentItemContent.Content = element; this.hasLoadRencentItems = true; } else { StackPanel panel = new StackPanel { Orientation = Orientation.Vertical }; HyperlinkButton button = new HyperlinkButton { Style = Application.Current.Resources["HyperlinkEmptyStyle"] as Style }; if (handler == null) { handler = delegate(object o1, RoutedEventArgs e1) { page.NavigationService.Navigate(new Uri("/Pages/AppSettingPage/PreferenceSettingPage.xaml?goto={0}".FormatWith(new object[] { 1 }), UriKind.RelativeOrAbsolute)); }; } button.Click += handler; TextBlock block = new TextBlock { Text = AppResources.PreferenceSetting_AddRule.ToLowerInvariant(), Style = Application.Current.Resources["PhoneTextLargeStyle"] as Style, Foreground = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush }; button.Content = block; panel.Children.Add(button); recentItemContent.Content = panel; } }; } page.Dispatcher.BeginInvoke(a); } }); } }