private void RichEditBox_SetFocus(PivotItem pi)
        {
            RichEditBox reb = pi.Content as RichEditBox;

            reb.Focus(FocusState.Keyboard);
            journalEntry = new JournalEntry(reb);
        }
Example #2
0
        void appBarIconBtnSelect_Click(object sender, EventArgs e)
        {
            PivotItem             pivotItem = LockScreenPivot.SelectedItem as PivotItem;
            LongListMultiSelector selector  = GetSelectorByPivotName(pivotItem.Name);

            selector.EnforceIsSelectionEnabled = !selector.EnforceIsSelectionEnabled;
        }
Example #3
0
 public void InitializeComponent()
 {
     if (this._contentLoaded)
     {
         return;
     }
     this._contentLoaded = true;
     Application.LoadComponent(this, new Uri("/VKClient.Common;component/FavoritesPage.xaml", UriKind.Relative));
     this.LayoutRoot        = (Grid)base.FindName("LayoutRoot");
     this.ucHeader          = (GenericHeaderUC)base.FindName("ucHeader");
     this.pivot             = (Pivot)base.FindName("pivot");
     this.pivotItemPhotos   = (PivotItem)base.FindName("pivotItemPhotos");
     this.photosListBox     = (ExtendedLongListSelector)base.FindName("photosListBox");
     this.pivotItemVideos   = (PivotItem)base.FindName("pivotItemVideos");
     this.videosListBox     = (ExtendedLongListSelector)base.FindName("videosListBox");
     this.pivotItemPosts    = (PivotItem)base.FindName("pivotItemPosts");
     this.scrollPosts       = (ViewportControl)base.FindName("scrollPosts");
     this.stackPanelPosts   = (MyVirtualizingStackPanel)base.FindName("stackPanelPosts");
     this.panelPosts        = (MyVirtualizingPanel2)base.FindName("panelPosts");
     this.pivotItemPersons  = (PivotItem)base.FindName("pivotItemPersons");
     this.usersListBox      = (ExtendedLongListSelector)base.FindName("usersListBox");
     this.pivotItemLinks    = (PivotItem)base.FindName("pivotItemLinks");
     this.linksListBox      = (ExtendedLongListSelector)base.FindName("linksListBox");
     this.pivotItemProducts = (PivotItem)base.FindName("pivotItemProducts");
     this.productsListBox   = (ExtendedLongListSelector)base.FindName("productsListBox");
     this.ucPullToRefresh   = (PullToRefreshUC)base.FindName("ucPullToRefresh");
 }
Example #4
0
        private async void pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            PivotItem st  = pivot.SelectedItem as PivotItem;
            string    tag = st.Tag.ToString();

            switch (tag)
            {
            case "video":
            {
                await LoadItem(list_videos, SearchType.Videos);
            } break;

            case "fanju":
            {
                await LoadItem(list_fanju, SearchType.Animes);
            }
            break;

            case "up":
            {
                await LoadItem(list_up, SearchType.Ups);
            }
            break;
            }
        }
Example #5
0
        private void AllChannels_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ChannelInfo info = AllChannels.SelectedItem as ChannelInfo;

            if (info != null)
            {
                if (info.libId == "0")
                {
                    for (int i = 0; i < MainPivot.Items.Count; i++)
                    {
                        PivotItem   pivotItem   = MainPivot.Items[i] as PivotItem;
                        ChannelInfo channelinfo = pivotItem.DataContext as ChannelInfo;
                        if (channelinfo != null && channelinfo.channelId == info.channelId)
                        {
                            MainPivot.SelectedIndex = i;
                            return;
                        }
                        MoreSubject.subjectId     = info.channelId;
                        MoreSubject.speicalName   = info.channelName;
                        MoreSubject.isMoreChannel = true;
                        MoreSubject.channelType   = info.type;
                        CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.SpecialPageName, UriKind.Relative));
                    }
                }
                else
                {
                    MoreChannelInfo.typeId = info.libId;
                    MoreChannelInfo.name   = info.channelName;
                    this.NavigationService.Navigate(new Uri(CommonData.MoreChannelPageName, UriKind.Relative));
                }
            }
        }
        private void rootPivot_GotFocus(object sender, RoutedEventArgs e)
        {
            Pivot     p  = sender as Pivot;
            PivotItem pi = p.SelectedItem as PivotItem;

            RichEditBox_SetFocus(pi);
        }
Example #7
0
        private void RichEditBox_SetFocus(PivotItem pi)
        {
            RichEditBox reb = pi.Content as RichEditBox;

            reb.Focus(FocusState.Keyboard);
            currentJournalEntries.GetSelectedEntry(pi.Header.ToString());
        }
        public CategoryDetailPage()
        {
            InitializeComponent();

            var textblock = new TextBlock { Text = "header 1", FontSize = 36 };
            var pivotItem = new PivotItem() { Header = textblock };
            var grid = new Grid();
            var listBox = new ListBox()
                              {
                                  HorizontalAlignment = HorizontalAlignment.Stretch,
                                  VerticalAlignment = VerticalAlignment.Stretch,
                                  Margin = new Thickness(0)
                              };
            for (int i = 0; i < 10; i++)
            {
                var newsTitle = new NewsTitleControl();
                listBox.Items.Add(newsTitle);
            }
            grid.Children.Add(listBox);
            pivotItem.Content = grid;
            PivotContainer.Items.Add(pivotItem);
            var textblock2 = new TextBlock { Text = "header 2", FontSize = 36 };
            var pivotItem2 = new PivotItem() { Header = textblock2 };
            PivotContainer.Items.Add(pivotItem2);
        }
Example #9
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this._sortSharedItemsButton        = (AppBarButton)this.GetTemplateChild("PART_BtnSortSharedItems");
            this._removeContact                = (Button)this.GetTemplateChild("PART_RemoveContactButton");
            this._sharedItems                  = (ListView)this.GetTemplateChild("PART_ListViewSharedItems");
            this._pivotControl                 = (Pivot)this.GetTemplateChild("PART_PivotControl");
            this._sharedItemsPivot             = (PivotItem)this.GetTemplateChild("PART_SharedItemsPivot");
            this._sharedItemsTopCommandBarArea = (Grid)this.GetTemplateChild("PART_SharedItemsTopCommandBarArea");

            if (this._sortSharedItemsButton != null)
            {
                this._sortSharedItemsButton.Tapped += OnSortSharedItemsButtonTapped;
            }

            if (this._removeContact != null)
            {
                this._removeContact.Tapped += (sender, args) => OnRemoveContactTapped();
            }

            if (this._sharedItems != null)
            {
                this._sharedItems.Tapped      += OnSharedItemTapped;
                this._sharedItems.RightTapped += OnSharedItemRightTapped;
            }

            if (this._pivotControl != null)
            {
                this._pivotControl.SelectionChanged += OnPivotSelectionChanged;
            }
        }
        //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)
                {
                    PivotItem sprintView = new PivotItem() { 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);

                    SprintsPivot.Items.Add(sprintView);
                }
            }
        }
