コード例 #1
0
        /// <summary>
        /// Berechnet Größenanpassung der ListbOx an Anzahl enthaltener Modelle.
        /// </summary>
        /// <param name="listbox"></param>
        public void ResizeListBox(SurfaceListBox listbox)
        {
            int    count = listbox.Items.Count;
            double newHeight;
            double totalHeight = 50 * count;

            if (count > 9)
            {
                newHeight = 470;
            }
            //if (totalHeight > 455) newHeight = 455;
            else if (totalHeight < 275)
            {
                newHeight = 275;
            }
            else
            {
                newHeight = totalHeight;
            }
            // previous values:
            //if (totalHeight > 705) newHeight = 705;
            //else if (totalHeight < 275) newHeight = 275;
            //else newHeight = totalHeight;

            listbox.Height = newHeight;

            if (((_currentCategory == 0) && (listbox.Equals(Cat0ListBox))) || ((_currentCategory == 1) && (listbox.Equals(Cat1ListBox))) ||
                ((_currentCategory == 2) && (listbox.Equals(Cat2ListBox))) || ((_currentCategory == 3) && (listbox.Equals(Cat3ListBox))) ||
                ((_currentCategory == 4) && (listbox.Equals(Cat4ListBox))))
            {
                ResizeGridHeightAndAdaptBorder(newHeight, listbox);
            }
        }
コード例 #2
0
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes call <see cref="M:System.Windows.FrameworkElement.ApplyTemplate"/>.
        /// </summary>
        public override void OnApplyTemplate()
        {
            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                _TriggerButton        = GetTemplateChild("PART_TriggerButton") as SurfaceButton;
                _TriggerButton.Click += TriggerButton_Click;

                _ListBox = GetTemplateChild("PART_ListBox") as SurfaceListBox;
                _ListBox.LayoutUpdated    += ListBox_LayoutUpdated;
                _ListBox.SelectedIndex     = SelectedIndex;
                _ListBox.SelectionChanged += ListBox_SelectionChanged;
                _ListBox.PreviewMouseDown += (sender, e) => HandleClickOrTap(e.OriginalSource);

                Loaded += (sender, e) =>
                {
                    ScatterViewItem svi = this.FindVisualParent <ScatterViewItem>();
                    if (svi != null)
                    {
                        // If hosted within a ScatterViewItem, close whenever the SVI is manipulated.
                        svi.PreviewMouseLeftButtonDown += (a, b) => CloseOnParentInteraction(b.OriginalSource as FrameworkElement);
                        svi.PreviewTouchDown           += (a, b) => CloseOnParentInteraction(b.OriginalSource as FrameworkElement);
                    }
                };
            }

            base.OnApplyTemplate();
        }
コード例 #3
0
        /// <summary>
        /// Konstruktor
        /// </summary>
        public ModelOverviewControl()
        {
            this.InitializeComponent();

            _currentListBox = Cat1ListBox;
            _currentSelectedItemPosition = new Point(0, 0);
        }
コード例 #4
0
 /// <summary>
 /// Aktualisiert Textbox für Anzeige Anzahl enthaltener Modelle in Kategorie.
 /// </summary>
 /// <param name="listbox"></param>
 private void UpdateCategoryItemsAmount(SurfaceListBox listbox)
 {
     if (listbox.Equals(Cat0ListBox))
     {
         Category0AmountText.Text = "(" + listbox.Items.Count + ")";
         if (_currentCategory == 0)
         {
             ResizeListBox(Cat0ListBox);
         }
     }
     else if (listbox.Equals(Cat1ListBox))
     {
         Category1AmountText.Text = "(" + listbox.Items.Count + ")";
     }
     else if (listbox.Equals(Cat2ListBox))
     {
         Category2AmountText.Text = "(" + listbox.Items.Count + ")";
     }
     else if (listbox.Equals(Cat3ListBox))
     {
         Category3AmountText.Text = "(" + listbox.Items.Count + ")";
     }
     else if (listbox.Equals(Cat4ListBox))
     {
         Category4AmountText.Text = "(" + listbox.Items.Count + ")";
     }
 }
