Exemple #1
0
        /// <summary>
        /// Lazy loading of pivot tabs for perf.
        /// only load a tab when a user access it
        /// Naturally all pivots are loaded when the control is created (we dont want this)
        /// </summary>
        private void UpdateTabInfoOnPivotLoading(Pivot sender, PivotItemEventArgs args)
        {
            int currentTabIndex = PhoneTabs.SelectedIndex;

            //Set device oritentation based on tab
            switch (currentTabIndex)
            {
            //For the contact and dialer tabs, we should disable landscape
            case 1:
            case 2:
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
                break;

            //Other tabs can be both portrait and landscape
            default:
                DisplayInformation.AutoRotationPreferences =
                    DisplayOrientations.Portrait | DisplayOrientations.Landscape |
                    DisplayOrientations.PortraitFlipped | DisplayOrientations.LandscapeFlipped;
                break;
            }

            //Update content as its already loaded
            if (args.Item.Content != null)
            {
                //Content loaded already, perform an update instead and exit
                UpdateTabInfo(currentTabIndex);
                return;
            }

            //Lazy load the tabs. Only load when accessed
            UserControl CurrentPanel;

            switch (currentTabIndex)
            {
            case 0:
                statusVM            = ViewModelDispatcher.StatusViewModel;
                CurrentPanel        = new StatusPanel();
                CurrentPanel.Height = Double.NaN;     //Auto height
                args.Item.Content   = CurrentPanel;
                break;

            case 1:
                CurrentPanel        = new ContactsPanel();
                CurrentPanel.Height = Double.NaN;     //Auto height
                args.Item.Content   = CurrentPanel;
                break;

            case 2:
                CurrentPanel        = new DialerPanel();
                CurrentPanel.Height = Double.NaN;     //Auto height
                args.Item.Content   = CurrentPanel;
                break;

            case 3:
                voicemailVM         = ViewModelDispatcher.VoicemailViewModel;
                CurrentPanel        = new VoicemailPanel();
                CurrentPanel.Height = Double.NaN;     //Auto height
                args.Item.Content   = CurrentPanel;
                break;

            default:
                break;
            }
        }
Exemple #2
0
 /// <summary>
 /// A user control that hosts the voicemail panel in the main pivot/tab.
 /// </summary>
 public VoicemailPanel()
 {
     this.InitializeComponent();
     voicemailVM = ViewModelDispatcher.VoicemailViewModel;
 }