Exemple #1
0
        void InitializeImpl(LoopingSelector pOwner)
        {
            //FrameworkElementAutomationPeerFactory spInnerFactory;
            //FrameworkElementAutomationPeer spInnerInstance;
            //FrameworkElement spLoopingSelectorAsFE;
            //var spOwner = pOwner;
            //DependencyObject spInnerInspectable;

            //ARG_NOTnull(pOwner, "pOwner");

            //LoopingSelectorAutomationPeerGenerated.InitializeImpl(pOwner);
            //(wf.GetActivationFactory(
            //	wrl_wrappers.Hstring(RuntimeClass_Microsoft_UI_Xaml_Automation_Peers_FrameworkElementAutomationPeer),
            //	&spInnerFactory));

            //(((DependencyObject)(pOwner)).QueryInterface<xaml.FrameworkElement>(
            //	&spLoopingSelectorAsFE));
            //spLoopingSelectorAsFE = pOwner;

            //(spInnerFactory.CreateInstanceWithOwner(
            //		spLoopingSelectorAsFE,
            //		(ILoopingSelectorAutomationPeer)(this),
            //		&spInnerInspectable,
            //		&spInnerInstance));

            //(SetComposableBasePointers(
            //	spInnerInspectable,
            //	spInnerFactory));
        }
        protected void InitializeDegreesPickerPage(LoopingSelector primarySelector)
        {
            if (null == primarySelector)
            {
                throw new ArgumentNullException("primarySelector");
            }

            _primarySelectorPart = primarySelector;

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

            // 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   = AppResources.Text_Button_Done;
                            button.Click += OnDoneButtonClick;
                        }
                        else if ("CANCEL" == button.Text)
                        {
                            button.Text   = AppResources.Text_Button_Cancel;
                            button.Click += OnCancelButtonClick;
                        }
                    }
                }
            }

            // Play the Open state
            VisualStateManager.GoToState(this, OpenVisibilityStateName, true);
        }