Example #11
0
        private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Pivot p = sender as Pivot;

            Debug.Assert(p != null, "p != null");
            PivotItem pI = p.SelectedItem as PivotItem;

            if (pI != null)
            {
                switch (pI.Tag.ToString())
                {
                case "0":
                    //General
                    //SettingFrame.Navigate(typeof(SaveLocationSettingPage));
                    break;

                case "1":
                    //Rate and Feedback
                    SettingFrame.Navigate(typeof(RateAndFeedbackPage));
                    break;

                case "2":
                    //About
                    SettingFrame.Navigate(typeof(AboutPage));
                    break;

                case "3":
                    //More apps
                    SettingFrame.Navigate(typeof(MoreAppsPage));
                    break;
                }
            }
        }
Example #12
0
        private void SampleTreeView_TreeViewItemClick(TreeView sender, TreeViewItemClickEventArgs args)
        {
            TreeNode node = (TreeNode)args.ClickedItem;

            EsSystemData data = node.Data as EsSystemData;
            PivotItem    pi   = pivot1.Items[0] as PivotItem;

            switch (data.ItemType)
            {
            case EsTreeItemType.esIndex:
                contentFrame.Navigate(typeof(Page_Index), node.ParentNode.Data as EsSystemData);
                pi.Header = "Index";
                break;

            case EsTreeItemType.esTemplate:
                contentFrame.Navigate(typeof(Template), node.ParentNode.Data as EsSystemData);
                pi.Header = "Template";
                break;

            case EsTreeItemType.esPlugin:
                contentFrame.Navigate(typeof(Page_Plugin), node.ParentNode.Data as EsSystemData);
                pi.Header = "Plugin";
                break;

            case EsTreeItemType.esNode:
                break;
                //case default:
                //    contentFrame.Navigate(typeof(BlankPage1), args);
                //    break;
            }
        }
Example #13
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            PivotItem item = (PivotItem)pivot.SelectedItem;
            string    tag  = item.Header.ToString();

            if (tag == "评论" && listview.Items.Count == 0)
            {
                if (aid.Length > 0)
                {
                    var  text   = Load.FindChildOfType <TextBlock>(listview);
                    bool isDone = await load(1, aid);

                    if (isDone && text != null)
                    {
                        text.Text = "评论装填完毕!";
                    }
                }
                else
                {
                    // load(1,season_id)
                }
            }
            if (tag == "相关视频" && list_relates.Items.Count == 0)
            {
                if (aid.Length > 0)
                {
                    list_relates.ItemsSource = await ContentServ.GetRelatesAsync(aid);
                }
                else
                {
                    // load(1,season_id)
                }
            }
        }
        public async void PopulateData()
        {
            Loading = true;
            var data = new List <RecomendationData>();
            await Task.Run(async() => data = await new AnimeRecomendationsQuery().GetRecomendationsData());

            if (data == null)
            {
                Loading = false;
                return;
            }
            RecommendationItems.Clear();
            var i = 0;

            foreach (var item in data)
            {
                var pivot = new PivotItem
                {
                    Header  = item.DependentTitle + "\n" + item.RecommendationTitle,
                    Content = new RecomendationItem(item, i++)
                };
                RecommendationItems.Add(pivot);
            }
            Loading = false;
            RaisePropertyChanged(() => PivotItemIndex);
        }
Example #15
0
        private async void markAsSeen_Click(object sender, RoutedEventArgs e)
        {
            MessageDialog dia = new MessageDialog("Mark season as watched?", "Are you sure?");

            dia.Commands.Add(new UICommand("Ok"));
            dia.Commands.Add(new UICommand("Cancel"));
            IUICommand res = await dia.ShowAsync();

            //if ok pressed
            if (res.Label == "Ok")
            {
                PivotItem pivoi    = Pivot.Items[currentPivot] as PivotItem;
                string    seasonnr = pivoi.Header.ToString().Replace("Season ", "");

                foreach (Episode epi in season[Int32.Parse(seasonnr)])
                {
                    if (epi.Aired)
                    {
                        epi.Seen = true;
                        epi.OnPropertyChanged("redo");
                        epi.OnPropertyChanged("Opacity");
                    }
                }
                await Show.markSeasonAsWatched(seasonnr);
            }
        }
Example #16
0
        private void Initialize()
        {
            var doc = new HtmlDocument();

            doc.LoadHtml(PageHtml);
            var pres = doc.DocumentNode.SelectNodes("//pre");
            int i    = 0;

            foreach (var pre in pres)
            {
                i++;
                var codeText = pre.InnerText;
                codeText = codeText.Replace("&lt;", "<");
                codeText = codeText.Replace("&gt;", ">");
                Grid      g       = new Grid();
                TextBlock tempTXT = new TextBlock();
                tempTXT.Text = codeText;
                CodeControl tempCode = new CodeControl(codeText);
                g.Margin = new Thickness(10, 5, 10, 0);
                g.Children.Add(tempCode);
                CodeControlList.Add(tempCode);
                PivotItem item = new PivotItem();
                item.Header  = "code" + i.ToString();
                item.Content = g;
                PVT.Items.Add(item);
                PVTitems.Add(item);
            }
        }
Example #17
0
        /// <summary>
        /// Create a Pivot and PivotItem, and fill with place info
        /// </summary>
        /// <param name="place">Place instance</param>
        private async void CreatePivotItem(string place)
        {
            // Get address of a Geopoint location
            MainGrid.Children.Clear();
            string[] split    = place.Split(new Char[] { '\n', ',' });
            Geopoint geoPoint = new Geopoint(new BasicGeoposition()
            {
                Latitude  = Convert.ToDouble(split[1]),
                Longitude = Convert.ToDouble(split[2])
            });
            var newPivot = new Pivot {
                Title = "MICROSOFT SENSORCORE SAMPLE", Margin = new Thickness(0, 12, 0, 0), Foreground = new SolidColorBrush(Colors.Black)
            };
            var pivotItem = new PivotItem {
                Header = split[0].ToString(), Foreground = new SolidColorBrush(Colors.Black), FontSize = 20
            };
            var stackPanel = new StackPanel();
            // Get address of a Geopoint location
            var addressTask = GeoLocationHelper.GetAddress(geoPoint);

            stackPanel.Children.Add(CreateTextBlock("Latitude:", split[1].ToString()));
            stackPanel.Children.Add(CreateTextBlock("Longitude:", split[2].ToString()));
            stackPanel.Children.Add(CreateTextBlock("Radius:", split[3].ToString() + " m"));
            stackPanel.Children.Add(CreateTextBlock("Length of stay:", split[4].ToString()));
            stackPanel.Children.Add(CreateTextBlock("Total length of stay:", split[5].ToString()));
            stackPanel.Children.Add(CreateTextBlock("Total visit count:", split[6].ToString()));
            pivotItem.Content = stackPanel;
            newPivot.Items.Add(pivotItem);
            MainGrid.Children.Add(newPivot);
            _addressString = await addressTask;
            //Add address to the pivot
            stackPanel.Children.Add(CreateTextBlock("Address:", _addressString));
        }