コード例 #5
0
        /// <summary>
        /// Passt Größe des Controls an Listboxgröße an und ruft Anpassenmethode für Rahmenbereich auf.
        /// </summary>
        /// <param name="newHeight"></param>
        /// <param name="listbox"></param>
        private void ResizeGridHeightAndAdaptBorder(double newHeight, SurfaceListBox listbox)
        {
            MainGrid.RowDefinitions[2].Height = new GridLength(newHeight + listbox.Margin.Bottom);
            MainGrid.Height    = MainGrid.RowDefinitions[0].Height.Value + MainGrid.RowDefinitions[1].Height.Value + MainGrid.RowDefinitions[2].Height.Value;
            this.Height        = MainGrid.Height;
            BorderPoint1.Point = new Point(0, newHeight + MainGrid.RowDefinitions[1].ActualHeight + listbox.Margin.Bottom);
            BorderPoint2.Point = new Point(MainGrid.ActualWidth - CategoryGrid.ActualWidth, newHeight + MainGrid.RowDefinitions[1].ActualHeight + listbox.Margin.Bottom);

            // Logger.Debug("MainGrid.Height: " + MainGrid.Height);
            _boundArea.ResizeAndAdaptBorder(MainGrid);
        }
コード例 #6
0
        public static void ScrollIntoViewCentered(this SurfaceListBox listBox, object item)
        {
            Debug.Assert(!VirtualizingStackPanel.GetIsVirtualizing(listBox),
                         "VirtualizingStackPanel.IsVirtualizing must be disabled for ScrollIntoViewCentered to work.");
            Debug.Assert(!ScrollViewer.GetCanContentScroll(listBox),
                         "ScrollViewer.GetCanContentScroll must be disabled for ScrollIntoViewCentered to work.");

            // Get the container for the specified item
            var container = listBox.ItemContainerGenerator.ContainerFromItem(item) as FrameworkElement;

            if (null != container)
            {
                // Get the bounds of the item container
                var rect = new Rect(new Point(), container.RenderSize);

                // Find constraining parent (either the nearest ScrollContentPresenter or the ListBox itself)
                FrameworkElement constrainingParent = container;
                do
                {
                    constrainingParent = VisualTreeHelper.GetParent(constrainingParent) as FrameworkElement;
                } while ((null != constrainingParent) &&
                         (listBox != constrainingParent) &&
                         !(constrainingParent is ScrollContentPresenter));

                if (null != constrainingParent)
                {
                    // Inflate rect to fill the constraining parent
                    rect.Inflate(
                        Math.Max((constrainingParent.ActualWidth - rect.Width) / 2, 0),
                        Math.Max((constrainingParent.ActualHeight - rect.Height) / 2, 0));
                }

                // Bring the (inflated) bounds into view
                container.BringIntoView(rect);
            }
        }
コード例 #7
0
 public void resetValues(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar)
 {
     mainScatterView = _mainScatterView;
     bar = _bar;
     win = _win;
     isDocked = false;
 }
