Inheritance: System.Windows.Controls.Control
Esempio n. 1
0
        private static void OnIsExpandedChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            LoopingSelector picker = (LoopingSelector)sender;

            if (picker.IsExpanded)
            {
                picker.Balance();
            }
            else
            {
                picker.SelectAndSnapToClosest();
            }

            picker.UpdateItemState();

            if (picker._state == State.Normal || picker._state == State.Expanded)
            {
                picker._state = picker.IsExpanded ? State.Expanded : State.Normal;
            }

            picker._actualIsExpanded = picker.IsExpanded;

            var listeners = picker.IsExpandedChanged;

            if (listeners != null)
            {
                listeners(picker, e);
            }
        }
Esempio n. 2
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/News;component/LoopPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.selectorLeft = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("selectorLeft")));
     this.LoadingPanel = ((System.Windows.Controls.Grid)(this.FindName("LoadingPanel")));
     this.loadingLabel = ((System.Windows.Controls.TextBlock)(this.FindName("loadingLabel")));
     this.loadingProgressBar = ((Microsoft.Phone.Controls.PerformanceProgressBar)(this.FindName("loadingProgressBar")));
 }
Esempio n. 3
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/MeterMaid;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.m_oTimer_lbl = ((System.Windows.Controls.TextBlock)(this.FindName("m_oTimer_lbl")));
     this.m_oHourLooper = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("m_oHourLooper")));
     this.m_oMinuteLooper = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("m_oMinuteLooper")));
     this.m_oIncMinute = ((System.Windows.Controls.Button)(this.FindName("m_oIncMinute")));
 }
Esempio n. 4
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/EnterraPokerTimer;component/Views/GameTimePage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.GameGrid = ((System.Windows.Controls.Grid)(this.FindName("GameGrid")));
     this.Days = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("Days")));
     this.HoursGame = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("HoursGame")));
     this.MinGame = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("MinGame")));
     this.gameUnlimited = ((Microsoft.Phone.Controls.ToggleSwitch)(this.FindName("gameUnlimited")));
 }
Esempio n. 5
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/EnterraPokerTimer;component/LevelBreakPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.BreakGrid = ((System.Windows.Controls.Grid)(this.FindName("BreakGrid")));
     this.Hours = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("Hours")));
     this.Min = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("Min")));
     this.FrequencyStackPanel = ((System.Windows.Controls.StackPanel)(this.FindName("FrequencyStackPanel")));
     this.frequency = ((System.Windows.Controls.TextBox)(this.FindName("frequency")));
 }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/DatePickerPage.xaml", System.UriKind.Relative));
     this.VisibilityStates = ((System.Windows.VisualStateGroup)(this.FindName("VisibilityStates")));
     this.Open = ((System.Windows.VisualState)(this.FindName("Open")));
     this.Closed = ((System.Windows.VisualState)(this.FindName("Closed")));
     this.PlaneProjection = ((System.Windows.Media.PlaneProjection)(this.FindName("PlaneProjection")));
     this.SystemTrayPlaceholder = ((System.Windows.Shapes.Rectangle)(this.FindName("SystemTrayPlaceholder")));
     this.SecondarySelector = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("SecondarySelector")));
     this.TertiarySelector = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("TertiarySelector")));
     this.PrimarySelector = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("PrimarySelector")));
 }
Esempio n. 7
0
        private static void OnDataSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            LoopingSelector picker = (LoopingSelector)obj;

            if (e.OldValue != null)
            {
                ((ILoopingSelectorDataSource)e.OldValue).SelectionChanged -= picker.OnDataSourceSelectionChanged;
            }

            if (e.NewValue != null)
            {
                ((ILoopingSelectorDataSource)e.NewValue).SelectionChanged += picker.OnDataSourceSelectionChanged;
            }

            picker.UpdateData();
        }