Example #18
0
        PivotItem GeneratePivotItem(string glyph, string tag)
        {
            //<PivotItem.Header>
            //                       <Grid  MinWidth="90">
            //                           <FontIcon FontFamily="{StaticResource MaterialSymbolFont}"
            //                                     FontSize="{StaticResource ExtraBigFontSize}"
            //                                     Glyph="" />
            //                       </Grid>
            //                   </PivotItem.Header>
            var ff   = App.Current.Resources["MaterialSymbolFont"] as FontFamily;
            var fs   = (double)App.Current.Resources["ExtraBigFontSize"];
            var item = new PivotItem
            {
                Header = new Grid
                {
                    MinWidth = 85,
                    Children =
                    {
                        new FontIcon
                        {
                            FontFamily = ff,
                            FontSize   = fs,
                            Glyph      = glyph
                        }
                    }
                },
                Tag = tag
            };

            return(item);
        }
Example #19
0
        private void Pivot_Loaded(object sender, RoutedEventArgs e)
        {
            var pivot = sender as Pivot;

            if (pivot.Items.Count == 0)
            {
                var needAddTabs = provider.tabProviders.IsEmpty;
                var index       = provider.ComboBoxSelectedIndex;
                foreach (IndexPageModel model in pivot.Tag as System.Collections.IEnumerable)
                {
                    if (needAddTabs)
                    {
                        provider.AddTab($"/page/dataList?url={model.Url.Replace("#", "%23", StringComparison.Ordinal)}&title={model.Title}");
                    }

                    var pivotItem = new PivotItem
                    {
                        Header = model.Title
                    };
                    pivot.Items.Add(pivotItem);
                }

                for (int i = 0; i < provider.tabProviders.Count; i++)
                {
                    var list = new Microsoft.UI.Xaml.Controls.ItemsRepeater
                    {
                        ItemTemplate = Resources["FTemplateSelector"] as DataTemplateSelector,
                        ItemsSource  = provider.tabProviders[i].Models,
                    };
                    ((PivotItem)pivot.Items[i]).Content = list;
                }
                pivot.SelectedIndex = index;
            }
        }
Example #20
0
        private void BackGrid_Tapped(object sender, TappedRoutedEventArgs e)
        {
            Debug.WriteLine("前" + KBCLassFlyoutPivot.Items.Count.ToString());
            do
            {
                KBCLassFlyoutPivot.Items.RemoveAt(0);
            }while (KBCLassFlyoutPivot.Items.Count.ToString() != "0");
            Debug.WriteLine("删除" + KBCLassFlyoutPivot.Items.Count.ToString());
            Grid g = sender as Grid;

            Debug.WriteLine(g.GetValue(Grid.ColumnProperty));
            Debug.WriteLine(g.GetValue(Grid.RowProperty));
            string[] temp = classtime[Int32.Parse(g.GetValue(Grid.ColumnProperty).ToString()), Int32.Parse(g.GetValue(Grid.RowProperty).ToString()) / 2];
            for (int i = 0; i < temp.Length; i++)
            {
                ClassList c = classList.Find(p => p._Id.Equals(temp[i]));

                PivotItem pi = new PivotItem();
                TextBlock HeaderTextBlock = new TextBlock();
                HeaderTextBlock.Text     = c.Course;
                HeaderTextBlock.FontSize = 25;
                pi.Header = HeaderTextBlock;
                ListView lv = new ListView();
                lv.ItemTemplate = KBCLassFlyoutListView.ItemTemplate;
                List <ClassList> cc = new List <ClassList>();
                cc.Add(c);
                lv.ItemsSource = cc;
                pi.Content     = lv;
                KBCLassFlyoutPivot.Items.Add(pi);
                Debug.WriteLine("后" + KBCLassFlyoutPivot.Items.Count.ToString());
            }
            KBCLassFlyout.ShowAt(page);
        }
Example #21
0
        private void PivotChanged(object sender, RoutedEventArgs e)
        {
            PivotItem pivotItem = (PivotItem)(sender as Pivot).SelectedItem;

            if (pivotItem != null)
            {
                switch (pivotItem.Name)
                {
                case "NearbyPivotItem":
                    break;

                case "Line1PivotItem":
                    getLine1(sender, e);
                    break;

                case "Line2PivotItem":
                    getLine2(sender, e);
                    break;

                case "Line3PivotItem":
                    getLine3(sender, e);
                    break;

                case "Line4PivotItem":
                    getLine4(sender, e);
                    break;

                case "Line5PivotItem":
                    getLine5(sender, e);
                    break;
                }
            }
        }
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Set the page DataContext property to the ViewModel.
            this.DataContext = App.ViewModel;

            Pi = new ProgressIndicator();
            Pi.IsIndeterminate = true;
            Pi.IsVisible = false;

            allPivotItem = new PivotItem();
            allPivotItem.Header = new ToDoCategory { Name = "All", IconPath = "/Sticky-Notes-icon.png" };
            ListBox listbox = new ListBox();
            listbox.Margin = new Thickness(12, 0, 12, 0);
            listbox.Width = 440;
            listbox.ItemTemplate = ToDoListBoxItemTemplate;
            listbox.Tap += Parent_Tap;
            allPivotItem.Content = listbox;

            searchResult = new PivotItem();
            searchResult.Header = new ToDoCategory { Name = "Search result", IconPath = "/Images/CategoryIcons/SearchResult.png" };
            ListBox lstbox = new ListBox();
            lstbox.Margin = new Thickness(12, 0, 12, 0);
            lstbox.Width = 440;
            lstbox.ItemTemplate = ToDoListBoxItemTemplate;
            lstbox.Tap += Parent_Tap;
            searchResult.Content = lstbox;

            App.ViewModel.OnDataBaseChange += ViewModel_onDataBaseChanged;
            App.ViewModel.ReLoadData();
            //TestData();
        }
