/// <summary> /// Load the buttons and other ui elements on the menu /// </summary> /// <param name="info"></param> private void LoadUI(MenuBarInfo info) { //Initialize the Deletebutton deleteButton = new Button(); deleteButton.Content = "Delete"; deleteButton.Click += DeleteButton_Click; deleteButton.PointerEntered += PointerDown; deleteButton.PointerPressed += PointerDown; deleteButton.PointerMoved += PointerMove; deleteButton.PointerExited += PointerUp; deleteButton.PointerReleased += PointerUp; UIHelper.InitializeUI(info.DeleteButtonInfo.Position, 0, 1, info.DeleteButtonInfo.Size, deleteButton); //Initialize the notificationBlock + Grid grid = new Grid(); notificationBlock = new TextBlock(); grid.Background = new SolidColorBrush(Colors.White); notificationBlock.Text = "The Sorting Box will be deleted when it's dragged into this."; notificationBlock.TextWrapping = TextWrapping.Wrap; Point position = new Point(250, -60); UIHelper.InitializeUI(position, 0, 1, info.DeleteButtonInfo.Size, grid); grid.Children.Add(notificationBlock); grid.Visibility = Visibility.Collapsed; }
/// <summary> /// Initialize the menubar /// </summary> /// <param name="user"></param> internal void Init(User user) { MenuBarInfo info = MenuBarInfo.GetMenuBarInfo(user); this.owner = user; UIHelper.InitializeUI(info.Position, info.Rotate, info.Scale, info.Size, this); LoadUI(info); }
/// <summary> /// Initialize Danny's menu bar /// </summary> /// <returns></returns> private static MenuBarInfo InitDanny() { MenuBarInfo info = new MenuBarInfo(); info.position = new Point((Screen.WIDTH + info.Size.Width) / 2, info.Size.Height); info.scale = 1; info.rotate = 180; return(info); }
/// <summary> /// Initialize Chris's menu bar /// </summary> /// <returns></returns> private static MenuBarInfo InitChris() { MenuBarInfo info = new MenuBarInfo(); info.position = new Point(Screen.WIDTH - info.size.Height, (Screen.HEIGHT + info.Size.Width) / 2); info.scale = 1; info.rotate = 270; return(info); }
/// <summary> /// Initialize Ben's menu bar /// </summary> /// <returns></returns> private static MenuBarInfo InitBen() { MenuBarInfo info = new MenuBarInfo(); info.position = new Point((Screen.WIDTH - info.size.Width) / 2, Screen.HEIGHT - info.size.Height); info.scale = 1; info.rotate = 0; return(info); }
/// <summary> /// Initialize Alex's menu bar /// </summary> /// <returns></returns> private static MenuBarInfo InitAlex() { MenuBarInfo info = new MenuBarInfo(); info.position = new Point(info.Size.Height, (Screen.HEIGHT - info.Size.Width) / 2); info.scale = 1; info.rotate = 90; return(info); }
/// <summary> /// Load the buttons and other ui elements on the menu /// </summary> /// <param name="info"></param> private void LoadUI(MenuBarInfo info) { //Initialize the button to show the keyboard createSortingBoxButton = new Button(); createSortingBoxButton.Content = "Create a Box"; createSortingBoxButton.Click += KeyboardButton_Click; createSortingBoxButton.PointerEntered += PointerDown; createSortingBoxButton.PointerPressed += PointerDown; createSortingBoxButton.PointerMoved += PointerMove; createSortingBoxButton.PointerExited += PointerUp; createSortingBoxButton.PointerReleased += PointerUp; createSortingBoxButton.IsTextScaleFactorEnabled = false; UIHelper.InitializeUI(info.KeyboardButtonInfo.Position, 0, 1, info.KeyboardButtonInfo.Size, createSortingBoxButton); //Initialize the text block textbox = new TextBox(); textbox.AcceptsReturn = true; UIHelper.InitializeUI(info.InputTextBoxInfo.Position, 0, 1, info.InputTextBoxInfo.Size, textbox); textbox.Visibility = Visibility.Collapsed; textbox.TextChanged += Textbox_TextChanged; textbox.IsEnabled = false; //Initialize the keyboard to create the sorting box virtualKeyboard = new OnScreenKeyBoard(); virtualKeyboard.InitialLayout = KeyboardLayouts.English; virtualKeyboard.Visibility = Visibility.Collapsed; virtualKeyboard.PointerEntered += PointerDown; virtualKeyboard.PointerPressed += PointerDown; virtualKeyboard.PointerMoved += PointerMove; virtualKeyboard.PointerExited += PointerUp; virtualKeyboard.PointerReleased += PointerUp; UIHelper.InitializeUI(info.KeyboardInfo.Position, 0, 1, info.KeyboardInfo.Size, virtualKeyboard); //Initialize the Deletebutton deleteButton = new Button(); deleteButton.Content = "Delete"; deleteButton.Click += DeleteButton_Click; deleteButton.PointerEntered += PointerDown; deleteButton.PointerPressed += PointerDown; deleteButton.PointerMoved += PointerMove; deleteButton.PointerExited += PointerUp; deleteButton.PointerReleased += PointerUp; deleteButton.IsTextScaleFactorEnabled = false; UIHelper.InitializeUI(info.DeleteButtonInfo.Position, 0, 1, info.DeleteButtonInfo.Size, deleteButton); //Initialize the notificationBlock + Grid grid = new Grid(); notificationBlock = new TextBlock(); grid.Background = new SolidColorBrush(Colors.White); notificationBlock.Text = "The Sorting Box will be deleted when it's dragged into this."; notificationBlock.TextWrapping = TextWrapping.Wrap; Point position = new Point(250, -60); UIHelper.InitializeUI(position, 0, 1, info.DeleteButtonInfo.Size, grid); grid.Children.Add(notificationBlock); grid.Visibility = Visibility.Collapsed; //Initialize the menubar ImageBrush brush = new ImageBrush(); brush.ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/menu_bg.png")); this.Background = brush; this.Children.Add(createSortingBoxButton); this.Children.Add(virtualKeyboard); this.Children.Add(textbox); this.Children.Add(deleteButton); this.Children.Add(grid); }