Esempio n. 1
0
        void CenteredSurfaceListBox_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            base.OnApplyTemplate();

            ssv = GetTemplateChild("scrollViewer") as SurfaceScrollViewer;
            ssv.ScrollChanged += ssv_ScrollChanged;
            
            grid = GetTemplateChild("grid") as Grid;
            SelectionChanged += (et, s) =>
            {
                if (SelectedIndex >= 0)
                {
                    var v1 = (SurfaceListBoxItem) ItemContainerGenerator.ContainerFromIndex(SelectedIndex);
                    var p = v1.TranslatePoint(new Point(v1.ActualWidth/2, v1.ActualHeight/2), grid);
                    
                    ssv.ScrollToHorizontalOffset(p.X + ssv.ContentHorizontalOffset - grid.ActualWidth/2);
                    
                    //ssv.ScrollToHome();
                    pos += 50;

                    //grid.RenderTransform = new TranslateTransform(t - p.X - v1.ActualWidth/2, 0);
                }

            };
            if (SelectedIndex == -1 && Items.Count > 0) SelectedIndex = 0;
        }
        static bool IsTheBadgeAtBottom(SurfaceScrollViewer scroller)
        {
            var maxVOffset = scroller.ExtentHeight - scroller.ViewportHeight;
            if (maxVOffset < 0)
                return true;

            const int threshold = 10;
            return Math.Abs(scroller.VerticalOffset - maxVOffset) < threshold;
        }
Esempio n. 3
0
        //- - - - - - - - - - - - - - - - - - - - - - - -
        #endregion

        #region auto center Events
        //- - - - - - - - - - - - - - - - - - - - - - - -
        void CarouselPanel_Loaded(object sender, RoutedEventArgs e)
        {
            SurfaceScrollViewer ssv = ScrollOwner as SurfaceScrollViewer;

            if (ssv != null)
            {
                PropertyDescriptor prop = TypeDescriptor.GetProperties(typeof(SurfaceScrollViewer))["IsScrolling"];
                prop.AddValueChanged(ssv, new EventHandler(this.ScrollEnded));
            }
        }
        static bool IsTheBadgeAtBottom(SurfaceScrollViewer scroller)
        {
            var maxVOffset = scroller.ExtentHeight - scroller.ViewportHeight;

            if (maxVOffset < 0)
            {
                return(true);
            }

            const int threshold = 10;

            return(Math.Abs(scroller.VerticalOffset - maxVOffset) < threshold);
        }
