public void CreateMainPageMenu(HotelMenuPower hotelMenu, int index) { PageMain page = this.UIElement as PageMain; MainPageMenuButton button = new MainPageMenuButton(); button.Text = hotelMenu.Name; var color_argb = ColorHelp.GetARGByStr(hotelMenu.color); button.BackGround = new SolidColorBrush(Color.FromArgb(color_argb[0], color_argb[1], color_argb[2], color_argb[3])); button.Src = hotelMenu.img; switch (hotelMenu.id) { case 1: button.Click((s, e) => { VM_PageTest vM_PageTest = new VM_PageTest(); VM_FatherWindow.CreateMenu(hotelMenu.Name, (vM_PageTest.UIElement as Page), true); }); break; case 2: button.Click((s, e) => { VM_PageTest2 vM_PageTest2 = new VM_PageTest2(); VM_FatherWindow.CreateMenu(hotelMenu.Name, (vM_PageTest2.UIElement as Page), true); }); break; case 3: button.Click((s, e) => { VM_PageTest vM_PageTest1 = new VM_PageTest(); VM_FatherWindow.CreateMenu(hotelMenu.Name, (vM_PageTest1.UIElement as Page), true); }); break; default: break; } if (index >= 4) { page.MainPage_MenuPanel2.Children.Add(button); } else { page.MainPage_MenuPanel.Children.Add(button); } }
public void FocusButton(string title) { foreach (string key in menuButtons.Keys) { if (key == title) { var bs = ColorHelp.GetARGByStr(MyColors.MainWindow_Blue); menuButtons[key].Background = new SolidColorBrush(Color.FromArgb(bs[0], bs[1], bs[2], bs[3])); } else { var bs = ColorHelp.GetARGByStr(MyColors.MainWindow_Gray); menuButtons[key].Background = new SolidColorBrush(Color.FromArgb(bs[0], bs[1], bs[2], bs[3])); } } }