Esempio n. 8
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/TimePickerPage.xaml", System.UriKind.Relative));
     this.VisibilityStates      = ((System.Windows.VisualStateGroup)(this.FindName("VisibilityStates")));
     this.Open                  = ((System.Windows.VisualState)(this.FindName("Open")));
     this.Closed                = ((System.Windows.VisualState)(this.FindName("Closed")));
     this.PlaneProjection       = ((System.Windows.Media.PlaneProjection)(this.FindName("PlaneProjection")));
     this.SystemTrayPlaceholder = ((System.Windows.Shapes.Rectangle)(this.FindName("SystemTrayPlaceholder")));
     this.PrimarySelector       = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("PrimarySelector")));
     this.SecondarySelector     = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("SecondarySelector")));
     this.TertiarySelector      = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("TertiarySelector")));
 }
        /// <summary>
        /// Initializes the DateTimePickerPageBase class; must be called from the subclass's constructor.
        /// </summary>
        /// <param name="primarySelector">Primary selector.</param>
        /// <param name="secondarySelector">Secondary selector.</param>
        /// <param name="tertiarySelector">Tertiary selector.</param>
        protected void InitializeDateTimePickerPage(LoopingSelector primarySelector, LoopingSelector secondarySelector, LoopingSelector tertiarySelector)
        {
            if (null == primarySelector)
            {
                throw new ArgumentNullException("primarySelector");
            }
            if (null == secondarySelector)
            {
                throw new ArgumentNullException("secondarySelector");
            }
            if (null == tertiarySelector)
            {
                throw new ArgumentNullException("tertiarySelector");
            }

            _primarySelectorPart = primarySelector;
            _secondarySelectorPart = secondarySelector;
            _tertiarySelectorPart = tertiarySelector;

            // Hook up to interesting events
            _primarySelectorPart.DataSource.SelectionChanged += OnDataSourceSelectionChanged;
            _secondarySelectorPart.DataSource.SelectionChanged += OnDataSourceSelectionChanged;
            _tertiarySelectorPart.DataSource.SelectionChanged += OnDataSourceSelectionChanged;
            _primarySelectorPart.IsExpandedChanged += OnSelectorIsExpandedChanged;
            _secondarySelectorPart.IsExpandedChanged += OnSelectorIsExpandedChanged;
            _tertiarySelectorPart.IsExpandedChanged += OnSelectorIsExpandedChanged;

            // Hide all selectors
            _primarySelectorPart.Visibility = Visibility.Collapsed;
            _secondarySelectorPart.Visibility = Visibility.Collapsed;
            _tertiarySelectorPart.Visibility = Visibility.Collapsed;

            // Position and reveal the culture-relevant selectors
            int column = 0;
            foreach (LoopingSelector selector in GetSelectorsOrderedByCulturePattern())
            {
                Grid.SetColumn(selector, column);
                selector.Visibility = Visibility.Visible;
                column++;
            }

            // Hook up to storyboard(s)
            FrameworkElement templateRoot = VisualTreeHelper.GetChild(this, 0) as FrameworkElement;
            if (null != templateRoot)
            {
                foreach (VisualStateGroup group in VisualStateManager.GetVisualStateGroups(templateRoot))
                {
                    if (VisibilityGroupName == group.Name)
                    {
                        foreach (VisualState state in group.States)
                        {
                            if ((ClosedVisibilityStateName == state.Name) && (null != state.Storyboard))
                            {
                                _closedStoryboard = state.Storyboard;
                                _closedStoryboard.Completed += OnClosedStoryboardCompleted;
                            }
                        }
                    }
                }
            }

            // Customize the ApplicationBar Buttons by providing the right text
            if (null != ApplicationBar)
            {
                foreach (object obj in ApplicationBar.Buttons)
                {
                    IApplicationBarIconButton button = obj as IApplicationBarIconButton;
                    if (null != button)
                    {
                        if ("DONE" == button.Text)
                        {
                            button.Text = LocalizedResources.ControlResources.DateTimePickerDoneText;
                            button.Click += OnDoneButtonClick;
                        }
                        else if ("CANCEL" == button.Text)
                        {
                            button.Text = LocalizedResources.ControlResources.DateTimePickerCancelText;
                            button.Click += OnCancelButtonClick;
                        }
                    }
                }
            }

            // Play the Open state
            VisualStateManager.GoToState(this, OpenVisibilityStateName, true);
        }
        /// <summary>
        /// Gets a sequence of LoopingSelector parts ordered according to culture string for date/time formatting.
        /// </summary>
        /// <param name="pattern">Culture-specific date/time format string.</param>
        /// <param name="patternCharacters">Date/time format string characters for the primary/secondary/tertiary LoopingSelectors.</param>
        /// <param name="selectors">Instances for the primary/secondary/tertiary LoopingSelectors.</param>
        /// <returns>LoopingSelectors ordered by culture-specific priority.</returns>
        protected static IEnumerable<LoopingSelector> GetSelectorsOrderedByCulturePattern(string pattern, char[] patternCharacters, LoopingSelector[] selectors)
        {
            if (null == pattern)
            {
                throw new ArgumentNullException("pattern");
            }
            if (null == patternCharacters)
            {
                throw new ArgumentNullException("patternCharacters");
            }
            if (null == selectors)
            {
                throw new ArgumentNullException("selectors");
            }
            if (patternCharacters.Length != selectors.Length)
            {
                throw new ArgumentException("Arrays must contain the same number of elements.");
            }

            // Create a list of index and selector pairs
            List<Tuple<int, LoopingSelector>> pairs = new List<Tuple<int, LoopingSelector>>(patternCharacters.Length);
            for (int i = 0; i < patternCharacters.Length; i++)
            {
                pairs.Add(new Tuple<int, LoopingSelector>(pattern.IndexOf(patternCharacters[i]), selectors[i]));
            }

            // Return the corresponding selectors in order
            return pairs.Where(p => -1 != p.Item1).OrderBy(p => p.Item1).Select(p => p.Item2).Where(s => null != s);
        }