コード例 #8
0
        /// <summary>
        /// used by artwork mode
        /// </summary>
        public DockableItem(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar, String imageURIPathParam, AssociatedDocListBoxItem _aldbi, String description)
        {
            scatteruri = imageURIPathParam;
            image = new Image();
            aldbi = null;
            _helpers = new Helpers();
            _description = description;
            FileStream stream = new FileStream(imageURIPathParam, FileMode.Open);
            System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
            System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
            image.Source = wpfImage.Source;
            stream.Close();

            this.isAnimating = false;
            //this.Background = Brushes.LightGray;
            //this.Background.Opacity = 0.0;

            mainScatterView = _mainScatterView;
            bar = _bar;
            win = _win;
            isDocked = false;
            touchDown = false;
            aldbi = _aldbi;

            if (_description == "")
                _description = "Description not found.";

                descriptionBox = new ScatterViewItem(); ///////
                descriptionLabel = new Label();
                descriptionBox.CanRotate = false;
                descriptionBox.CanScale = false;
                descriptionBox.CanMove = false;
                descriptionLabel.Opacity = .85;
                descriptionLabel.BorderBrush = Brushes.Black;
                descriptionLabel.BorderThickness = new Thickness(2.0);
                if (aldbi != null)
                {
                    descriptionLabel.Content = aldbi.getLabel();
                }
                descriptionLabel.Content += "\nMedia Description (tap media item to reread):\n\n" + _description;
                descriptionLabel.Background = Brushes.Khaki;
                descriptionLabel.Foreground = Brushes.Black;
                descriptionBox.Content = descriptionLabel;

                mainScatterView.Items.Add(descriptionBox);

                descriptionBox.Visibility = Visibility.Collapsed;

            this.AddChild(image);

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd.AddValueChanged(this, CenterChangedListener);

            this.PreviewTouchUp += new EventHandler<TouchEventArgs>(AddtoDock);
            this.PreviewMouseUp += new MouseButtonEventHandler(AddtoDock);

            mainScatterView.Items.Add(this);
            this.SetCurrentValue(HeightProperty, image.Height);
            this.SetCurrentValue(WidthProperty, image.Width);

            this.PreviewMouseWheel += new MouseWheelEventHandler(DockableItem_PreviewMouseWheel);
            this.CaptureMouse();

            Random rnd = new Random();
            Point pt = new Point(rnd.Next((int)(win.ActualWidth * .2 + image.ActualWidth * 3), (int)(win.ActualWidth - image.ActualWidth * 3 - 100)),
                                                          rnd.Next((int)(image.ActualHeight * 3), (int)(win.ActualHeight * .8 - image.ActualHeight * 3)));
            this.SetCurrentValue(CenterProperty, pt);
            this.Orientation = rnd.Next(-20, 20);

            this.Loaded += new RoutedEventHandler(DockableItem_Loaded);

            imageURIPath = imageURIPathParam;
        }
コード例 #9
0
        //constructor for VIDEOS
        public DockableItem(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar, string _targetVid, AssociatedDocListBoxItem _aldbi, LADSVideoBubble _video, VideoItem _vidctrl, String description)
        {
            isVideo = true;
            scatteruri = _targetVid;
            vidBub = _video;
            _helpers = new Helpers();
            _description = description;
            image = new Image();
            aldbi = null;
            String thumbFileName = _targetVid;

            //the video thumbnail filename is the same name with a different extension. This gets that extension
            int decrement = System.IO.Path.GetExtension(thumbFileName).Length;
            thumbFileName = thumbFileName.Remove(thumbFileName.Length - decrement, decrement);
            thumbFileName += ".bmp";
            thumbFileName = System.IO.Path.GetFileName(thumbFileName);
            thumbFileName = "Data\\Videos\\Metadata\\" + thumbFileName;

            //opens in filestream to prevent errors from the file already being open
            FileStream stream = new FileStream(thumbFileName, FileMode.Open);
            System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
            System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
            image.Source = wpfImage.Source;
            stream.Close();

            this.isAnimating = false;
            this.Background = Brushes.LightGray;
            this.AddChild(vidBub);
            this.UpdateLayout();
            mainScatterView = _mainScatterView;
            bar = _bar;
            win = _win;
            isDocked = false;
            touchDown = false;
            aldbi = _aldbi;

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd.AddValueChanged(this, CenterChangedListener);

            this.PreviewTouchUp += new EventHandler<TouchEventArgs>(AddtoDock);
            this.PreviewMouseUp += new MouseButtonEventHandler(AddtoDock);
            this.PreviewMouseWheel += new MouseWheelEventHandler(DockableItem_PreviewMouseWheel);
            this.CaptureMouse();

            mainScatterView.Items.Add(this);

            Random rnd = new Random();
            Point pt = new Point(rnd.Next((int)(win.ActualWidth * .2 + vidBub.ActualWidth * 3), (int)(win.ActualWidth - vidBub.ActualWidth * 3 - 100)),
                                                           rnd.Next((int)(vidBub.ActualHeight * 3), (int)(win.ActualHeight * .8 - vidBub.ActualHeight * 3)));
            this.SetCurrentValue(CenterProperty, pt);
            this.Orientation = rnd.Next(-20, 20);

            imageURIPath = _targetVid;
            MediaElement vid = vidBub.getVideo();
            vid.MediaOpened += new RoutedEventHandler(video_MediaOpened);
            vid.Loaded += new RoutedEventHandler(video_MediaOpened);
            this.MinHeight = 100;
        }