Esempio n. 5
0
 //- - - - - - - - - - - - - - - - - - - - - - - -
 protected void ScrollEnded(object sender, EventArgs e)
 {
     if (autoCenter)
     {
         SurfaceScrollViewer ssv = sender as SurfaceScrollViewer;
         if (ssv != null)
         {
             if (!ssv.IsScrolling)
             {
                 this.MoveCenter();
             }
         }
     }
 }
        void scroll_ScrollChanged(object sender, ScrollChangedEventArgs e)
        {
            SurfaceScrollViewer sb = e.OriginalSource as SurfaceScrollViewer;

            if (sb == null)
            {
                return;
            }

            if (e.VerticalChange > 0)
            {
                if (e.VerticalOffset == sb.ScrollableHeight)
                {
                    ((VMBuilding)this.DataContext).loadMore();
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        ///     the helper method to generate the content when "contact list" has been clicked
        /// </summary>
        /// <returns></returns>
        private StackPanel cListContent()
        {
            //Set content to on going donation
            StackPanel contentStackPanel = new StackPanel();

            // Set up the Bing map control
            map = new Map();
            map.Mode = new AerialMode(true);
            map.CredentialsProvider = Util.MapProvider;
            map.HorizontalAlignment = HorizontalAlignment.Stretch;
            map.VerticalAlignment = VerticalAlignment.Stretch;
            map.Center = new Location(-41, 174);
            map.ZoomLevel = 6.0;
            map.Height = 550;

            // The pushpin to add to the map.
            aucklandPin = new Pushpin();
            aucklandPin.Location = new Location(-36.843880, 174.767746);

            // Add the pushpin to the map.
            map.Children.Add(aucklandPin);

            // The pushpin to add to the map.
            christchurchPin = new Pushpin();
            christchurchPin.Location = new Location(-43.531010, 172.637787);

            // Add the pushpin to the map.
            map.Children.Add(christchurchPin);

            // The pushpin to add to the map.
            dunedinPin = new Pushpin();
            dunedinPin.Location = new Location(-45.873489, 170.503967);

            // Add the pushpin to the map.
            map.Children.Add(dunedinPin);
            // The pushpin to add to the map.
            wellingtonPin = new Pushpin();
            wellingtonPin.Location = new Location(-41.288940, 174.776276);

            // Add the pushpin to the map.
            map.Children.Add(wellingtonPin);

            //Create handlers to handle when the map is clicked
            map.AddHandler(TouchDownEvent, new EventHandler<TouchEventArgs>(MapWithPushpins_TouchDown), true);
            map.AddHandler(MouseDownEvent, new MouseButtonEventHandler(MapWithPushpins_MouseDown), true);

            //Create a scroll viewer to show pin details
            mscroll = new SurfaceScrollViewer();
            mscroll.Style = FindResource("SurfaceScrollViewerStyle1") as Style;
            mscroll.Height = 300;
            mscroll.Background = new SolidColorBrush((Color) ColorConverter.ConvertFromString("#00000000"));
            mscroll.ScrollChanged += mscroll_ScrollChanged;

            //set the initial content of the scroll viewer to be a prompt
            TextBlock prompt = Util.TextBlockFactory();
            prompt.TextAlignment = TextAlignment.Center;
            prompt.Inlines.Add(new Run("Click on the pins to see their contact information\n"));
            mscroll.Content = prompt;

            //Add the map and scrollviewer to the stack panel
            contentStackPanel.Children.Add(map);
            contentStackPanel.Children.Add(mscroll);

            //Set only the vertical bar to be visible when necessary
            mscroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            mscroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            return contentStackPanel;
        }
Esempio n. 8
0
        private void MusicControls(Piece piece)
        {
            canvas.Children.Remove(studyPrompt);

            // Title of the piece.
            var title = piece.Title;
            musicTitle = new TextBlock();
            Canvas.SetLeft(musicTitle, 15);
            Canvas.SetTop(musicTitle, 45);
            musicTitle.Text = title;
            musicTitle.FontSize = 30;
            studyTabHeader.Text = Study.firstWord(title); // Sets tab header to the first word of the title, i.e. the music genre (Motet or Conductus)

            // Play/Pause and Stop buttons.
            playpause = new Button();
            stop = new Button();
            Canvas.SetLeft(playpause, 15);
            Canvas.SetTop(playpause, 90);
            Canvas.SetLeft(stop, 65);
            Canvas.SetTop(stop, 90);
            playpause.Height = 50;
            playpause.Width = 50;
            stop.Height = 50;
            stop.Width = 50;
            playpause.Content = "►";
            stop.Content = "■";
            playpause.FontSize = 35;
            stop.FontSize = 30;

            // ListBox for audio options
            selectAudioButton = new Button();
            selectAudioListBox = new ListBox();
            selectAudio = new ListBoxItem();
            MIDI = new ListBoxItem();
            liveRecording = new ListBoxItem();
            audioOptions = new List<ListBoxItem>();

            selectAudio.Content = (String)"Select audio:";
            MIDI.Content = (String)"MIDI";
            liveRecording.Content = (String)"Live recording";

            audioOptions.Add(selectAudio);
            audioOptions.Add(MIDI);
            audioOptions.Add(liveRecording);

            foreach (ListBoxItem lbi in audioOptions)
            {
                lbi.Height = 50;
                lbi.FontSize = 25;
                selectAudioListBox.Items.Add(lbi);
                lbi.HorizontalAlignment = HorizontalAlignment.Center;
                lbi.Selected += new RoutedEventHandler(audioOptionSelected);
                lbi.TouchDown += new EventHandler<TouchEventArgs>(audioOptionSelected);
            }

            selectAudioButton.Width = 180;
            selectAudioButton.Height = 50;
            selectAudioButton.Content = (String)"Select audio:";
            selectAudioButton.FontSize = 25;
            selectAudioListBox.Width = 180;
            Canvas.SetTop(selectAudioListBox, 90);
            Canvas.SetLeft(selectAudioListBox, 140);
            Canvas.SetTop(selectAudioButton, 90);
            Canvas.SetLeft(selectAudioButton, 140);

            selectAudioButton.Visibility = Visibility.Visible;
            selectAudioListBox.Visibility = Visibility.Hidden;
            selectAudioButton.Click += new RoutedEventHandler(showAudioOptions);
            selectAudioButton.TouchDown += new EventHandler<TouchEventArgs>(showAudioOptions);

            display = new TabControl();
            Canvas.SetLeft(display, 15);
            Canvas.SetTop(display, 150);
            display.Height = 860;
            display.Width = 580;

            notesTab = new TabItem();
            notesTab.Header = "Edition";
            notesTab.Height = 50;
            notesTab.Width = 200;
            notesTab.FontSize = 20;

            tabOriginalText = new TabItem();
            OriginalText = new TextBlock();
            tabOriginalText.Header = "Original Text";
            tabOriginalText.Height = 50;
            tabOriginalText.Width = 175;
            tabOriginalText.FontSize = 20;
            tabOriginalText.Content = OriginalText;

            tabTranslation = new TabItem();
            TranslationText = new TextBlock();
            TranslationText.Width = canvas.Width;
            TranslationText.Height = canvas.Width - 50;
            TranslationText.Text = Search.getByTag(piece.ID, SurfaceWindow1.modFrXml);

            tabTranslation.Header = "Translation";
            tabTranslation.Height = 50;
            tabTranslation.Width = 175;
            tabTranslation.FontSize = 20;

            SelectLanguageListBox = new ListBox();
            SelectLanguageListBox.Background = Brushes.White;
            SelectLanguageListBox.Visibility = Visibility.Hidden;
            SelectLanguageListBox.Width = 175;

            SelectLanguageButton = new Button();
            SelectLanguageButton.Visibility = Visibility.Visible;

            SelectLanguageButton.Width = 175;
            SelectLanguageButton.Height = 50;
            SelectLanguageButton.Content = (String)"Select Language";
            SelectLanguageButton.FontSize = 21;
            SelectLanguageListBox.FontSize = 21;
            SelectLanguageListBox.HorizontalContentAlignment = HorizontalAlignment.Center;
            SelectLanguageListBox.SelectedIndex = 0;

            //sets the position of language selection button and translated text relative to sidetab
            int n = 10;
            Canvas.SetLeft(SelectLanguageButton, n);
            Canvas.SetLeft(SelectLanguageListBox, n);
            Canvas.SetTop(SelectLanguageListBox, n);
            Canvas.SetTop(SelectLanguageButton, n);
            Canvas.SetTop(TranslationText, 50 + n + 5);

            pickLanguage = new ListBoxItem();
            modernFrench = new ListBoxItem();
            English = new ListBoxItem();

            pickLanguage.Content = "Select Language:";

            modernFrench.Content = "Modern French";
            English.Content = "English";

            languageOptions = new List<ListBoxItem>();
            languageOptions.Add(pickLanguage);

            languageOptions.Add(modernFrench);
            languageOptions.Add(English);

            foreach (ListBoxItem lbi in languageOptions)
            {
                lbi.Height = 50;
                lbi.FontSize = 21;
                SelectLanguageListBox.Items.Add(lbi);
                lbi.HorizontalAlignment = HorizontalAlignment.Center;
            }

            SelectLanguageButton.TouchDown += new EventHandler<TouchEventArgs>(displaySearchLanguages);
            SelectLanguageButton.Click += new RoutedEventHandler(displaySearchLanguages);
            pickLanguage.Selected += new RoutedEventHandler(TranslationLanguageChanged);
            modernFrench.Selected += new RoutedEventHandler(TranslationLanguageChanged);
            English.Selected += new RoutedEventHandler(TranslationLanguageChanged);

            tabTranslation.Content = TranslationBox;
            TranslationBox.Children.Add(TranslationText);
            TranslationBox.Children.Add(SelectLanguageListBox);
            TranslationBox.Children.Add(SelectLanguageButton);

            noteScroll = new SurfaceScrollViewer();
            notesTabCanvas = new Canvas();
            notesCanvas = new Canvas();

            noteScroll.Height = 860;
            noteScroll.Width = 580;
            noteScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            noteScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            noteScroll.PanningMode = PanningMode.VerticalOnly;
            noteScroll.Content = notesCanvas;

            /**
             * Organization of containers for notesTab (just bc these can be confusing)
             * 1. notesTab
             * 2. notesTab.Content = notesTabCanvas;
             * 3. notesTabCanvas.Children.Add(noteScroll);
             * 4. noteScroll.Content = notesCanvas;
             * */

            notesTab.Content = notesTabCanvas;
            notesTabCanvas.Children.Add(noteScroll);

            display.Items.Add(notesTab);
            display.Items.Add(tabOriginalText);
            display.Items.Add(tabTranslation);

            canvas.Children.Add(musicTitle);
            canvas.Children.Add(playpause);
            canvas.Children.Add(stop);
            canvas.Children.Add(display);
            canvas.Children.Add(selectAudioButton);
            canvas.Children.Add(selectAudioListBox);
        }
 public UCDiscutions()
 {
     this.InitializeComponent();
     SurfaceScrollViewer.SetHorizontalScrollBarVisibility(ConversList, ScrollBarVisibility.Hidden);
     SurfaceScrollViewer.SetVerticalScrollBarVisibility(ConversList, ScrollBarVisibility.Disabled);
 }
Esempio n. 10
0
        /// <summary>
        /// Does the collapse transition.
        /// </summary>
        /// <param name="smooth">if set to <c>true</c> [smooth].</param>
        private void DoCollapseTransition(bool smooth)
        {
            if (smooth)
            {
                IsHitTestVisible = false;
            }

            _TriggerButton.Visibility = Visibility.Visible;

            // Find the selected list box item.
            SurfaceListBoxItem selectedItem = GetSelectedItem();

            if (selectedItem == null)
            {
                return;
            }

            SurfaceScrollViewer sv = _ListBox.FindVisualChild <SurfaceScrollViewer>();
            double offset          = selectedItem.TransformToVisual(sv).Transform(new Point()).Y + sv.VerticalOffset;

            sv.PanningMode = PanningMode.None;

            if (!smooth)
            {
                _ListBox.Height = selectedItem.ActualHeight;
                _ListBox.Margin = new Thickness();
                sv.ScrollToVerticalOffset(offset);
                SizeChanged += ListBox_SizeChanged;
                return;
            }

            Storyboard storyboard = new Storyboard();

            DoubleAnimation height = new DoubleAnimation();

            Storyboard.SetTarget(height, _ListBox);
            Storyboard.SetTargetProperty(height, new PropertyPath(ListBox.HeightProperty));
            height.To             = selectedItem.ActualHeight;
            height.EasingFunction = new SineEase {
                EasingMode = EasingMode.EaseOut
            };
            height.Duration = _ExpandDuration;
            storyboard.Children.Add(height);

            ThicknessAnimation margin = new ThicknessAnimation();

            Storyboard.SetTarget(margin, _ListBox);
            Storyboard.SetTargetProperty(margin, new PropertyPath(ListBox.MarginProperty));
            margin.To             = new Thickness();
            margin.EasingFunction = new SineEase {
                EasingMode = EasingMode.EaseOut
            };
            margin.Duration = _ExpandDuration;
            storyboard.Children.Add(margin);

            DoubleAnimation verticalOffset = new DoubleAnimation();

            Storyboard.SetTarget(verticalOffset, this.FindVisualChild <ScrollViewerOffsetMediator>());
            Storyboard.SetTargetProperty(verticalOffset, new PropertyPath(ScrollViewerOffsetMediator.VerticalOffsetProperty));
            verticalOffset.To             = offset;
            verticalOffset.EasingFunction = new SineEase {
                EasingMode = EasingMode.EaseOut
            };
            verticalOffset.Duration = _ExpandDuration;
            storyboard.Children.Add(verticalOffset);

            ScrollBar scrollbar = this.FindVisualChild <ScrollBar>();

            if (scrollbar != null)
            {
                DoubleAnimation scroll = new DoubleAnimation();
                Storyboard.SetTarget(scroll, scrollbar);
                Storyboard.SetTargetProperty(scroll, new PropertyPath(UIElement.OpacityProperty));
                scroll.To             = 0;
                scroll.EasingFunction = new SineEase {
                    EasingMode = EasingMode.EaseOut
                };
                scroll.Duration = _ExpandDuration;
                storyboard.Children.Add(scroll);
            }

            height.Completed += (sender, e) =>
            {
                IsHitTestVisible = true;
                SizeChanged     += ListBox_SizeChanged;
            };

            storyboard.Begin(this, true);
        }
 public CommentDismissalRecognizer(SurfaceScrollViewer scrollViewer, Action <ArgPoint> onDismiss)
 {
     _scrollViewer = scrollViewer;
     _onDismiss    = onDismiss;
 }
Esempio n. 12
0
        /// <summary>
        ///     Creates a stack panel containing the content for the main office section
        /// </summary>
        /// <returns></returns>
        private StackPanel mainOfficeContent()
        {
            //Create the stackpanel
            StackPanel contentStackPanel = new StackPanel();

            //Create a map
            moMap = new Map();
            moMap.Mode = new AerialMode(true);
            moMap.CredentialsProvider = Util.MapProvider;
            moMap.HorizontalAlignment = HorizontalAlignment.Stretch;
            moMap.VerticalAlignment = VerticalAlignment.Stretch;
            moMap.Center = new Location(-36.857897, 174.769401);
            moMap.ZoomLevel = 6.0;
            moMap.Height = 550;

            //Create the pushpin for the main office
            Pushpin moPin = new Pushpin();
            moPin.Location = new Location(-36.857897, 174.769401);
            moMap.Children.Add(moPin);

            //Create a scroll viewer to display main office details
            SurfaceScrollViewer scrollContent = new SurfaceScrollViewer();
            scrollContent.Style = FindResource("SurfaceScrollViewerStyle1") as Style;
            scrollContent.Height = 300;
            scrollContent.Background = new SolidColorBrush((Color) ColorConverter.ConvertFromString("#00000000"));
            scrollContent.Content = auckMOContent();

            //Add the map and scrollviewer to the stack panel
            contentStackPanel.Children.Add(moMap);
            contentStackPanel.Children.Add(scrollContent);

            //Only allow vertical scrolling of the scrollviewer if necessary
            scrollContent.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            scrollContent.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            //Set the content of the button back to family places after the content has finished loading
            _mainOff.Content = "Main Office";

            return contentStackPanel;
        }
Esempio n. 13
0
        public SearchTab(SideBar mySideBar, SurfaceWindow1 surfaceWindow)
            : base(mySideBar)
        {
            unreturnedResults = 0;
            sideBar = mySideBar;
            this.surfaceWindow = surfaceWindow;
            searchPrompt = new TextBlock();
            searchTabHeader = new TextBlock();
            searchQueryBox = new TextBox();
            goSearch = new Button();
            moreOptions = new Button();
            topLine = new Line();

            closeLanguageList = new Button();
            fewerOptions = new Button();
            upArrow = new Image();
            caseSensitive = new CheckBox();
            wholeWordOnly = new CheckBox();
            exactPhraseOnly = new CheckBox();
            st = new ScaleTransform();
            bottomLine = new Line();

            selectLanguage = new SurfaceListBox();
            pickLanguage = new SurfaceListBoxItem();
            oldFrench = new SurfaceListBoxItem();
            modernFrench = new SurfaceListBoxItem();
            English = new SurfaceListBoxItem();
            selectLanguageButton = new Button();

            searchResults = new TabControl();
            poetryTab = new TabItem();
            lyricsTab = new TabItem();
            imagesTab = new TabItem();
            poetryCanvas = new Canvas();
            poetryScroll = new SurfaceScrollViewer();
            poetryPanel = new StackPanel();
            lyricsCanvas = new Canvas();
            lyricsScroll = new SurfaceScrollViewer();
            lyricsPanel = new StackPanel();
            imagesCanvas = new Canvas();
            imagesScroll = new SurfaceScrollViewer();
            imagesPanel = new StackPanel();

            loadImage = new Image();
            loadImage.Source = new BitmapImage(new Uri(@"..\..\icons\magnifyingglass.png", UriKind.Relative));
            canvas.Children.Add(loadImage);

            headerImage.Source = new BitmapImage(new Uri(@"..\..\icons\search.png", UriKind.Relative));

            searchTabHeader.HorizontalAlignment = HorizontalAlignment.Center;
            searchTabHeader.VerticalAlignment = VerticalAlignment.Center;
            searchTabHeader.FontSize = 21;

            searchPrompt.FontSize = 30;
            searchPrompt.Text = "Search:";
            Canvas.SetLeft(searchPrompt, 32);
            Canvas.SetTop(searchPrompt, 26);

            searchQueryBox.Height = 40;
            searchQueryBox.Width = 380; //315
            searchQueryBox.Foreground = Brushes.Gray;
            searchQueryBox.FontSize = 21;
            searchQueryBox.Text = "Enter text";
            Canvas.SetLeft(searchQueryBox, 40);
            Canvas.SetTop(searchQueryBox, 90);

            goSearch.Height = 40;
            goSearch.Width = 95;
            goSearch.FontSize = 21;
            goSearch.Content = "Go!";
            goSearch.IsEnabled = false;
            Canvas.SetLeft(goSearch, 450); // 378
            Canvas.SetTop(goSearch, 90);

            downArrow = new Image();
            downArrow.Source = new BitmapImage(new Uri(@"/downArrow.png", UriKind.Relative));
            downArrow.Opacity = 0.3;
            downArrow.HorizontalAlignment = HorizontalAlignment.Center;
            moreOptText = new TextBlock();
            moreOptText.Text = "More Options";
            moreOptText.FontSize = 18; /// Might need to adjust height
            optionsGrid = new Grid();
            moreOptions.Content = optionsGrid;
            moreOptions.Width = 135; // 100
            moreOptions.Height = 28; // 20
            moreOptions.HorizontalContentAlignment = HorizontalAlignment.Center;
            optionsGrid.Children.Add(downArrow);
            optionsGrid.Children.Add(moreOptText);
            Canvas.SetLeft(moreOptions, 230); //210
            Canvas.SetTop(moreOptions, 145);

            topLine.X1 = 40;
            topLine.Y1 = 160;
            topLine.X2 = 540; // 500
            topLine.Y2 = 160;
            topLine.Stroke = Brushes.Black;
            topLine.StrokeThickness = 2;

            closeLanguageList.Width = 600; // 550
            closeLanguageList.Height = 1000; //900
            closeLanguageList.Style = sideBar.tabBar.FindResource("InvisibleButton") as Style;

            /// The objects for extended search options
            st.ScaleX = 2;
            st.ScaleY = 2;

            caseSensitive.FontSize = 10;
            caseSensitive.LayoutTransform = st;
            caseSensitive.Content = (string)"Case sensitive";
            Canvas.SetLeft(caseSensitive, 55); //40
            Canvas.SetTop(caseSensitive, 170);

            wholeWordOnly.FontSize = 10;
            wholeWordOnly.LayoutTransform = st;
            wholeWordOnly.Content = (string)"Match whole word only";
            Canvas.SetLeft(wholeWordOnly, 300); //243
            Canvas.SetTop(wholeWordOnly, 170);

            exactPhraseOnly.FontSize = 10;
            exactPhraseOnly.LayoutTransform = st;
            exactPhraseOnly.Content = (string)"Match exact phrase only";
            Canvas.SetLeft(exactPhraseOnly, 300); // 243
            Canvas.SetTop(exactPhraseOnly, 227);

            selectLanguage.Background = Brushes.LightGray;
            selectLanguage.Visibility = Visibility.Collapsed;
            selectLanguage.Width = 175;
            selectLanguage.FontSize = 21;
            selectLanguage.HorizontalContentAlignment = HorizontalAlignment.Center;
            selectLanguage.SelectedIndex = 0;

            Canvas.SetLeft(selectLanguage, 50); //34
            Canvas.SetTop(selectLanguage, 220);
            Canvas.SetLeft(selectLanguageButton, 50); //34
            Canvas.SetTop(selectLanguageButton, 220);
            selectLanguageButton.Width = 175;
            selectLanguageButton.Height = 40;
            selectLanguageButton.Visibility = Visibility.Hidden;
            selectLanguageButton.Content = (string)"Old French";
            selectLanguageButton.FontSize = 21;

            pickLanguage.Content = (string)"Pick a language:";
            oldFrench.Content = (string)"Old French";
            modernFrench.Content = (string)"Modern French";
            English.Content = (string)"English";

            selectLanguage.Items.Add(pickLanguage);
            selectLanguage.Items.Add(oldFrench);
            selectLanguage.Items.Add(modernFrench);
            selectLanguage.Items.Add(English);

            foreach (SurfaceListBoxItem s in selectLanguage.Items)
            {
                s.FontFamily = new FontFamily("Cambria");
                s.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
                s.FontSize = 21;
                s.Height = 40;
            }

            bottomLine.X1 = 40;
            bottomLine.Y1 = 183;
            bottomLine.X2 = 540; //500
            bottomLine.Y2 = 183;
            bottomLine.Stroke = Brushes.Black;
            bottomLine.StrokeThickness = 2;
            Canvas.SetTop(bottomLine, 113);

            upArrow.Source = new BitmapImage(new Uri(@"/upArrow.png", UriKind.Relative));
            upArrow.Opacity = 0.3;
            upArrow.HorizontalAlignment = HorizontalAlignment.Center;
            fewerOptText = new TextBlock();
            fewerOptText.Text = "Fewer Options";
            fewerOptText.FontSize = 18; /// Might need to adjust height
            fewerOptGrid = new Grid();
            fewerOptions.Content = fewerOptGrid;
            fewerOptions.Width = 135;
            fewerOptions.Height = 28;
            fewerOptions.HorizontalContentAlignment = HorizontalAlignment.Center;
            fewerOptGrid.Children.Add(upArrow);
            fewerOptGrid.Children.Add(fewerOptText);
            Canvas.SetLeft(fewerOptions, 230); // 210
            Canvas.SetTop(fewerOptions, 280); // 285

            /// The objects on the search results section
            searchResults.Visibility = Visibility.Hidden;
            searchResults.Height = 800; //677
            searchResults.Width = 525; //482
            searchResults.FontSize = 21;
            Canvas.SetLeft(searchResults, 35); //30
            Canvas.SetTop(searchResults, 180);
            searchResults.Items.Add(poetryTab);
            searchResults.Items.Add(lyricsTab);
            searchResults.Items.Add(imagesTab);

            poetryBorder = new Border();
            poetryBorder.Child = poetryPanel;
            poetryBorder.Style = sideBar.tabBar.FindResource("ResultBorder") as Style;

            poetryTab.Header = "Poetry";
            poetryTab.Height = 40;
            poetryTab.Width = 170;
            poetryTab.Content = poetryCanvas;

            poetryCanvas.Height = 750;
            poetryCanvas.Children.Add(poetryScroll);
            poetryCanvas.Children.Add(poetryBorder);

            poetryScroll.Height = 410;
            poetryScroll.Width = 513;
            poetryScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            poetryScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            poetryScroll.PanningMode = PanningMode.VerticalOnly;
            poetryPanel.Orientation = Orientation.Horizontal;

            lyricsBorder = new Border();
            lyricsBorder.Child = lyricsPanel;
            lyricsBorder.Style = sideBar.tabBar.FindResource("ResultBorder") as Style;

            lyricsTab.Header = "Lyrics";
            lyricsTab.Height = 40;
            lyricsTab.Width = 170;
            lyricsTab.Content = lyricsCanvas;
            lyricsCanvas.Height = 750;
            lyricsCanvas.Children.Add(lyricsScroll);
            lyricsCanvas.Children.Add(lyricsBorder);
            lyricsScroll.Height = 410;
            lyricsScroll.Width = 513;
            lyricsScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            lyricsScroll.PanningMode = PanningMode.VerticalOnly;
            lyricsPanel.Orientation = Orientation.Horizontal;

            imagesBorder = new Border();
            imagesBorder.Child = imagesPanel;
            imagesBorder.Style = sideBar.tabBar.FindResource("ResultBorder") as Style;

            imagesTab.Header = "Images";
            imagesTab.Height = 40;
            imagesTab.Width = 170;
            imagesTab.Content = imagesCanvas;
            imagesCanvas.Height = 750;
            imagesCanvas.Children.Add(imagesScroll);
            imagesCanvas.Children.Add(imagesBorder);
            imagesScroll.Height = 410;
            imagesScroll.Width = 513;

            imagesScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            imagesScroll.PanningMode = PanningMode.VerticalOnly;
            imagesPanel.Orientation = Orientation.Horizontal;

            /// Adding everything

            headerGrid.Children.Add(searchTabHeader);

            canvas.Children.Add(closeLanguageList); // Should add to the very back...
            canvas.Children.Add(searchPrompt);
            canvas.Children.Add(searchQueryBox);
            canvas.Children.Add(goSearch);
            canvas.Children.Add(topLine);
            canvas.Children.Add(moreOptions);

            canvas.Children.Add(searchResults);
            canvas.Children.Add(caseSensitive);
            canvas.Children.Add(bottomLine);
            canvas.Children.Add(selectLanguage);
            canvas.Children.Add(selectLanguageButton);
            canvas.Children.Add(fewerOptions);
            canvas.Children.Add(wholeWordOnly);
            canvas.Children.Add(exactPhraseOnly);
            caseSensitive.Visibility = Visibility.Hidden;
            selectLanguage.Visibility = Visibility.Hidden;
            bottomLine.Visibility = Visibility.Hidden;
            fewerOptions.Visibility = Visibility.Hidden;
            wholeWordOnly.Visibility = Visibility.Hidden;
            exactPhraseOnly.Visibility = Visibility.Hidden;

            closeLanguageList.TouchEnter += new EventHandler<TouchEventArgs>(closeLanguageList_TouchEnter);
            closeLanguageList.MouseLeave += new MouseEventHandler(closeLanguageList_MouseLeave);
            closeLanguageList.Click += new RoutedEventHandler(closeLanguageList_Click);
            moreOptions.Click += new RoutedEventHandler(Show_Options);
            moreOptions.TouchDown += new EventHandler<TouchEventArgs>(Show_Options);
            fewerOptions.Click += new RoutedEventHandler(Hide_Options);
            fewerOptions.TouchDown += new EventHandler<TouchEventArgs>(Hide_Options);
            searchQueryBox.GotFocus += new RoutedEventHandler(Focus_SearchBox);
            searchQueryBox.TouchDown += new EventHandler<TouchEventArgs>(Focus_SearchBox);
            goSearch.Click += new RoutedEventHandler(newSearch);
            goSearch.TouchDown += new EventHandler<TouchEventArgs>(newSearch);
            searchQueryBox.PreviewKeyDown += new KeyEventHandler(Enter_Clicked);
            caseSensitive.TouchDown += new EventHandler<TouchEventArgs>(changeCheck);
            exactPhraseOnly.TouchDown += new EventHandler<TouchEventArgs>(changeCheck);
            wholeWordOnly.TouchDown += new EventHandler<TouchEventArgs>(changeCheck);

            //selectLanguage.TouchDown += new EventHandler<TouchEventArgs>(displaySearchLanguages);
            //selectLanguage.SelectionChanged += new SelectionChangedEventHandler(searchLanguageChanged);
            selectLanguage.Visibility = Visibility.Collapsed;
            selectLanguageButton.TouchDown += new EventHandler<TouchEventArgs>(displaySearchLanguages);
            selectLanguageButton.Click += new RoutedEventHandler(displaySearchLanguages);
            pickLanguage.Selected += new RoutedEventHandler(searchLanguageChanged);
            oldFrench.Selected += new RoutedEventHandler(searchLanguageChanged);
            modernFrench.Selected += new RoutedEventHandler(searchLanguageChanged);
            English.Selected += new RoutedEventHandler(searchLanguageChanged);
        }
Esempio n. 14
0
        /// <summary>
        ///     Creates a stack panel containing the content for the family place section
        /// </summary>
        /// <returns></returns>
        private StackPanel familyPlaceContent()
        {
            //Create the stack panel
            StackPanel contentStackPanel = new StackPanel();

            // Create the map
            map = new Map();
            map.Mode = new AerialMode(true);
            map.CredentialsProvider = Util.MapProvider;
            map.HorizontalAlignment = HorizontalAlignment.Stretch;
            map.VerticalAlignment = VerticalAlignment.Stretch;
            map.Center = new Location(-41, 174);
            map.ZoomLevel = 6.0;
            map.Height = 550;

            //create the pushpins
            auckMOPin = new Pushpin();
            chchPin = new Pushpin();
            dunPin = new Pushpin();
            taurPin = new Pushpin();
            hBPin = new Pushpin();
            wellPin = new Pushpin();

            //Set the locations of the pins
            auckMOPin.Location = new Location(-36.857897, 174.769401);
            chchPin.Location = new Location(-43.501951, 172.544112);
            dunPin.Location = new Location(-45.868512, 170.50574);
            taurPin.Location = new Location(-37.699713, 176.156457);
            hBPin.Location = new Location(-39.628639, 176.822171);
            wellPin.Location = new Location(-41.307915, 174.77836);

            //Add the pushpins to the map
            map.Children.Add(auckMOPin);
            map.Children.Add(chchPin);
            map.Children.Add(dunPin);
            map.Children.Add(taurPin);
            map.Children.Add(hBPin);
            map.Children.Add(wellPin);

            //Add handlers for both mouse and touch events so that when the user touches a pushpin, it can be handled
            map.AddHandler(TouchDownEvent, new EventHandler<TouchEventArgs>(MapWithPushpins_TouchDown), true);
            map.AddHandler(MouseDownEvent, new MouseButtonEventHandler(MapWithPushpins_MouseDown), true);

            //Create a scroll viewer to display place details
            familyPlaceScroll = new SurfaceScrollViewer();
            familyPlaceScroll.Style = FindResource("SurfaceScrollViewerStyle1") as Style;
            familyPlaceScroll.Height = 300;
            familyPlaceScroll.Background = new SolidColorBrush((Color) ColorConverter.ConvertFromString("#00000000"));

            //Set the initial content of  the scroll viewer to prompt the user to click on a pushpin
            TextBlock prompt = Util.TextBlockFactory();
            prompt.TextAlignment = TextAlignment.Center;
            prompt.Inlines.Add(new Run("Click on the pins to see their contact information\n"));
            familyPlaceScroll.Content = prompt;

            //Add the elements to the family place stackpanel
            contentStackPanel.Children.Add(map);
            contentStackPanel.Children.Add(familyPlaceScroll);

            //only allow vertical scrolling if necessary
            familyPlaceScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            familyPlaceScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            //Set the content of the button back to family places after the content has finished loading
            _fmlPlcs.Content = "Family Places";

            return contentStackPanel;
        }
Esempio n. 15
0
        /// <summary>
        ///     Content to be displayed on the holiday homes page
        /// </summary>
        /// <returns>A stackpanel with the holiday home content</returns>
        private StackPanel hHomesContent()
        {
            StackPanel contentStackPanel = new StackPanel();
            //Create a scatter view for the holiday home pictures
            scatter = new ScatterView();
            scatter.Height = 500;
            scatter.Background = new SolidColorBrush((Color) ColorConverter.ConvertFromString("#00000000"));

            //Create a scrollviewer for the details about the homes
            hhscroll = new SurfaceScrollViewer();
            hhscroll.Style = FindResource("SurfaceScrollViewerStyle1") as Style;
            hhscroll.Height = 300;
            hhscroll.Background = new SolidColorBrush(Util.contentBgColor);

            hhscroll.ScrollChanged += hhscroll_ScrollChanged;

            //Create a prompt to show the user that they can move/zoom the pictures
            TextBlock prompt = Util.TextBlockFactory();
            prompt.TextAlignment = TextAlignment.Center;
            prompt.Inlines.Add(new Run("Click on the images below to see information or use two fingers to zoom\n"));

            contentStackPanel.Children.Add(prompt);
            contentStackPanel.Children.Add(scatter);
            contentStackPanel.Children.Add(hhscroll);

            //Don't allow horizontal scrolling
            hhscroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            hhscroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;

            //Create new scatterview item for the arrowwtown home
            arrowtown = new ScatterViewItem();
            arrowtown.Content = new PoloroidControl("images/FamilySupport/arrowtown.jpg", "Arrowtown",
                (Color) ColorConverter.ConvertFromString("#ffffffff"));
            (arrowtown.Content as PoloroidControl).removeBorder();
            arrowtown.Orientation = 0;
            arrowtown.Height = 200;
            arrowtown.Width = 300;
            arrowtown.AddHandler(MouseUpEvent, new MouseButtonEventHandler(arrowtown_MouseUp), true);
            scatter.Items.Add(arrowtown);

            //Create new scatterview item for the taupo home
            taupo = new ScatterViewItem();
            taupo.Content = new PoloroidControl("images/FamilySupport/taupo.jpg", "Taupo",
                (Color) ColorConverter.ConvertFromString("#ffffffff"));
            (taupo.Content as PoloroidControl).removeBorder();
            taupo.Orientation = 0;
            taupo.Height = 200;
            taupo.Width = 300;
            taupo.AddHandler(MouseUpEvent, new MouseButtonEventHandler(taupo_MouseUp), true);
            scatter.Items.Add(taupo);

            //Create new scatterview item for the hawkes bay home
            hawkesbay = new ScatterViewItem();
            hawkesbay.Content = new PoloroidControl("images/FamilySupport/hawkesBay.jpg", "Hawkes Bay",
                (Color) ColorConverter.ConvertFromString("#00ffffff"));
            (hawkesbay.Content as PoloroidControl).removeBorder();
            hawkesbay.Orientation = 0;
            hawkesbay.Height = 200;
            hawkesbay.Width = 300;
            hawkesbay.AddHandler(MouseUpEvent, new MouseButtonEventHandler(hawkesBay_MouseUp), true);
            scatter.Items.Add(hawkesbay);

            //set the content to initially be hawkes bay content
            hawkesBay_MouseUp(null, null);
            return contentStackPanel;
        }
Esempio n. 16
0
 public VerticallyUnscrollableInnerList(SurfaceScrollViewer scroller, SurfaceListBox media)
 {
     _scroller = scroller;
     _media    = media;
 }
Esempio n. 17
0
 public static void SetupQR(SurfaceScrollViewer QRText, String text)
 {
     QRText.Background = new SolidColorBrush(contentBgColor);
     //QRText.Margin = contentMargin;
     TextBlock tb = TextBlockFactory();
     tb.TextAlignment = TextAlignment.Center;
     tb.TextWrapping = TextWrapping.Wrap;
     tb.Inlines.Add(new Run(text));
     StackPanel sp = new StackPanel();
     sp.Children.Add(tb);
     QRText.Content = sp;
 }
 public CommentDismissalRecognizer(SurfaceScrollViewer scrollViewer, Action<ArgPoint> onDismiss)
 {
     _scrollViewer = scrollViewer;
     _onDismiss = onDismiss;
 }