private void Initialize()
        {

            InitializeComponent();

            recordButton = ApplicationBar.Buttons[0] as ApplicationBarIconButton;
            playButton = ApplicationBar.Buttons[1] as ApplicationBarIconButton;
            saveButton = ApplicationBar.Buttons[2] as ApplicationBarIconButton;
            

   
            stream = new MemoryStream();
            microphone = Microphone.Default;
            soundIsPlaying = false;

            DispatcherTimer dt = new DispatcherTimer();
            dt.Interval = TimeSpan.FromMilliseconds(33);
            dt.Tick += new EventHandler(dt_Tick);
            dt.Start();


            microphone.BufferReady +=
                new EventHandler<EventArgs>(microphone_BufferReady);

           blankImage = new BitmapImage(new Uri("Images/blank.png", UriKind.RelativeOrAbsolute));
           microphoneImage = new BitmapImage(new Uri("Images/microphone.png", UriKind.RelativeOrAbsolute));
           speakerImage = new BitmapImage(new Uri("Images/speaker.png", UriKind.RelativeOrAbsolute));
        }
        public CommandButtonAdapter(
            IApplicationBar appbar,
            IApplicationBarIconButton button,
            Mode hideMode = Mode.DisableButton,
            ICommand command = null)
        {
            if (appbar == null && hideMode != Mode.DisableButton)
                throw new ArgumentException("Without an appbar reference I can only disable buttons not hide them");
            if (button == null)
                throw new ArgumentNullException("button");

            _AppBar = appbar;
            HideMode = hideMode;
            Button = button;
            Command = command;

            if (_AppBar != null &&
               HideMode == Mode.DisableButton)
            {
                if (!_AppBar.Buttons.Contains(Button))
                {
                    _AppBar.Buttons.Add(Button);
                }
            }
        }
        private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            switch (((Pivot)sender).SelectedIndex)
            {
            case 0:

                ApplicationBar = ((ApplicationBar)this.Resources["PersonView_Details_AppBar"]);

                IApplicationBarIconButton editDetailsButton = (IApplicationBarIconButton)ApplicationBar.Buttons[0];
                editDetailsButton.Text = string.Format("Edit {0}", AppContext.Instance.DatingGender.ToSingular());

                IApplicationBarMenuItem deletePersonMenuItem = (IApplicationBarMenuItem)ApplicationBar.MenuItems[0];
                deletePersonMenuItem.Text = string.Format("Delete {0}", AppContext.Instance.DatingGender.ToSingular());

                break;

            case 1:
                ApplicationBar = ((ApplicationBar)this.Resources["PersonView_Dates_AppBar"]);

                break;

            case 2:
                ApplicationBar = ((ApplicationBar)this.Resources["PersonView_Interests_AppBar"]);
                break;
            }
        }
Beispiel #4
0
        public MainPage()
        {
            InitializeComponent();

            previousAppBarButton = (IApplicationBarIconButton)ApplicationBar.Buttons[0];
            refreshAppBarButton  = (IApplicationBarIconButton)ApplicationBar.Buttons[1];
            nextAppBarButton     = (IApplicationBarIconButton)ApplicationBar.Buttons[2];

            // URL stacks start out empty since we're on the 1st page
            nextPrevUrlStacks = new Stack <string> [3];
            for (int i = 0; i < 3; i++)
            {
                nextPrevUrlStacks[i] = new Stack <string>();
                nextPrevUrlStacks[i].Push(string.Empty);
            }

            lastRefreshed = new DateTime[3] {
                DateTime.MinValue,
                DateTime.MinValue,
                DateTime.MinValue
            };

            client = new WebClient();
            client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
        }
        private void buildApplicationBar()
        {
            ApplicationBar.IsVisible = false;
            if (pivot.SelectedIndex == 1 && SelectedDayDTO != null && viewModel.Day.AllowComments)
            {
                ApplicationBar.Buttons.Clear();
                ApplicationBar.MenuItems.Clear();

                ApplicationBarIconButton button1 = new ApplicationBarIconButton(new Uri("/icons/appbar.download.rest.png", UriKind.Relative));
                button1.Click += new EventHandler(btnMore_Click);
                button1.Text   = ApplicationStrings.AppBarButton_More;
                ApplicationBar.Buttons.Add(button1);

                btnSend           = new ApplicationBarIconButton(new Uri("/icons/mainSent.png", UriKind.Relative));
                btnSend.Click    += new EventHandler(btnAdd_Click);
                btnSend.Text      = ApplicationStrings.AppBarButton_NewComment;
                btnSend.IsEnabled = false;
                if (!viewModel.IsNew)
                {
                    ApplicationBar.Buttons.Add(btnSend);
                }
                txtComment.Visibility    = viewModel.IsNew ? Visibility.Collapsed : Visibility.Visible;
                ApplicationBar.IsVisible = true;
            }
            updateApplicationBarButtons();
        }
Beispiel #6
0
 private void ButtonAdd(IApplicationBarIconButton button)
 {
     if (!ApplicationBar.Buttons.Contains(button))
     {
         ApplicationBar.Buttons.Add(button);
     }
 }
        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);
        }
Beispiel #8
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            //acc.CurrentValueChanged +=new EventHandler<SensorReadingEventArgs<AccelerometerReading>>(acc_CurrentValueChanged);
            //if (!Accelerometer.IsSupported) { AccTxt.Text = "不支持~"; }
            this.switchHandBtn = this.ApplicationBar.Buttons[1] as IApplicationBarIconButton;

            this.acc = new Accelerometer();
            this.acc.CurrentValueChanged +=new EventHandler<SensorReadingEventArgs<AccelerometerReading>>(acc_CurrentValueChanged);
            SoundEffects.Initialize();
            
        }
Beispiel #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditListsView"/> class.
        /// </summary>
        public EditListsView()
        {
            DataContext = ViewModelLocatorService.GetViewModel(GetType());

            this.Resources.Add("ViewModel", DataContext);

            InitializeComponent();

            // HACK: Again, big hack because the buttons cannot be accessed by their name. In an ideal This world, this should be done with triggers(WPF) or behaviors(Silverlight)
            _deleteButton = ApplicationBar.Buttons.Cast<IApplicationBarIconButton>().First(button => button.Text.Equals("delete", StringComparison.OrdinalIgnoreCase));
            _applyButton = ApplicationBar.Buttons.Cast<IApplicationBarIconButton>().First(button => button.Text.Equals("apply", StringComparison.OrdinalIgnoreCase));
            _addButton = ApplicationBar.Buttons.Cast<IApplicationBarIconButton>().First(button => button.Text.Equals("add", StringComparison.OrdinalIgnoreCase));

            // remove the edition buttons since we are in insertion mode by default
            InsertDefaultButtons();
        }
Beispiel #10
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            OrientationChanged += OnOrientationChanged;
            _lastOrientation    = Orientation;

            // 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;
                        }
                    }
                }
            }

            // Add a projection for each list item and turn it to -90
            // (rotationX) so it is hidden.
            SetupListItems(-90);

            PlaneProjection headerProjection = (PlaneProjection)HeaderTitle.Projection;

            if (null == headerProjection)
            {
                headerProjection       = new PlaneProjection();
                HeaderTitle.Projection = headerProjection;
            }
            headerProjection.RotationX = -90;

            Picker.Opacity = 1;

            Dispatcher.BeginInvoke(() =>
            {
                IsOpen = true;
            });
        }
Beispiel #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditListsView"/> class.
        /// </summary>
        public EditListsView()
        {
            DataContext = ViewModelLocatorService.GetViewModel(GetType());


            this.Resources.Add("ViewModel", DataContext);

            InitializeComponent();

            // HACK: Again, big hack because the buttons cannot be accessed by their name. In an ideal This world, this should be done with triggers(WPF) or behaviors(Silverlight)
            _deleteButton = ApplicationBar.Buttons.Cast <IApplicationBarIconButton>().First(button => button.Text.Equals("delete", StringComparison.OrdinalIgnoreCase));
            _applyButton  = ApplicationBar.Buttons.Cast <IApplicationBarIconButton>().First(button => button.Text.Equals("apply", StringComparison.OrdinalIgnoreCase));
            _addButton    = ApplicationBar.Buttons.Cast <IApplicationBarIconButton>().First(button => button.Text.Equals("add", StringComparison.OrdinalIgnoreCase));

            // remove the edition buttons since we are in insertion mode by default
            InsertDefaultButtons();
        }
Beispiel #12
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            _playStopButton = ApplicationBar.Buttons[0] as IApplicationBarIconButton;

            Messenger.Default.Register<Session>(this, "CurrentSession", UpdateUI);
            Messenger.Default.Register<double>(this, "ActualSeconds", UpdateProgressBar);

            ProgressBar.Maximum = Settings.WorkMinutes.Value.TotalSeconds;
            ProgressBar.Value = Settings.WorkMinutes.Value.TotalSeconds;

            // We have to localize the AppBar manually
            (ApplicationBar.Buttons[0] as IApplicationBarIconButton).Text = Strings.Play; // The Play / Stop button
            (ApplicationBar.Buttons[1] as IApplicationBarIconButton).Text = Strings.Settings; // The Settings button
            (ApplicationBar.MenuItems[0] as IApplicationBarMenuItem).Text = Strings.Instructions; // Instructions menu item
            (ApplicationBar.MenuItems[1] as IApplicationBarMenuItem).Text = Strings.About; // About menu item
        }
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            OrientationChanged += OnOrientationChanged;
            lastOrientation     = Orientation;

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

            SetupListItems(-90);

            PlaneProjection headerProjection = (PlaneProjection)HeaderTitle.Projection;

            if (null == headerProjection)
            {
                headerProjection       = new PlaneProjection();
                HeaderTitle.Projection = headerProjection;
            }
            headerProjection.RotationX = -90;

            Picker.Opacity = 1;
            Picker.Tap    += this.OnPickerTapped;

            Dispatcher.BeginInvoke(() =>
            {
                IsOpen = true;
            });
        }
Beispiel #14
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            this.sosBtn = this.ApplicationBar.Buttons[0] as IApplicationBarIconButton;
            this.strobeBtn = this.ApplicationBar.Buttons[1] as IApplicationBarIconButton;

            this.strobeTimer.Interval = TimeSpan.FromSeconds(.1);
            this.strobeTimer.Tick += StrobeTimer_Tick;

            this.sosTimer.Interval = TimeSpan.Zero;
            this.sosTimer.Tick += SosTimer_Tick;

            foreach(IApplicationBarMenuItem menuItem in this.ApplicationBar.MenuItems){
                menuItem.Click += MenuItem_Click;
            }

            this.onBrush = new SolidColorBrush(this.savedColor.Value);
            this.BackgroundGrid.Background = onBrush;
        }
Beispiel #15
0
        private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            switch (((Pivot)sender).SelectedIndex)
            {
            case 0:
                ApplicationBar = ((ApplicationBar)this.Resources["HomeView_Upcoming_AppBar"]);
                break;

            case 1:
                ApplicationBar = ((ApplicationBar)this.Resources["HomeView_Person_AppBar"]);
                IApplicationBarIconButton addPersonButton = (IApplicationBarIconButton)ApplicationBar.Buttons[0];
                addPersonButton.Text = string.Format("Add {0}", AppContext.Instance.DatingGender);
                break;

            case 2:
                ApplicationBar = null;
                break;
            }
        }
Beispiel #16
0
 private void InitializeApplicationBar()
 {
     // 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   = Microsoft.Phone.Controls.LocalizedResources.ControlResources.DateTimePickerDoneText;
                     button.Click += OnDoneButtonClick;
                 }
                 else if ("CANCEL" == button.Text)
                 {
                     button.Text   = Microsoft.Phone.Controls.LocalizedResources.ControlResources.DateTimePickerCancelText;
                     button.Click += OnCancelButtonClick;
                 }
             }
         }
     }
 }
Beispiel #17
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);
        }
        /// <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);
        }
 public ApplicationBarIconButtonCommandBinding(PhoneApplicationPage page, IApplicationBarIconButton core)
     : base(page)
 {
     Core = core;
 }
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            OrientationChanged += OnOrientationChanged;
            _lastOrientation    = Orientation;

            // 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;
                        }
                    }
                }
            }

            // Scroll the selected item into view, needs to be done before the
            // animations are setup because the animations are only attached to
            // the items in view.
            if (SelectionMode == SelectionMode.Single)
            {
                Picker.ScrollIntoView(SelectedItem);
            }
            else
            {
                if (SelectedItems.Count > 0)
                {
                    Picker.ScrollIntoView(SelectedItems[0]);
                }
            }

            // Add a projection for each list item and turn it to -90
            // (rotationX) so it is hidden.
            SetupListItems(-90);

            PlaneProjection headerProjection = (PlaneProjection)HeaderTitle.Projection;

            if (null == headerProjection)
            {
                headerProjection       = new PlaneProjection();
                HeaderTitle.Projection = headerProjection;
            }
            headerProjection.RotationX = -90;

            Picker.Opacity = 1;

            Dispatcher.BeginInvoke(() =>
            {
                IsOpen = true;
            });
        }
        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);
        }
 public CommandButtonAdapter(IApplicationBarIconButton button, ICommand command = null)
     : this(appbar: null, hideMode: Mode.DisableButton, button: button, command: command) {
 }
Beispiel #23
0
 public MainPage()
 {
     InitializeComponent();
     orientationLockBtn = ApplicationBar.Buttons[0] as IApplicationBarIconButton;
     this.timer.Tick += Timer_Tick;
 }