コード例 #10
0
 public VerticallyUnscrollableInnerList(SurfaceScrollViewer scroller, SurfaceListBox media)
 {
     _scroller = scroller;
     _media    = media;
 }
コード例 #11
0
        /// <summary>
        /// used by artwork mode, including the tour authoring & playback system
        /// </summary>
        public DockableItem(ScatterView _mainScatterView, ArtworkModeWindow _win, SurfaceListBox _bar, String imageURIPathParam)
        {
            scatteruri = imageURIPathParam;
            image = new Image();
            aldbi = null;
            _helpers = new Helpers();

            FileStream stream = new FileStream(imageURIPathParam, FileMode.Open);
            System.Drawing.Image dImage = System.Drawing.Image.FromStream(stream);
            System.Windows.Controls.Image wpfImage = _helpers.ConvertDrawingImageToWPFImage(dImage);
            image.Source = wpfImage.Source;

            this.isAnimating = false;
            this.Background = Brushes.LightGray;
            this.AddChild(image);
            mainScatterView = _mainScatterView;
            bar = _bar;
            win = _win;
            isDocked = false;
            touchDown = false;

            this.Loaded += new RoutedEventHandler(DockableItem_Loaded);

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd.AddValueChanged(this, CenterChangedListener);

            this.PreviewTouchUp += new EventHandler<TouchEventArgs>(AddtoDock);
            this.PreviewMouseUp += new MouseButtonEventHandler(AddtoDock);

            mainScatterView.Items.Add(this);
            this.SetCurrentValue(HeightProperty, image.Height);
            this.SetCurrentValue(WidthProperty, image.Width);

            this.PreviewMouseWheel += new MouseWheelEventHandler(DockableItem_PreviewMouseWheel);
            this.CaptureMouse();

            Random rnd = new Random();

            this.Background = new SolidColorBrush(Colors.Transparent);
            RoutedEventHandler loadedEventHandler = null;
            loadedEventHandler = new RoutedEventHandler(delegate
            {
                this.Loaded -= loadedEventHandler;
                try
                {
                    Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc;
                    ssc = this.Template.FindName("shadow", this) as Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome;
                    ssc.Visibility = Visibility.Hidden;
                }
                catch (Exception exc) { }

            });
            this.Loaded += loadedEventHandler;

            imageURIPath = imageURIPathParam;

            stream.Close();
        }
コード例 #12
0
        public void SelectPage(DataItem d, object sender)
        {
            Storyboard sBrd;
            Storyboard sBrd2;

            if (d == null)
            {
                return;
            }

            if (selectedItem == d)
            {
                return;
            }

            selectedItem = d;

            if (sender == null)
            {
                return;
            }
            else
            {
                SurfaceListBox lb = sender as SurfaceListBox;

                if (lb.Name == "LeftScatterBar")
                {
                    sBrd  = (Storyboard)Resources["SlideLeftToOrigin"];
                    sBrd2 = (Storyboard)Resources["SlideOriginToRight"];
                }
                else
                {
                    sBrd  = (Storyboard)Resources["SlideRightToOrigin"];
                    sBrd2 = (Storyboard)Resources["SlideOriginToLeft"];
                }
            }


            if (!DefaultPanel.Children.Contains(d.PageControl))
            {
                FrameworkElement oldPage = DefaultPanel.Children[0] as FrameworkElement;
                //DefaultPanel.Children.Clear();

                UserControl ctrl    = d.PageControl as UserControl;
                Grid        newGrid = new Grid();

                //Grid c = VisualTreeHelper.GetParent(ctrl) as Grid;
                //c.Children.Clear();
                if (ctrl.Parent != null)
                {
                    (ctrl.Parent as Panel).Children.Remove(ctrl);
                }
                newGrid.Children.Add(ctrl);

                if (ctrl is ResettableControl)
                {
                    (ctrl as ResettableControl).reset();
                }


                TranslateTransform tr = new TranslateTransform();
                TransformGroup     myTransformGroup = new TransformGroup();
                myTransformGroup.Children.Add(tr);
                newGrid.RenderTransform = myTransformGroup;

                tr = new TranslateTransform();
                myTransformGroup = new TransformGroup();
                myTransformGroup.Children.Add(tr);
                oldPage.RenderTransform = myTransformGroup;

                sBrd.Begin(newGrid);
                sBrd2.Completed += sBrd2Complete;

                sBrd2.Begin(oldPage);

                Grid.SetColumn(newGrid, 0);
                Grid.SetColumnSpan(newGrid, 2);
                Grid.SetRow(newGrid, 0);
                Grid.SetRowSpan(newGrid, 2);

                DefaultPanel.Children.Add(newGrid);
            }
        }