Esempio n. 11
0
        private static void OnItemTemplateChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            LoopingSelector picker = (LoopingSelector)obj;

            picker.UpdateItemTemplates();
        }
        /// <summary>
        /// Initializes the DateTimePickerPageBase class; must be called from the subclass's constructor.
        /// </summary>
        /// <param name="primarySelector">Primary selector.</param>
        /// <param name="secondarySelector">Secondary selector.</param>
        /// <param name="tertiarySelector">Tertiary selector.</param>
        protected void InitializeDateTimePickerPage(LoopingSelector primarySelector, LoopingSelector secondarySelector, LoopingSelector tertiarySelector)
        {
            if (null == primarySelector)
            {
                throw new ArgumentNullException("primarySelector");
            }
            if (null == secondarySelector)
            {
                throw new ArgumentNullException("secondarySelector");
            }
            if (null == tertiarySelector)
            {
                throw new ArgumentNullException("tertiarySelector");
            }

            _primarySelectorPart   = primarySelector;
            _secondarySelectorPart = secondarySelector;
            _tertiarySelectorPart  = tertiarySelector;

            // Hook up to interesting events
            _primarySelectorPart.DataSource.SelectionChanged   += new EventHandler <SelectionChangedEventArgs>(HandleDataSourceSelectionChanged);
            _secondarySelectorPart.DataSource.SelectionChanged += new EventHandler <SelectionChangedEventArgs>(HandleDataSourceSelectionChanged);
            _tertiarySelectorPart.DataSource.SelectionChanged  += new EventHandler <SelectionChangedEventArgs>(HandleDataSourceSelectionChanged);
            _primarySelectorPart.IsExpandedChanged             += new DependencyPropertyChangedEventHandler(HandleSelectorIsExpandedChanged);
            _secondarySelectorPart.IsExpandedChanged           += new DependencyPropertyChangedEventHandler(HandleSelectorIsExpandedChanged);
            _tertiarySelectorPart.IsExpandedChanged            += new DependencyPropertyChangedEventHandler(HandleSelectorIsExpandedChanged);

            // Hide all selectors
            _primarySelectorPart.Visibility   = Visibility.Collapsed;
            _secondarySelectorPart.Visibility = Visibility.Collapsed;
            _tertiarySelectorPart.Visibility  = Visibility.Collapsed;

            // Position and reveal the culture-relevant selectors
            int column = 0;

            foreach (LoopingSelector selector in GetSelectorsOrderedByCulturePattern())
            {
                Grid.SetColumn(selector, column);
                selector.Visibility = Visibility.Visible;
                column++;
            }

            // Hook up to storyboard(s)
            FrameworkElement templateRoot = VisualTreeHelper.GetChild(this, 0) as FrameworkElement;

            if (null != templateRoot)
            {
                foreach (VisualStateGroup group in VisualStateManager.GetVisualStateGroups(templateRoot))
                {
                    if (VisibilityGroupName == group.Name)
                    {
                        foreach (VisualState state in group.States)
                        {
                            if ((ClosedVisibilityStateName == state.Name) && (null != state.Storyboard))
                            {
                                _closedStoryboard            = state.Storyboard;
                                _closedStoryboard.Completed += new EventHandler(HandleClosedStoryboardCompleted);
                            }
                        }
                    }
                }
            }

            // Customize the ApplicationBar Buttons by providing the right text
            if (null != ApplicationBar)
            {
                foreach (object obj in ApplicationBar.Buttons)
                {
                    IApplicationBarIconButton button = obj as IApplicationBarIconButton;
                    if (null != button)
                    {
                        if ("DONE" == button.Text)
                        {
                            button.Text   = Properties.Resources.DateTimePickerDoneText;
                            button.Click += new EventHandler(HandleDoneButtonClick);
                        }
                        else if ("CANCEL" == button.Text)
                        {
                            button.Text   = Properties.Resources.DateTimePickerCancelText;
                            button.Click += new EventHandler(HandleCancelButtonClick);
                        }
                    }
                }
            }

            // Play the Open state
            VisualStateManager.GoToState(this, OpenVisibilityStateName, true);
        }
        private static void OnDataModelChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            LoopingSelector picker = (LoopingSelector)obj;

            picker.UpdateData();
        }
        /**
         * @author Ciprian Filipas
         * @brief This function is used for initializing the looping selector
         */
        protected void InitializeNumberPickerpage(LoopingSelector primarySelector)
        {
            if (null == primarySelector)
            {
                throw new ArgumentOutOfRangeException("primarySelector");
            }

            mPrimarySelectorPart = primarySelector;

            mPrimarySelectorPart.DataSource.SelectionChanged += OnDataSourceSelectionChanged;
        }
