예제 #1
0
 void selection_SelectionComplete(object sender, RoutedEventArgs e)
 {
     try
     {
         timer.Stop();
         ucSelection selection = (ucSelection)e.Source;
         this.dsSelectionIndex = selection.dsSelectionIndex;
         RaiseEvent(new RoutedEventArgs(SelectionBarCompleteEvent));
     }
     catch { }
 }
예제 #2
0
        public void ResetControl()
        {
            try
            {
                // Resizes and positions the control contents according to the specified properties

                selections = new List <ucSelection>();
                gridSelections.Children.Clear();
                dsSelectionIndex = 0;
                dsCurrentIndex   = 0;
                xPosition        = 0;
                selectionindex   = 0;
                zorder           = 300;

                MoveCenterReset();

                // Set the clipping region
                rectClip.Rect = new Rect(0, 0, this.Width, this.Height + 60);

                // Set the Background color - applied to gridMain
                gridMain.Background = new SolidColorBrush(dsBackgroundColor);
                gridMain.Width      = this.Width;
                gridMain.Height     = this.Height;

                // Reposition the buttons if width is less than 1280
                if (dsMainWindowWidth < 1280)
                {
                    gridNextButton.HorizontalAlignment = HorizontalAlignment.Center;
                    gridNextButton.Margin = new Thickness(525, 0, 0, -55);

                    gridBackButton.HorizontalAlignment = HorizontalAlignment.Center;
                    gridBackButton.Margin = new Thickness(240, 0, 0, -55);

                    gridCloseButton.HorizontalAlignment = HorizontalAlignment.Center;
                    gridCloseButton.Margin = new Thickness(-525, 0, 0, -55);
                }

                // Set the button label text
                txtBack.Text  = dsButtonBackText;
                txtNext.Text  = dsButtonNextText;
                txtClose.Text = dsButtonCloseText;

                // Create the selections
                double startingLeft = (this.Width / 2) - 150.0;
                int    i            = 0;
                foreach (string image in dsImageURLs)
                {
                    ucSelection selection = new ucSelection();
                    selection.Width               = 300;
                    selection.Height              = 210;
                    selection.VerticalAlignment   = VerticalAlignment.Top;
                    selection.HorizontalAlignment = HorizontalAlignment.Left;
                    selection.dsImageURL          = image;
                    selection.dsSelectionIndex    = i;
                    selection.Margin              = new Thickness((startingLeft + (i * 310)), 65, 0, 0);
                    selection.SelectionComplete  += new RoutedEventHandler(selection_SelectionComplete);
                    selection.SelectionBack      += new RoutedEventHandler(selection_SelectionBack);
                    selection.SelectionNext      += new RoutedEventHandler(selection_SelectionNext);
                    selection.ResetControl();
                    selections.Add(selection);
                    gridSelections.Children.Add(selection);
                    i += 1;
                }

                if (selections.Count > 0)
                {
                    zorder += 1;
                    selections[selectionindex].SetValue(Canvas.ZIndexProperty, zorder);
                    selections[0].ZoomIn();
                    txtCaption.Text = dsImageCaptions[0];
                }

                timer.Start();
            }
            catch { }
        }
예제 #3
0
        public void ResetControl()
        {
            try
            {
                // Resizes and positions the control contents according to the specified properties

                selections = new List<ucSelection>();
                gridSelections.Children.Clear();
                dsSelectionIndex = 0;
                dsCurrentIndex = 0;
                xPosition = 0;
                selectionindex = 0;
                zorder = 300;

                MoveCenterReset();

                // Set the clipping region
                rectClip.Rect = new Rect(0, 0, this.Width, this.Height + 60);

                // Set the Background color - applied to gridMain
                gridMain.Background = new SolidColorBrush(dsBackgroundColor);
                gridMain.Width = this.Width;
                gridMain.Height = this.Height;

                // Reposition the buttons if width is less than 1280
                if (dsMainWindowWidth < 1280)
                {
                    gridNextButton.HorizontalAlignment = HorizontalAlignment.Center;
                    gridNextButton.Margin = new Thickness(525, 0, 0, -55);

                    gridBackButton.HorizontalAlignment = HorizontalAlignment.Center;
                    gridBackButton.Margin = new Thickness(240, 0, 0, -55);

                    gridCloseButton.HorizontalAlignment = HorizontalAlignment.Center;
                    gridCloseButton.Margin = new Thickness(-525, 0, 0, -55);
                }

                // Set the button label text
                txtBack.Text = dsButtonBackText;
                txtNext.Text = dsButtonNextText;
                txtClose.Text = dsButtonCloseText;

                // Create the selections
                double startingLeft = (this.Width / 2) - 150.0;
                int i = 0;
                foreach (string image in dsImageURLs)
                {
                    ucSelection selection = new ucSelection();
                    selection.Width = 300;
                    selection.Height = 210;
                    selection.VerticalAlignment = VerticalAlignment.Top;
                    selection.HorizontalAlignment = HorizontalAlignment.Left;
                    selection.dsImageURL = image;
                    selection.dsSelectionIndex = i;
                    selection.dsUseKinect = this.dsUseKinect;
                    selection.Margin = new Thickness((startingLeft + (i * 310)), 65, 0, 0);
                    selection.SelectionComplete += new RoutedEventHandler(selection_SelectionComplete);
                    selection.SelectionBack += new RoutedEventHandler(selection_SelectionBack);
                    selection.SelectionNext += new RoutedEventHandler(selection_SelectionNext);
                    selection.SelectionMouseEnter += new RoutedEventHandler(selection_SelectionMouseEnter);
                    selection.SelectionMouseLeave += new RoutedEventHandler(selection_SelectionMouseLeave);
                    selection.ResetControl();
                    selections.Add(selection);
                    gridSelections.Children.Add(selection);
                    i += 1;
                }

                if (selections.Count > 0)
                {
                    zorder += 1;
                    selections[selectionindex].SetValue(Canvas.ZIndexProperty, zorder);
                    selections[0].ZoomIn();
                    txtCaption.Text = dsImageCaptions[0];
                }

                timer.Start();
            }
            catch { }
        }