コード例 #13
0
ファイル: TabItemViewModel.cs プロジェクト: TNOCS/csTouch
        /// <summary>
        /// The poi selection changed.
        /// </summary>
        /// <param name="s">
        /// The s.
        /// </param>
        /// <param name="dc">
        /// The dc.
        /// </param>
        public void PoiSelectionChanged(ActionExecutionContext s, SelectionChangedEventArgs dc)
        {
            var slb = (SurfaceListBox)s.Source;
            if (slb.SelectedItem != null && !Equals(slb, this.lastSelected) && this.lastSelected != null)
            {
                this.lastSelected.SelectedItem = null;
            }

            if (slb.SelectedItems.Count > 1 && dc.AddedItems != null && dc.AddedItems.Count == 1)
            {
                slb.SelectedItem = dc.AddedItems[0];
                return;
            }

            this.lastSelected = slb;
            this.SelectedPoiType = (PoI)slb.SelectedItem;
        }
コード例 #14
0
 public void SelectionChanged(SurfaceListBox s)
 {
     SelectedClients.Clear();
     foreach (ImbClientStatus c in s.SelectedItems) SelectedClients.Add(c);
 }
コード例 #15
0
ファイル: SearchTab.cs プロジェクト: straboulsi/fauvel
        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);
        }
コード例 #16
0
 private void MoveHistory(SurfaceListBox container, Point place, double angle)
 {
     TransformGroup transform = new TransformGroup();
     transform.Children.Add(new ScaleTransform(0.45, 0.35));
     transform.Children.Add(new RotateTransform(angle));
     transform.Children.Add(new TranslateTransform(place.X, place.Y));
     container.ToolTip = "History";
     container.RenderTransform = transform;
 }
コード例 #17
0
        /// <summary>
        /// Schaltet Inhalt um, je nach gewähltem Tab.
        /// </summary>
        /// <param name="newCategory"></param>
        private void SwitchCategory(int newCategory)
        {
            if (previewCategory == -1)
            {
                return;
            }

            _currentListBox.SelectedIndex = -1;

            switch (_currentCategory)
            {
            case 0:
                Cat0ListBox.Visibility = System.Windows.Visibility.Hidden;
                Category0Rect.Fill     = new SolidColorBrush((Color)FindResource("Category0ColorFadeNEW"));
                CreateReduceStoryBoard(Category0Rect, Category0Text, Category0Image);
                break;

            case 1:
                Cat1ListBox.Visibility = System.Windows.Visibility.Hidden;
                Category1Rect.Fill     = new SolidColorBrush((Color)FindResource("Category1ColorFadeNEW"));
                CreateReduceStoryBoard(Category1Rect, Category1Text, Category1Image);
                break;

            case 2:
                Cat2ListBox.Visibility = System.Windows.Visibility.Hidden;
                Category2Rect.Fill     = new SolidColorBrush((Color)FindResource("Category2ColorFadeNEW"));
                CreateReduceStoryBoard(Category2Rect, Category2Text, Category2Image);
                break;

            case 3:
                Cat3ListBox.Visibility = System.Windows.Visibility.Hidden;
                Category3Rect.Fill     = new SolidColorBrush((Color)FindResource("Category3ColorFadeNEW"));
                CreateReduceStoryBoard(Category3Rect, Category3Text, Category3Image);
                break;

            case 4:
                Cat4ListBox.Visibility = System.Windows.Visibility.Hidden;
                Category4Rect.Fill     = new SolidColorBrush((Color)FindResource("Category4ColorFadeNEW"));
                CreateReduceStoryBoard(Category4Rect, Category4Text, Category4Image);
                break;
            }

            // Create a linear gradient brush with 2 stops
            LinearGradientBrush linGB = new LinearGradientBrush();

            linGB.StartPoint = new Point(0.5, 0);
            linGB.EndPoint   = new Point(0.5, 1);
            // Create and add Gradient stops
            GradientStop firstGS = new GradientStop();

            firstGS.Offset = 0.0;
            linGB.GradientStops.Add(firstGS);
            GradientStop secondGS = new GradientStop();

            secondGS.Offset = 0.9;
            linGB.GradientStops.Add(secondGS);
            // Set Fill property of rectangle
            BackgroundRectangleHeader.Fill = linGB;
            firstGS.Color  = (Color)FindResource("Category" + newCategory + "ColorStrongNEW");
            secondGS.Color = (Color)FindResource("Category" + newCategory + "ColorFadeNEW");
            BackgroundRectangleListBox.Fill = new SolidColorBrush((Color)FindResource("Category" + newCategory + "ColorFadeNEW"));

            //Border.Stroke = new SolidColorBrush((Color)FindResource("Category" + newCategory + "ColorStrongNEW"));

            SurfaceListBox newListBox = Cat0ListBox;

            switch (newCategory)
            {
            case 0:
                Cat0ListBox.Visibility = System.Windows.Visibility.Visible;
                // Category0Line.Visibility = System.Windows.Visibility.Hidden;

                CreateExpandStoryBoard(Category0Rect, Category0Text, Category0Image);

                break;

            case 1:
                Cat1ListBox.Visibility = System.Windows.Visibility.Visible;
                // Category1Line.Visibility = System.Windows.Visibility.Hidden;

                CreateExpandStoryBoard(Category1Rect, Category1Text, Category1Image);

                newListBox = Cat1ListBox;

                break;

            case 2:
                Cat2ListBox.Visibility = System.Windows.Visibility.Visible;
                // Category2Line.Visibility = System.Windows.Visibility.Hidden;

                CreateExpandStoryBoard(Category2Rect, Category2Text, Category2Image);

                newListBox = Cat2ListBox;

                break;

            case 3:
                Cat3ListBox.Visibility = System.Windows.Visibility.Visible;
                // Category3Line.Visibility = System.Windows.Visibility.Hidden;

                CreateExpandStoryBoard(Category3Rect, Category3Text, Category3Image);

                newListBox = Cat3ListBox;

                break;

            case 4:
                Cat4ListBox.Visibility = System.Windows.Visibility.Visible;
                // Category4Line.Visibility = System.Windows.Visibility.Hidden;

                CreateExpandStoryBoard(Category4Rect, Category4Text, Category4Image);

                newListBox = Cat4ListBox;

                break;
            }

            if (newCategory == 0)
            {
                _attachedMenu.SetOptions(_attachedMenu.OptionTexts[0].Text, _attachedMenu.OptionTexts[1].Text, "Remove from Favourites", "../Images/play_black.png", "../Images/lupe_black.png", "../Images/wherz_black_crossed.png");
            }
            else
            {
                _attachedMenu.SetOptions(_attachedMenu.OptionTexts[0].Text, _attachedMenu.OptionTexts[1].Text, "Add to Favourites", "../Images/play_black.png", "../Images/lupe_black.png", "../Images/wherz_black_crossed2.png");
            }

            _currentCategory = newCategory;
            previewCategory  = -1;

            if (_currentListBox.Height != newListBox.Height)
            {
                ResizeListBox(newListBox);
            }
            _currentListBox = newListBox;
        }
コード例 #18
0
 /// <summary>
 /// binds the history information to the appropriate menu
 /// </summary>
 /// <param name="container"></param>
 /// <param name="menu"></param>
 private void SetUpHistory(SurfaceListBox container, IndividualMenu menu)
 {
     //2.22222 is the inverse of the scaling factor used in moveHistory 35 was picked for looks so the menu doesn't over lap the ItemMenu
     container.MaxWidth = menu.Width * 2.2222- 35;
     System.Windows.Data.Binding bind = new System.Windows.Data.Binding("History");
     bind.Source = menu;
     container.SetBinding(LibraryBar.ItemsSourceProperty, bind);
 }