Example #23
0
        private void BuildUI(PivotItem pivotItem, Remote remote)
        {
            pivotItem.Header = remote.Name;

            var grid = new Canvas();

            grid.Background = new SolidColorBrush(Colors.Transparent);

            pivotItem.Content = grid;
            pivotItem.Tag     = remote;

            foreach (RemoteButton button in remote.Buttons)
            {
                Button controllButton = new Button();

                controllButton.Content = button.Title;

                SetLayout(controllButton, button);

                controllButton.Tag = button;

                controllButton.Click += this.RemoteButtonClick;

                grid.Children.Add(controllButton);
            }
        }
        public void TestBrokenRelatedLinks()
        {
            PivotCollection collection = new PivotCollection();
            collection.FacetCategories.Add(new PivotFacetCategory("alpha", PivotFacetType.String));

            PivotItem item = new PivotItem("0", collection);
            item.AddFacetValues("alpha", "alpha");
            item.AddRelatedLink(new PivotLink(null, "http://pauthor.codeplex.com"));
            collection.Items.Add(item);

            item = new PivotItem("1", collection);
            item.AddFacetValues("alpha", "bravo");
            item.AddRelatedLink(new PivotLink("charlie", null));
            collection.Items.Add(item);

            PivotCollectionBuffer buffer = new PivotCollectionBuffer(collection);
            String targetPath = Path.Combine(WorkingDirectory, "sample.cxml");
            LocalCxmlCollectionTarget target = new LocalCxmlCollectionTarget(targetPath);
            target.Write(buffer);

            AssertCxmlSchemaValid(targetPath);

            CxmlCollectionSource targetAsSource = new CxmlCollectionSource(targetPath);
            buffer.Write(targetAsSource);

            AssertEqual("Related Link", buffer.Collection.Items[0].RelatedLinks.First().Title);
            AssertEqual("http://pauthor.codeplex.com", buffer.Collection.Items[0].RelatedLinks.First().Url);
            AssertEqual(0, buffer.Collection.Items[1].RelatedLinks.Count());
        }
        private void pvi_Tut_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //TUT page            
            mySolidColorBrush.Color = Color.FromArgb(255, 46, 159, 255);
            pivot = (PivotItem)(sender as Pivot).SelectedItem;

            switch (pivot.Name.ToString())
            {
                case "pvi_Tut1":
                    el_Page1.Fill = mySolidColorBrush;
                    el_Page2.Fill = el_Page3.Fill = el_Page4.Fill = el_Page5.Fill = new SolidColorBrush(Colors.White);
                    break;
                case "pvi_Tut2":
                    el_Page2.Fill = mySolidColorBrush;
                    el_Page1.Fill = el_Page3.Fill = el_Page4.Fill = el_Page5.Fill = new SolidColorBrush(Colors.White);
                    break;
                case "pvi_Tut3":
                    el_Page3.Fill = mySolidColorBrush;
                    el_Page1.Fill = el_Page2.Fill = el_Page4.Fill = el_Page5.Fill = new SolidColorBrush(Colors.White);
                    break;
                case "pvi_Tut4":
                    el_Page4.Fill = mySolidColorBrush;
                    el_Page1.Fill = el_Page2.Fill = el_Page3.Fill = el_Page5.Fill = new SolidColorBrush(Colors.White);
                    break;
                case "pvi_Tut5":
                    el_Page5.Fill = mySolidColorBrush;
                    el_Page1.Fill = el_Page2.Fill = el_Page3.Fill = el_Page4.Fill = new SolidColorBrush(Colors.White);
                    break;

            }
        }
Example #26
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            bool fileExists = await XmlFile.IsExists();
            if (!fileExists)
            {
                await XmlFile.SaveAsync(XmlFile.Default);
            }
            ClearAppPivot();

            _pillsXml = await XmlFile.Read();

            List<string> periods = _pillsXml.Descendants("time").Select(x => x.Attribute("name").Value).ToList();
            foreach (string period in periods)
            {
                PivotItem pivotItem = new PivotItem() { Header = period };
                PillsListView pillListView = new PillsListView(DataHelper.GetPillsFromXML(_pillsXml, period));
                pivotItem.Content = pillListView;
                if (AppPivot.Items != null) AppPivot.Items.Add(pivotItem);
            }

            // Запускаем приложение с первого периода
            if (e.NavigationMode == NavigationMode.New)
            {
                _activePivotHeader = periods.First();
            }

            if (_activePivotHeader != "")
            {
                AppPivot.SelectedItem = AppPivot.Items.FirstOrDefault(item =>
                {
                    PivotItem pivotItem = item as PivotItem;
                    return (pivotItem != null && pivotItem.Header.ToString() == _activePivotHeader); // Выбираем PivotItem, у которого Header = _activePivotHeader
                });
            }
        }
        private void AddPivotItem(int sensorType, int index, int totalIndex)
        {
            PivotItem    PivotItemSensor    = new PivotItem();
            ScrollViewer scrollViewerSensor = new ScrollViewer()
            {
                VerticalScrollBarVisibility = ScrollBarVisibility.Visible, HorizontalScrollBarVisibility = ScrollBarVisibility.Visible
            };

            SensorDisplay selected = Sensor.SensorDisplay[totalIndex];

            PivotItemSensor.Header = Constants.SensorName[selected.SensorType] + " " + (index + 1);

            // Special case proximity sensors and label the human presence sensors explicitly through the header. A human presence sensor is a proximity
            // sensor with the optional property DEVPKEY_Sensor_ProximityType set as 1.
            try
            {
                if (sensorType == Sensor.PROXIMITYSENSOR && (Sensor.ProximitySensorDeviceInfo[index].Properties[Constants.Properties["DEVPKEY_Sensor_ProximityType"]].ToString() == "1"))
                {
                    PivotItemSensor.Header = Constants.SensorName[selected.SensorType] + " (Human Presence) " + (index + 1);
                }
            }
            catch { }
            scrollViewerSensor.Content = selected.StackPanelSensor;
            PivotItemSensor.Content    = scrollViewerSensor;
            PivotSensor.Items.Add(PivotItemSensor);
        }
        public LearningPage()
        {

            Animals animals = new Animals();

            InitializeComponent();

            for (int i = 0; i < animals.getSize(); i++)
            {
                PivotItem pivotItem = new PivotItem();
                Image image = new Image();

                image.Source = new BitmapImage(animals.getAnimalIndex(i).getAnimalImage());
                pivotItem.Header = animals.getAnimalIndex(i).getAnimalName();
                pivotItem.Content = image;

       

                AnimalLearningPivot.Items.Add(pivotItem);
            }

            //on animal selection take them to a seperate scene with animal name, animal facts, and animal sounds. 
            //need to research animal facts and add them to xml files
            

            //create image view with each animal in it
            //add event when animal is clicked update thread
            //
        }
