Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports Windows.UI.ApplicationSettings
- Imports Windows.UI.Core
- ' The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
- ''' <summary>
- ''' An empty page that can be used on its own or navigated to within a Frame.
- ''' </summary>
- Public NotInheritable Class MainPage
- Inherits Page
- ''' <summary>
- ''' Invoked when this page is about to be displayed in a Frame.
- ''' </summary>
- ''' <param name="e">Event data that describes how this page was reached. The Parameter
- ''' property is typically used to configure the page.</param>
- Protected Overrides Sub OnNavigatedTo(e As Navigation.NavigationEventArgs)
- End Sub
- Public Sub New()
- ' This call is required by the designer.
- InitializeComponent()
- ' Add any initialization after the InitializeComponent() call.
- inicializarPopup()
- End Sub
- #Region " Todo lo relacionado con el panel de configuración Settings Charm "
- ' Para el panel de configuración
- Dim _windowBounds As Rect
- Dim _settingsWidth As Double = 346 '346 el 646 es demasiado ancho y el 343 es el tamaño normal
- Dim _settingsPopup As Popup
- ''' <summary>
- ''' Asignaciones para usar el panel de configuración
- ''' Estas declaraciones estaba en el constructor
- ''' </summary>
- Private Sub inicializarPopup()
- _windowBounds = Window.Current.Bounds
- AddHandler Window.Current.SizeChanged, AddressOf OnWindowSizeChanged
- AddHandler SettingsPane.GetForCurrentView().CommandsRequested, AddressOf startPage_CommandsRequested
- End Sub
- Private Sub OnWindowSizeChanged(sender As Object, e As WindowSizeChangedEventArgs)
- _windowBounds = Window.Current.Bounds
- End Sub
- Private Sub startPage_CommandsRequested(sender As SettingsPane, args As SettingsPaneCommandsRequestedEventArgs)
- Dim sOpciones As String = "Preferencias"
- ' Comprobar que no estén ya añadidos los comandos
- Dim yaEsta As Boolean = False
- For Each c In args.Request.ApplicationCommands
- If c.Label = sOpciones Then
- yaEsta = True
- Exit For
- End If
- Next
- If yaEsta Then
- args.Request.ApplicationCommands.Clear()
- End If
- Dim cmd As New SettingsCommand(
- "lasPreferencias", sOpciones,
- Sub()
- _settingsPopup = New Popup()
- AddHandler _settingsPopup.Closed, AddressOf OnPopupOpcionesClosed
- AddHandler Window.Current.Activated, AddressOf OnWindowActivated
- _settingsPopup.IsLightDismissEnabled = True
- _settingsPopup.Width = _settingsWidth
- _settingsPopup.Height = _windowBounds.Height
- Dim mypane As New Settings
- mypane.Titulo = sOpciones
- mypane.Width = _settingsWidth
- mypane.Height = _windowBounds.Height
- _settingsPopup.Child = mypane
- _settingsPopup.SetValue(Canvas.LeftProperty, _windowBounds.Width - _settingsWidth)
- _settingsPopup.SetValue(Canvas.TopProperty, 0)
- _settingsPopup.IsOpen = True
- End Sub)
- args.Request.ApplicationCommands.Add(cmd)
- 'Dim cmdAyuda As New SettingsCommand("clockAyuda", sAyuda,
- ' Sub()
- ' ' Sólo queremos mostrar otra página (18/Dic/12)
- ' ' (pero no dentro del panel de configuración)
- ' mostrarAyuda()
- ' End Sub)
- 'args.Request.ApplicationCommands.Add(cmdAyuda)
- End Sub
- Private Sub OnWindowActivated(sender As Object, e As WindowActivatedEventArgs)
- If e.WindowActivationState = CoreWindowActivationState.Deactivated Then
- _settingsPopup.IsOpen = False
- End If
- End Sub
- Private Sub OnPopupOpcionesClosed(sender As Object, e As Object)
- Dim settingsPanel As Settings
- settingsPanel = TryCast(TryCast(sender, Popup).Child, Settings)
- RemoveHandler Window.Current.Activated, AddressOf OnWindowActivated
- End Sub
- Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
- SettingsPane.Show()
- End Sub
- Private Sub HandleSizeChange(sender As Object, e As RoutedEventArgs)
- Dim rb As RadioButton = TryCast(sender, RadioButton)
- _settingsWidth = Convert.ToInt32(rb.Content)
- End Sub
- #End Region
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement