예제 #1
0
        /// <summary>
        /// In loaded event hanlder, we will switch work space body
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            int           buttonIndex = int.Parse(this.SelectedButtonIndex);
            ToolbarButton b           = (ToolbarButton)this.ToolBar.ButtonGroup[buttonIndex];

            if (b != null)
            {
                ToolbarButton_MouseLeftButtonDown(b, null);
            }
        }
예제 #2
0
        private void LogoutButton_Click(object sender, MouseButtonEventArgs e)
        {
            if (activeButton != null)
            {
                activeButton.Unselect();
            }
            ToolbarButton logoutBtn = sender as ToolbarButton;

            logoutBtn.Unselect();

            // Try log out
            // TODO: logout
            ModelProvider.Instance.LogoutAsync(Logout_Handle);
        }
예제 #3
0
        /// <summary>
        /// Note down current active button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns>true if, switch to new page, false otherwise</returns>
        private bool HandleActiveButton(object sender, MouseButtonEventArgs e)
        {
            // Reclick the same active button, do nothing
            if (sender as ToolbarButton == activeButton)
            {
                return(false);
            }

            // Gray out previous active button
            if (activeButton != null)
            {
                activeButton.Unselect();
            }

            // Set new active button
            activeButton = sender as ToolbarButton;
            activeButton.SelectButton();

            // Return
            return(true);
        }
        public static void OnTextValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ToolbarButton btn = d as ToolbarButton;

            btn.ButtonTextBlock.Text = btn.Text;
        }