Example #29
0
        private void Pivot_Loaded(object sender, RoutedEventArgs e)
        {
            var pivot = sender as Pivot;

            if (pivot.Items.Count == 0)
            {
                foreach (IndexPageModel model in pivot.Tag as System.Collections.IEnumerable)
                {
                    provider.AddTab($"/page/dataList?url={model.Url.Replace("#", "%23", StringComparison.Ordinal)}&title={model.Title}");

                    var list = new Microsoft.UI.Xaml.Controls.ItemsRepeater
                    {
                        ItemTemplate = Resources["FTemplateSelector"] as DataTemplateSelector,
                        ItemsSource  = provider.tabProviders.Last().Models,
                    };

                    var pivotItem = new PivotItem
                    {
                        Content = list,
                        Header  = model.Title
                    };
                    pivot.Items.Add(pivotItem);
                }
                return;
            }
        }
        private void ShotDetail_PT_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_shotDetailViewModel == null)
            {
                return;
            }

            PivotItem selectItem = this.ShotDetail_PT.SelectedItem as PivotItem;

            if (selectItem == null)
            {
                return;
            }

            switch (selectItem.Header.ToString())
            {
            case "Detail":
                _shotDetailViewModel.GetShotDetail(_shotId);
                break;

            case "Comment":
                _shotDetailViewModel.GetShotDetailComments(_shotId, 1, 15);
                break;
            }
        }
        internal void LinkToMainPage(MainPage mainPage)
        {
            rootPage = mainPage;

            CadencePivotItems = new List <PivotItem>();

            var PlayerCustomizationViewModel = new PlayerCustomizationModel(rootPage);
            var PlayerCustomizationPivotItem = new PivotItem();

            PlayerCustomizationPivotItem.Header = new TabHeader()
            {
                Label = PlayerCustomizationViewModel.Title, Glyph = PlayerCustomizationViewModel.Glyph
            };
            PlayerCustomizationPivotItem.Content = PlayerCustomizationViewModel.Content;

            var SettingsViewModel = new SettingsViewModel(rootPage);
            var SettingsPivotItem = new PivotItem();

            SettingsPivotItem.Header = new TabHeader()
            {
                Label = SettingsViewModel.Title, Glyph = SettingsViewModel.Glyph
            };
            SettingsPivotItem.Content = SettingsViewModel.Content;

            var HistoryViewModel = new HistoryViewModel(rootPage);
            var HistoryPivotItem = new PivotItem();

            HistoryPivotItem.Header = new TabHeader()
            {
                Label = HistoryViewModel.Title, Glyph = HistoryViewModel.Glyph
            };
            HistoryPivotItem.Content = HistoryViewModel.Content;

            CadencePivotItems.Add(PlayerCustomizationPivotItem);
            CadencePivotItems.Add(SettingsPivotItem);
            CadencePivotItems.Add(HistoryPivotItem);



            List <String> symbols = new List <String>();

            //symbols.Add("\uE125");
            //symbols.Add("\uE179");
            //symbols.Add("\uE115");


            for (int i = 0; i < symbols.Count; i++)
            {
                PivotItem item = new PivotItem();
                item.Header = new TabHeader()
                {
                    Label = "Item " + i, Glyph = symbols[i]
                };
                item.Content = new TextBlock()
                {
                    Text = "Content of item " + i
                };
                CadencePivotItems.Add(item);
            }
        }
Example #32
0
        private void Initialize()
        {
            this._albumId = 0L;
            long exludeAlbumId = 0;

            if (((Page)this).NavigationContext.QueryString.ContainsKey("AlbumId"))
            {
                this._albumId = long.Parse(((Page)this).NavigationContext.QueryString["AlbumId"]);
            }
            this._pageMode = (AudioPage.PageMode) int.Parse(((Page)this).NavigationContext.QueryString["PageMode"]);
            if (((Page)this).NavigationContext.QueryString.ContainsKey("ExcludeAlbumId"))
            {
                exludeAlbumId = long.Parse(((Page)this).NavigationContext.QueryString["ExcludeAlbumId"]);
            }
            base.DataContext = (new AllAudioViewModel(this.CommonParameters.UserOrGroupId, this.CommonParameters.IsGroup, (uint)this._pageMode > 0U, this._albumId, exludeAlbumId));
            if (this._albumId != 0L)
            {
                ((PresentationFrameworkCollection <object>)((ItemsControl)this.mainPivot).Items).Remove(this.pivotItemAlbums);
                PivotItem pivotItemAudio = this.pivotItemAudio;
                TextBlock textBlock      = new TextBlock();
                string    str            = ((Page)this).NavigationContext.QueryString["AlbumName"];
                textBlock.Text = str;
                double num = 46.0;
                textBlock.FontSize = num;
                FontFamily fontFamily = new FontFamily("Segoe WP SemiLight");
                textBlock.FontFamily  = fontFamily;
                pivotItemAudio.Header = textBlock;
            }
            if (this._pageMode != AudioPage.PageMode.PickAlbum)
            {
                return;
            }
            ((PresentationFrameworkCollection <object>)((ItemsControl)this.mainPivot).Items).Remove(this.pivotItemAudio);
        }
Example #33
0
        private static void OnCharacterCasingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var val = (CharacterCasing)e.NewValue;

            DependencyProperty prop = d switch
            {
                TextBlock txt => TextBlock.TextProperty,
                TextBox tbox => TextBox.PlaceholderTextProperty,
                ButtonBase hBtn => ButtonBase.ContentProperty,
                PivotItem pvi => PivotItem.HeaderProperty,
                               _ => throw new ArgumentException(),
            };

            d.RegisterPropertyChangedCallback(prop, (s, e) =>
            {
                if (_mutex)
                {
                    return;
                }

                _mutex = true;
                d.SetValue(prop, CaseConverter.Convert((string)d.GetValue(prop), val));
                _mutex = false;
            });
        }
Example #34
0
        public async Task LoadData()
        {
            SpreekwoordInstance = await SpreekwoordenWrapper.GetInstance();

            MyItemsPivotItem = MyItems;

            if (SpreekwoordInstance.MyItems.Count == 0)
            {
                SpreekwoordenPivot.Items.Remove(MyItems);
            }

            this.DataContext = SpreekwoordInstance;
            LoadingControl.SetLoadingStatus(false);

            LoadingControl.DisplayLoadingError(false);
            LoadingControl.SetLoadingStatus(true);

            await SpreekwoordInstance.GetRandomWoorden();

            LoadingControl.SetLoadingStatus(false);

            if (SpreekwoordInstance.ChangeLockscreen)
            {
                //NotificationHandler.Run("SpreekwoordenBackgroundTaskW.BackgroundTask", "ImageService", (uint)SpreekwoordInstance.IntervalArray[SpreekwoordInstance.SelectedInterval]);
            }

            int ID = await Task.Run(() => Datahandler.GetRandomSpreekwoordAndSaveImageToFile());
            //await LockScreen.SetImageFileAsync(await ApplicationData.Current.LocalFolder.GetFileAsync("Tegeltje" + ID + ".jpg"));
        }
Example #35
0
        public void TestBrokenRelatedLinks()
        {
            PivotCollection collection = new PivotCollection();

            collection.FacetCategories.Add(new PivotFacetCategory("alpha", PivotFacetType.String));

            PivotItem item = new PivotItem("0", collection);

            item.AddFacetValues("alpha", "alpha");
            item.AddRelatedLink(new PivotLink(null, "http://pauthor.codeplex.com"));
            collection.Items.Add(item);

            item = new PivotItem("1", collection);
            item.AddFacetValues("alpha", "bravo");
            item.AddRelatedLink(new PivotLink("charlie", null));
            collection.Items.Add(item);

            PivotCollectionBuffer buffer     = new PivotCollectionBuffer(collection);
            String targetPath                = Path.Combine(WorkingDirectory, "sample.cxml");
            LocalCxmlCollectionTarget target = new LocalCxmlCollectionTarget(targetPath);

            target.Write(buffer);

            AssertCxmlSchemaValid(targetPath);

            CxmlCollectionSource targetAsSource = new CxmlCollectionSource(targetPath);

            buffer.Write(targetAsSource);

            AssertEqual("Related Link", buffer.Collection.Items[0].RelatedLinks.First().Title);
            AssertEqual("http://pauthor.codeplex.com", buffer.Collection.Items[0].RelatedLinks.First().Url);
            AssertEqual(0, buffer.Collection.Items[1].RelatedLinks.Count());
        }
Example #36
0
        private void createPages()
        {
            // test
            piPage1 = new PivotItem();
            //piPage1.Loaded += PivotItem_Loaded;
            piPage1.Header = "Frage 1 - " + maxItems;

            piPage2 = new PivotItem();
            //piPage2.Loaded += PivotItem_Loaded;
            piPage2.Header = "Frage 2 - " + maxItems;

            piPage3 = new PivotItem();
            //piPage3.Loaded += PivotItem_Loaded;
            piPage3.Header = "Frage 3 - " + maxItems;

            piPage4 = new PivotItem();
            //piPage4.Loaded += PivotItem_Loaded;
            piPage4.Header = "Frage 4 - " + maxItems;

            piPage5 = new PivotItem();
            //piPage5.Loaded += PivotItem_Loaded;
            piPage5.Header = "Frage 5 - " + maxItems;

            this.pQuestions.Items.Add(piPage1);
            this.pQuestions.Items.Add(piPage2);
            this.pQuestions.Items.Add(piPage3);
            this.pQuestions.Items.Add(piPage4);
            this.pQuestions.Items.Add(piPage5);
        }
Example #37
0
        private async void StartNewSession()
        {
            var paramsTo = new Dictionary <String, object>();

            try
            {
                PivotItem tmp = SelectedPivotItem;
                if (tmp != null)
                {
                    string t = tmp.Tag as string;

                    if ("R".Equals(t))
                    {
                        var path = SelectedItemR;
                        paramsTo.Add("mode", t);
                        if (path != null)
                        {
                            paramsTo.Add("id", path.Id);
                        }
                    }
                    else if ("W".Equals(t))
                    {
                        var path = SelectedItemW;
                        paramsTo.Add("mode", t);
                        if (path != null)
                        {
                            paramsTo.Add("id", path.Id);
                        }
                    }
                    else if ("C".Equals(t))
                    {
                        var path = SelectedItemC;
                        paramsTo.Add("mode", t);
                        if (path != null)
                        {
                            paramsTo.Add("id", path.Id);
                        }
                    }
                    else if ("T".Equals(t))
                    {
                        if (lastSession != null)
                        {
                            paramsTo.Add("sessionId", lastSession.Id);
                            paramsTo.Add("id", lastSession.IdPath);
                            paramsTo.Add("mode", lastPath.Type);
                        }
                        else
                        {
                            paramsTo.Add("mode", "R");
                        }
                    }

                    await NavigationService.NavigateAsync(typeof(Views.NewSessionPage), paramsTo);
                }
            }
            catch (Exception ex)
            {
                nowhereman.LittleWatson.instance.Error("ApplicationBarIconButton_Click", ex);
            }
        }
Example #38
0
        private void LoadDataAndSetUI()
        {
            Pivot p = approvalsP;

            if (p == null)
            {
                return;
            }

            PivotItem pi = p.SelectedItem as PivotItem;

            if (pi == null)
            {
                return;
            }

            if (pi.Name.Equals("myApprovalsPI"))
            {
                ShowMyApprovals();
            }
            else if (pi.Name.Equals("allApprovalsPI"))
            {
                ShowAllApprovals();
            }
        }
 public void registerPivot()
 {
     Controller.Pages nav = Noxus.Instance().getController("Pages");
     PivotItem new_pivot_item = new PivotItem();
     new_pivot_item.Header = _title;
     new_pivot_item.Content = this;
     nav.addPage(_title, new_pivot_item);
 }
        private void LoadPivotItems()
        {
            this.MainPivot.Items.Clear();
            

            /*
            var tablesPage = new TablesPage();
            var tablesPivot = new PivotItem();
            tablesPivot.Header = "tables list";
            tablesPivot.Name = "TablesList";
            tablesPivot.Content = tablesPage;
            tablesPage.ViewModel = this.ViewModel.TablesPageViewModel;
            this.MainPivot.Items.Add(tablesPivot);
             */

            var sampleDataTablesPage = new SampleDataTablePage();
            var sampleDataTablesPivot = new PivotItem();
            sampleDataTablesPivot.Header = "Все Акции";
            sampleDataTablesPivot.Name = "SampleDataRows";
            sampleDataTablesPivot.Content = sampleDataTablesPage;
            sampleDataTablesPage.ViewModel = this.ViewModel.SampleDataTablePageViewModel;
            sampleDataTablesPage.Navigate += this.OnNavigatePage;
            this.MainPivot.Items.Add(sampleDataTablesPivot);

            var listBlobsPage = new ListBlobsPage();
            var listBlobsPivot = new PivotItem();
            listBlobsPivot.Header = "about us";
            listBlobsPivot.Name = "ListBlobs";
            listBlobsPivot.Content = listBlobsPage;
            listBlobsPage.ViewModel = this.ViewModel.ListBlobsPageViewModel;
            //listBlobsPage.TakePhoto += this.OnLaunchCamera;
            this.MainPivot.Items.Add(listBlobsPivot);
            
            var notificationsPage = new NotificationsPage();
            var notificationsPivot = new PivotItem();
            notificationsPivot.Header = "Оповещения";
            notificationsPivot.Name = "PushNotifications";
            notificationsPivot.Content = notificationsPage;
            notificationsPage.ViewModel = this.ViewModel.NotificationsViewModel;
            notificationsPage.BeginPushConnection += this.OnBeginPushConnection;
            notificationsPage.EndPushConnection += this.OnEndPushConnection;
            this.MainPivot.Items.Add(notificationsPivot);             
            
            /*
            var listQueuesPage = new ListQueuesPage();
            var listQueuesPivot = new PivotItem();
            listQueuesPivot.Header = "queues";
            listQueuesPivot.Name = "ListQueuesPage";
            listQueuesPivot.Content = listQueuesPage;
            listQueuesPage.ViewModel = this.ViewModel.ListQueuesPageViewModel;
            listQueuesPage.Navigate += this.OnNavigatePage;
            this.MainPivot.Items.Add(listQueuesPivot);
             */

            this.MainPivot.SelectedItem = sampleDataTablesPivot;
        }
Example #41
0
        public void UnHidePivotItem(PivotItem item)
        {
            if (item == null || false == headers.ContainsKey(item) || false == hiddenItems.Contains(item))
                return;

            item.Header = headers[item];

            headers.Remove(item);
            hiddenItems.Remove(item);
        }
        protected override async void OnLoadingPivotItem(PivotItem item)
        {
            //since this is going to take a non trivial amount of time we need to prevent
            //any future loads from conflicting with what we're doing
            //by taking an always increasing id we can check aginst it prior to continuing
            //and implement a sort of cancel.

            //this has the added side effect of making super rapid transitions of the pivot nearly free
            //since no one pivot will be the current one for more then a few hundred milliseconds

            using (_suspendableWorkQueue.HighValueOperationToken)
            {
                var loadIdAtStart = ++inflightLoadId;
                inflightLoad = item;

                base.OnLoadingPivotItem(item);

                _viewModelContextService.PushViewModelContext(item.DataContext as ViewModelBase);

                if (item.Content is RedditView)
                {
                    return;
                }

                var imageControl = item.Content as Image;

                if (imageControl != null)
                    await Task.Delay(400);

                if (loadIdAtStart != inflightLoadId)
                    return;

                var madeControl = MapViewModel(item.DataContext as ViewModelBase);

                if (imageControl != null)
                    await Task.Yield();

                if (loadIdAtStart != inflightLoadId)
                    return;

                madeControl.DataContext = item.DataContext as ViewModelBase;
                if (imageControl != null)
                    await Task.Yield();

                if (loadIdAtStart != inflightLoadId)
                    return;

                if (imageControl != null)
                    imageControl.Source = null;

                item.Content = madeControl;
                madeControl.LoadWithScroll();
            }
        }