Esempio n. 15
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/icehockeyWA;component/Views/Penalty.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TopPanel = ((System.Windows.Controls.Grid)(this.FindName("TopPanel")));
     this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.LoopingSelectorPanel = ((System.Windows.Controls.Grid)(this.FindName("LoopingSelectorPanel")));
     this.PlayerLoopingSelector = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("PlayerLoopingSelector")));
     this.PenaltyLoopingSelector = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("PenaltyLoopingSelector")));
     this.TimeLoopingSelector = ((Microsoft.Phone.Controls.Primitives.LoopingSelector)(this.FindName("TimeLoopingSelector")));
     this.OptionPanel = ((System.Windows.Controls.Grid)(this.FindName("OptionPanel")));
     this.PenaltyShotChk = ((System.Windows.Controls.CheckBox)(this.FindName("PenaltyShotChk")));
     this.OtherPenaltyBtn = ((System.Windows.Controls.Button)(this.FindName("OtherPenaltyBtn")));
     this.PenaltiesListBox = ((System.Windows.Controls.ListBox)(this.FindName("PenaltiesListBox")));
     this.ButtonPanel = ((System.Windows.Controls.Grid)(this.FindName("ButtonPanel")));
     this.AddHomePenaltyBtn = ((System.Windows.Controls.Button)(this.FindName("AddHomePenaltyBtn")));
     this.AddAwayPenaltyBtn = ((System.Windows.Controls.Button)(this.FindName("AddAwayPenaltyBtn")));
     this.ConfirmBtn = ((System.Windows.Controls.Button)(this.FindName("ConfirmBtn")));
 }