Exemple #3
0
        /**
         * @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;
        }
Exemple #4
0
        void GetOwnerAsInternalPtrNoRef(out LoopingSelector ppOwnerNoRef)
        {
            UIElement       spOwnerAsUIElement;
            LoopingSelector spOwner;
            FrameworkElementAutomationPeer spThisAsFEAP;

            ppOwnerNoRef = null;

            //(QueryInterface(
            //	__uuidof(FrameworkElementAutomationPeer),
            //	&spThisAsFEAP));
            spThisAsFEAP       = this;
            spOwnerAsUIElement = spThisAsFEAP.Owner;
            if (spOwnerAsUIElement is { })
Exemple #5
0
 public void InitializeComponent()
 {
     if (this._contentLoaded)
     {
         return;
     }
     this._contentLoaded = true;
     Application.LoadComponent((object)this, new Uri("/VKClient.Common;component/Framework/DatePicker/PostScheduleDatePickerPage.xaml", UriKind.Relative));
     this.gridRoot              = (Grid)this.FindName("gridRoot");
     this.VisibilityStates      = (VisualStateGroup)this.FindName("VisibilityStates");
     this.Open                  = (VisualState)this.FindName("Open");
     this.Closed                = (VisualState)this.FindName("Closed");
     this.PlaneProjection       = (PlaneProjection)this.FindName("PlaneProjection");
     this.SystemTrayPlaceholder = (Rectangle)this.FindName("SystemTrayPlaceholder");
     this.HeaderTitle           = (TextBlock)this.FindName("HeaderTitle");
     this.SecondarySelector     = (LoopingSelector)this.FindName("SecondarySelector");
     this.TertiarySelector      = (LoopingSelector)this.FindName("TertiarySelector");
     this.PrimarySelector       = (LoopingSelector)this.FindName("PrimarySelector");
 }
Exemple #6
0
        public LoopingSelector_Items()
        {
            this.InitializeComponent();

#if !NETFX_CORE
            var loopingSelector = new LoopingSelector
            {
                ItemHeight = 30, ShouldLoop = true, SelectedIndex = 5, Items = _items
            };

            loopingSelector.SelectionChanged += OnSelectionChanged;

            void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                selection.Text =
                    $"SelectedIdex={loopingSelector.SelectedIndex} SelectedItem={loopingSelector.SelectedItem}";
            }

            loopingSelectorContainer.Child = loopingSelector;

#if DEBUG
            async void Do()
            {
                await Task.Delay(100);

                var tree = this.ShowLocalVisualTree(0);

                global::System.Diagnostics.Debug.WriteLine(tree);
            }

            Do();
#endif
#else
            loopingSelectorContainer.Child = new TextBlock {
                Text = "Not supported on Windows."
            };
#endif
        }
        protected void InitializeDateTimePickerPage(LoopingSelector primarySelector, LoopingSelector secondarySelector, LoopingSelector tertiarySelector)
        {
            if (primarySelector == null)
            {
                throw new ArgumentNullException("primarySelector");
            }
            if (secondarySelector == null)
            {
                throw new ArgumentNullException("secondarySelector");
            }
            if (tertiarySelector == null)
            {
                throw new ArgumentNullException("tertiarySelector");
            }
            this._primarySelectorPart   = primarySelector;
            this._secondarySelectorPart = secondarySelector;
            this._tertiarySelectorPart  = tertiarySelector;
            this._primarySelectorPart.DataSource.SelectionChanged   += new EventHandler <SelectionChangedEventArgs>(this.OnDataSourceSelectionChanged);
            this._secondarySelectorPart.DataSource.SelectionChanged += new EventHandler <SelectionChangedEventArgs>(this.OnDataSourceSelectionChanged);
            this._tertiarySelectorPart.DataSource.SelectionChanged  += new EventHandler <SelectionChangedEventArgs>(this.OnDataSourceSelectionChanged);
            // ISSUE: method pointer
            this._primarySelectorPart.IsExpandedChanged += new DependencyPropertyChangedEventHandler(this.OnSelectorIsExpandedChanged);
            // ISSUE: method pointer
            this._secondarySelectorPart.IsExpandedChanged += new DependencyPropertyChangedEventHandler(this.OnSelectorIsExpandedChanged);
            // ISSUE: method pointer
            this._tertiarySelectorPart.IsExpandedChanged       += new DependencyPropertyChangedEventHandler(this.OnSelectorIsExpandedChanged);
            ((UIElement)this._primarySelectorPart).Visibility   = Visibility.Collapsed;
            ((UIElement)this._secondarySelectorPart).Visibility = Visibility.Collapsed;
            ((UIElement)this._tertiarySelectorPart).Visibility  = Visibility.Collapsed;
            int num1 = 0;

            foreach (LoopingSelector loopingSelector in this.GetSelectorsOrderedByCulturePattern())
            {
                int num2 = num1;
                Grid.SetColumn((FrameworkElement)loopingSelector, num2);
                int num3 = 0;
                ((UIElement)loopingSelector).Visibility = ((Visibility)num3);
                ++num1;
            }
            FrameworkElement child = VisualTreeHelper.GetChild((DependencyObject)this, 0) as FrameworkElement;

            if (child != null)
            {
                foreach (VisualStateGroup visualStateGroup in (IEnumerable)VisualStateManager.GetVisualStateGroups(child))
                {
                    if ("VisibilityStates" == visualStateGroup.Name)
                    {
                        foreach (VisualState state in (IEnumerable)visualStateGroup.States)
                        {
                            if ("Closed" == state.Name && state.Storyboard != null)
                            {
                                this._closedStoryboard = state.Storyboard;
                                ((Timeline)this._closedStoryboard).Completed += (new EventHandler(this.OnClosedStoryboardCompleted));
                            }
                        }
                    }
                }
            }
            if (this.ApplicationBar != null)
            {
                this.ApplicationBar.ForegroundColor = VKConstants.AppBarFGColor;
                this.ApplicationBar.BackgroundColor = ((Application.Current.Resources["PhoneChromeBrush"] as SolidColorBrush).Color);
                foreach (object button in (IEnumerable)this.ApplicationBar.Buttons)
                {
                    IApplicationBarIconButton iapplicationBarIconButton = button as IApplicationBarIconButton;
                    if (iapplicationBarIconButton != null)
                    {
                        if ("DONE" == ((IApplicationBarMenuItem)iapplicationBarIconButton).Text)
                        {
                            ((IApplicationBarMenuItem)iapplicationBarIconButton).Text   = CommonResources.AppBarConfirmChoice;
                            ((IApplicationBarMenuItem)iapplicationBarIconButton).Click += (new EventHandler(this.OnDoneButtonClick));
                        }
                        else if ("CANCEL" == ((IApplicationBarMenuItem)iapplicationBarIconButton).Text)
                        {
                            ((IApplicationBarMenuItem)iapplicationBarIconButton).Text   = CommonResources.AppBar_Cancel;
                            ((IApplicationBarMenuItem)iapplicationBarIconButton).Click += (new EventHandler(this.OnCancelButtonClick));
                        }
                    }
                }
            }
            VisualStateManager.GoToState((Control)this, "Open", true);
        }
        /// <summary>
        /// Initializes the ValuePickerPageBase 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 InitializeValuePickerPage(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   += HandleDataSourceSelectionChanged;
            _secondarySelectorPart.DataSource.SelectionChanged += HandleDataSourceSelectionChanged;
            _tertiarySelectorPart.DataSource.SelectionChanged  += HandleDataSourceSelectionChanged;
            _primarySelectorPart.IsExpandedChanged             += HandleSelectorIsExpandedChanged;
            _secondarySelectorPart.IsExpandedChanged           += HandleSelectorIsExpandedChanged;
            _tertiarySelectorPart.IsExpandedChanged            += 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)
            var 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 (var obj in ApplicationBar.Buttons)
                {
                    var button = obj as IApplicationBarIconButton;

                    if (null != button)
                    {
                        switch (button.Text)
                        {
                        case "DONE":
                            button.Text   = Toolkit.Properties.Resources.DoneText;
                            button.Click += OnDoneButtonClick;
                            break;

                        case "CANCEL":
                            button.Text   = Toolkit.Properties.Resources.CancelText;
                            button.Click += OnCancelButtonClick;
                            break;
                        }
                    }
                }
            }

            // Play the Open state
            VisualStateManager.GoToState(this, OpenVisibilityStateName, true);
        }
 private void ArriveBorder_Tap(object sender, TappedRoutedEventArgs e)
 {
     LoopingSelector.PerformOtherClick(sender);
     Type = PlanningTimeType.Arrival;
     setTypeBorders();
 }
Exemple #10
0
 internal LoopingSelectorAutomationPeer(LoopingSelector pOwner) : base(pOwner)
 {
     InitializeImpl(pOwner);
 }
 internal void GetParentNoRef(out LoopingSelector ppValue)
 {
     ppValue = _pParentNoRef;
     return;
 }
 internal void SetParent(LoopingSelector pValue)
 {
     _pParentNoRef = pValue;
     return;
 }
Exemple #13
0
        protected void InitializeDateTimePickerPage(LoopingSelector primarySelector, LoopingSelector secondarySelector, LoopingSelector tertiarySelector)
        {
            if (primarySelector == null)
            {
                throw new ArgumentNullException("primarySelector");
            }
            if (secondarySelector == null)
            {
                throw new ArgumentNullException("secondarySelector");
            }
            if (tertiarySelector == null)
            {
                throw new ArgumentNullException("tertiarySelector");
            }
            this._primarySelectorPart   = primarySelector;
            this._secondarySelectorPart = secondarySelector;
            this._tertiarySelectorPart  = tertiarySelector;
            this._primarySelectorPart.DataSource.SelectionChanged   += new EventHandler <SelectionChangedEventArgs>(this.OnDataSourceSelectionChanged);
            this._secondarySelectorPart.DataSource.SelectionChanged += new EventHandler <SelectionChangedEventArgs>(this.OnDataSourceSelectionChanged);
            this._tertiarySelectorPart.DataSource.SelectionChanged  += new EventHandler <SelectionChangedEventArgs>(this.OnDataSourceSelectionChanged);
            this._primarySelectorPart.IsExpandedChanged             += new DependencyPropertyChangedEventHandler(this.OnSelectorIsExpandedChanged);
            this._secondarySelectorPart.IsExpandedChanged           += new DependencyPropertyChangedEventHandler(this.OnSelectorIsExpandedChanged);
            this._tertiarySelectorPart.IsExpandedChanged            += new DependencyPropertyChangedEventHandler(this.OnSelectorIsExpandedChanged);
            this._primarySelectorPart.Visibility   = Visibility.Collapsed;
            this._secondarySelectorPart.Visibility = Visibility.Collapsed;
            this._tertiarySelectorPart.Visibility  = Visibility.Collapsed;
            int num = 0;

            foreach (LoopingSelector loopingSelector in this.GetSelectorsOrderedByCulturePattern())
            {
                Grid.SetColumn((FrameworkElement)loopingSelector, num);
                loopingSelector.Visibility = Visibility.Visible;
                ++num;
            }
            FrameworkElement child = VisualTreeHelper.GetChild((DependencyObject)this, 0) as FrameworkElement;

            if (child != null)
            {
                foreach (VisualStateGroup visualStateGroup in (IEnumerable)VisualStateManager.GetVisualStateGroups(child))
                {
                    if ("VisibilityStates" == visualStateGroup.Name)
                    {
                        foreach (VisualState state in (IEnumerable)visualStateGroup.States)
                        {
                            if ("Closed" == state.Name && state.Storyboard != null)
                            {
                                this._closedStoryboard            = state.Storyboard;
                                this._closedStoryboard.Completed += new EventHandler(this.OnClosedStoryboardCompleted);
                            }
                        }
                    }
                }
            }
            if (this.ApplicationBar != null)
            {
                foreach (object button in (IEnumerable)this.ApplicationBar.Buttons)
                {
                    IApplicationBarIconButton applicationBarIconButton = button as IApplicationBarIconButton;
                    if (applicationBarIconButton != null)
                    {
                        if ("DONE" == applicationBarIconButton.Text)
                        {
                            applicationBarIconButton.Text   = ControlResources.DateTimePickerDoneText;
                            applicationBarIconButton.Click += new EventHandler(this.OnDoneButtonClick);
                        }
                        else if ("CANCEL" == applicationBarIconButton.Text)
                        {
                            applicationBarIconButton.Text   = ControlResources.DateTimePickerCancelText;
                            applicationBarIconButton.Click += new EventHandler(this.OnCancelButtonClick);
                        }
                    }
                }
            }
            VisualStateManager.GoToState((Control)this, "Open", true);
        }
 public LoopingSelectorEvents(LoopingSelector This)
     : base(This)
 {
     this.This = This;
 }