Example #43
0
        private void OnAddNewSearch(AddSearchMessage message)
        {
            var view = new SearchResultView();
            ((SearchViewModel) view.DataContext).Keyword = message.Keyword;
            ((SearchViewModel) view.DataContext).Search();

            var pivotItem = new PivotItem();
            pivotItem.Header = message.Keyword;
            pivotItem.Content = view;
            _searchPivot.Items.Add(pivotItem);
        }
Example #44
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            PivotItem pi = new PivotItem();

            Rectangle r = new Rectangle();
            r.Fill = new SolidColorBrush(Colors.Turquoise);
            r.Margin = new Thickness(0, 0, 0, 0);

            pi.Content = r;
            BleepBloop.Items.Add(pi);
        }
		private void AddPivotItem(string header, object content)
		{
			// create the item
			var item = new PivotItem();

			// set properties and add
			item.Style = (Style)Resources["AboutPivotItemStyle"];
			item.Header = header;
			item.Content = content;
			PivotControl.Items.Add(item);
		}
 private PivotItem CreatePivotItem(string header, string name)
 {
     PivotItem Item = new PivotItem();
     Item.Header = header;
     Item.Foreground = Application.Current.Resources["PageNameColor"] as System.Windows.Media.Brush;
     CoursePivotItem CoursesItem = new CoursePivotItem();
     CoursesItem.Name = name;
     CoursesItem.setBinding(CoursesItem.Name);
     Item.Content = CoursesItem;
     return Item;
 }
        protected override IEnumerable<PivotItem> LoadItems()
        {
            XPathHelper document = null;
            using (WebClient webClient = new WebClient())
            {
                document = new XPathHelper(webClient.DownloadString(this.BasePath));
            }

            int index = 0;
            foreach (XPathHelper itemNode in document.FindNodes("//item"))
            {
                PivotItem item = new PivotItem(index.ToString(), this);

                String value = null;
                if (itemNode.TryFindString("title", out value))
                {
                    item.Name = value;
                }

                if (itemNode.TryFindString("description", out value))
                {
                    item.Description = value;
                }

                if (itemNode.TryFindString("link", out value))
                {
                    item.Href = value;
                }

                if (itemNode.TryFindString("author", out value))
                {
                    item.AddFacetValues("Author", value);
                }

                foreach (XPathHelper categoryNode in itemNode.FindNodes("category"))
                {
                    item.AddFacetValues("Category", categoryNode.FindString("."));
                }

                if (itemNode.TryFindString("pubDate", out value))
                {
                    DateTime dateValue = DateTime.Now;
                    if (DateTime.TryParse(value, out dateValue))
                    {
                        item.AddFacetValues("Date", dateValue);
                    }
                }

                yield return item;
                index++;
            }
        }
Example #48
0
        public void TestAddFacetValueExistingFacetCategory()
        {
            emptyCollection.FacetCategories.Add(new PivotFacetCategory("bravo", PivotFacetType.String));

            PivotItem item = new PivotItem("alpha", emptyCollection);
            item.AddFacetValues("bravo", "charlie");
            item.AddFacetValues("bravo", "delta");

            AssertEqual("charlie", item.GetAllFacetValues("bravo")[0]);
            AssertEqual("delta", item.GetAllFacetValues("bravo")[1]);
            AssertEqual(2, item.GetAllFacetValues("bravo").Count);
            AssertEqual(1, item.FacetCategories.Count());
        }
        private void BuildPivotContent()
        {
            // TODO: use DataBinding instead of generating controls by code

            var uniqueYears =
                (from data in this.Data
                 select data["Year"]).Distinct().OrderBy(x => x).ToList();
            
            uniqueYears.ForEach(x => {

                var pivotItem = new PivotItem() { Header = x };
                var grid = new Grid();

                var dataForYear =
                (from data in this.Data
                 select data)
                 .Where(y => y["Year"] == x)
                 .Distinct()
                 .OrderBy(z => z["Count"]);

                StringBuilder causes = new StringBuilder();

            dataForYear.ToList()
            .ForEach(line =>
                    {
                        var lineString = string.Format("{0} ({1}, {2})", line["Cause of Death"], line["Sex"], line["Ethnicity"]);
                        causes.AppendLine(lineString);
                    }
                );

                var textBlock = new TextBlock()
                    {
                        Text = causes.ToString()
                    };

                ScrollViewer sv = new ScrollViewer();
                sv.Content = textBlock;

                grid.Children.Add(sv);

                pivotItem.Content = grid;
                pvtPivot.Items.Add(pivotItem);


            } );




        }
 void CreateCityMenu()
 {
     SubContinent[] subContinents = CityData.GetCityData();
     for (int i = 0; i < subContinents.Length; i++)
     {
         PivotItem pv = new PivotItem();
         pv.Header = subContinents[i]._Name;
         pv.FontSize = 10;
         ChangeCityPivot.Items.Add(pv);
         CityStateList list = new CityStateList(subContinents[i]._stateOrCityList, this, i);
         pv.Content = list;
         pv.Tag = subContinents[i];
     }
 }
Example #51
0
 private void ApplicationBarAddButton_Click(object sender, EventArgs e)
 {
     PivotItem pItem = new PivotItem();
     pItem.Header = "cycle " + App.ViewModel.CycleCounter++;
     TimeSpanPicker picker = new TimeSpanPicker();
     picker.Value = new TimeSpan(0);
     picker.Step = new TimeSpan(0, 0, 1);
     picker.ValueStringFormat = "{0:hh:mm:ss.fff}";
     picker.Template = (ControlTemplate)Application.Current.Resources["TimeSpanCustomStyle"];
     pItem.Content = picker;
     cyclePivot.Items.Add(pItem);
     dateTimeEndCycles.Add(new DateTime());
     dateTimeRunningCycles.Add(new DateTime());
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string selectedTitle = "";
            NavigationContext.QueryString.TryGetValue("selectedItem", out selectedTitle);

            string title = selectedTitle.Split('~')[0];
            string index = selectedTitle.Split('~')[1];

            if (Settings.Contains("article" + title))
            {
                int i = 1;
                pivot.Items.Clear();
                if (((Article)Settings["article" + title]).Pictures != null)
                {
                    foreach (string picture in ((Article)Settings["article" + title]).Pictures)
                    {
                        var pivotItem = new PivotItem() { Name = "photo" + i };
                        var newGrid = new Grid();
                        if (picture.StartsWith("http://"))
                        {
                            var img = new Image() { Source = new BitmapImage(new Uri(picture)) };
                            newGrid.Children.Add(img);
                        }
                        else
                        {
                            var img = new Image() { Source = new BitmapImage(new Uri(picture, UriKind.Relative)) };
                            newGrid.Children.Add(img);
                        }

                        pivotItem.Content = newGrid;
                        pivot.Items.Add(pivotItem);
                        i++;
                    }

                    int position;
                    try
                    {
                        position = int.Parse(index);
                    }
                    catch (Exception)
                    {
                        position = 0;
                    }

                    pivot.SelectedIndex = position;
                }
            }
        }
Example #53
0
 private void ChangeAppBar(PivotItem item)
 {
     switch (item.Name)
     {
         case "CashCards":
             this.ApplicationBar = this.Resources["CashCardsAppBar"] as ApplicationBar;
             break;
         case "BankCards":
             this.ApplicationBar = this.Resources["BankCardsAppBar"] as ApplicationBar;
             break;
         case "IcontoCards":
             this.ApplicationBar = null;
             //this.ApplicationBar = this.Resources["IcontoCardsAppBar"] as ApplicationBar;
             break;
     }
 }
Example #54
0
        private void PopulateRelatives(String relativeFamilyName, List<String> relativeTerms)
        {
            LongListSelector lstRelatives = new LongListSelector() {
                                                                       IsFlatList = true,
                                                                       IsBouncy = true,
                                                                       Margin = new Thickness(0, 50, 0, 0),
                                                                       ItemTemplate = templateRelativeList
                                                                   };
            lstRelatives.SelectionChanged += new SelectionChangedEventHandler(lstRelatives_SelectionChanged);
            lstRelatives.ItemsSource = relativeTerms;

            PivotItem p = new PivotItem();
            p.Header = relativeFamilyName;
            p.Content = lstRelatives;
            pvtRoot.Items.Add(p);
        }
        async void FilterView_Loaded(object sender, RoutedEventArgs e)
        {
            // To edit a picture with the Nokia Imaging SDK we need a FilterEffect
            // Such a filter session is based on an image and one or more filters
            // Here we create a new FilterEffect that is based on our on the MainPage selected image
            FilterEffect effect = new FilterEffect(new BitmapImageSource(MainPage.ImageToFilter.AsBitmap()));


            // Add the filter we want to offer to our users to the list
            // You can find an overview of mor filters here: http://developer.nokia.com/Resources/Library/Lumia/#!nokia-imaging-sdk.html
            filterList = new List<ImageFilter>();
            filterList.Add(new ImageFilter("Cartoon", new CartoonFilter(true)));
            filterList.Add(new ImageFilter("Antique", new AntiqueFilter()));
            filterList.Add(new ImageFilter("Color Boost", new ColorBoostFilter(2)));
            filterList.Add(new ImageFilter("Gray Scale", new GrayscaleFilter()));
            filterList.Add(new ImageFilter("Negative", new NegativeFilter()));
            filterList.Add(new ImageFilter("Sktech", new SketchFilter(SketchMode.Color)));
            filterList.Add(new ImageFilter("Mirror", new MirrorFilter()));

            // Here we add a new PivotItem for every filter we want to use
            // So the user can flip through all offered filters in the PivotControl of this page
            foreach (ImageFilter imageFilter in filterList)
            {
                // Create a new Image that we can add to each PivotItem later as a preview of the filter
                Image pivotItemImage = new Image();
                pivotItemImage.Width = 400;
                pivotItemImage.Height = 400;

                // Create the PivotItem that we want to add and set its content to the preview image we created above
                PivotItem pivotItem = new PivotItem();
                pivotItem.Header = imageFilter.Name;
                pivotItem.Content = pivotItemImage;

                // Now we add the created PivotItem to the PivotControl on this page
                FilterPivot.Items.Add(pivotItem);

                // Add the current filter
                effect.Filters = new IFilter[] { imageFilter.Filter };

                // Last we need to render the preview image
                WriteableBitmap temporaryImage = new WriteableBitmap(MainPage.ImageToFilter);
                WriteableBitmapRenderer renderer = new WriteableBitmapRenderer(effect, temporaryImage);
                await renderer.RenderAsync();
              
                pivotItemImage.Source = temporaryImage;
            }
        }
        private void V_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName.Equals("Melodies"))
            {
                PivotItem pi = new PivotItem();
                pi.Header = "songs";

                StrechItemsListView lv = new StrechItemsListView();
                Style s = new Style(typeof(ListViewItem));
                s.Setters.Add(new Setter(ListViewItem.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch));
                lv.ItemContainerStyle = s;
                lv.ItemsSource = ((WeaponDetailsViewModel)DataContext).Melodies;
                lv.ItemTemplate = Resources["SongTemplate"] as DataTemplate;
                pi.Content = lv;
                pivot.Items.Insert(1, pi);
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            string durationString;
            _pivotPanel.SelectedItem =
                NavigationContext.QueryString.TryGetValue("Duration", out durationString)
                    ? _pivotSeizure
                    : _currentPage;
            if (!string.IsNullOrEmpty(durationString))
            {
                var context = App.Current.Resources["Static"] as StaticConfiguration;
                context.DiaryEntry.Duration = TimeSpan.FromSeconds(double.Parse(durationString));
                NavigationService.RemoveBackEntry();
            }

            _currentPage = (PivotItem)_pivotPanel.SelectedItem;
        }
Example #58
0
 private void Pivot_Tap(object sender, GestureEventArgs e)
 {
     var currSelectedItem = Pivot.SelectedItem as PivotItem;
     if (currSelectedItem != null && selectedItem != null)
     {
         if (currSelectedItem.Name == selectedItem.Name)
         {
             var listBox = currSelectedItem.Content as ListBox;
             if (listBox != null)
             {
                 object first = listBox.Items.FirstOrDefault();
                 if (first != null)
                     listBox.ScrollIntoView(first);
             }
         }
         selectedItem = currSelectedItem;
     }
 }
        private void InitPivot()
        {
            var binding = new Binding { Source = ViewModel, Path = new PropertyPath("CurrentRecords") };
            _itemTemplate = Resources["ListViewTemplate"] as DataTemplate;
            foreach (var day in Enum.GetNames(typeof(DayOfWeek)))
            {
                var listView = new ListView
                {
                    ItemTemplate = _itemTemplate,
                    IsItemClickEnabled = true
                };
                listView.ItemClick += ItemView_ItemClick;
                listView.SetBinding(ItemsControl.ItemsSourceProperty, binding);
                var pivotItem = new PivotItem { Header = day, Name = day, Content = listView };
                pivot.Items.Add(pivotItem);
            }

        }
Example #60
0
        /// <summary>
        /// Marks pivot item as hidden, so when user scroll to it is skipped(scrolled over).
        /// </summary>        
        public void HidePivotItem(PivotItem item)
        {
            if (item == null || headers.ContainsKey(item) || hiddenItems.Contains(item))
                return;

            //Save old header
            headers[item] = item.Header;

            //Remove header to make UI more nice
            item.Header = null;

            hiddenItems.Add(item);
            if (base.SelectedItem == item)
            {
                //If hiding currently open item - scroll away
                JumpOver(item, item);
            }
        }