public static void Register(string Name, core.DLL.Initializer obj) { MainWindow winMain = (MainWindow)core.globals.Get("UI:Window"); obj.RegisterComponents(); var v = new UI.SidebarItem(obj.GetUI()); v.isSelected = false; v.Name = Name; v.Icon = obj.GetIcon(); winMain.Sidebar.Add(v); winMain.Body.Add(v); core.globals.Add(String.Format("UI:Sidebar:{0}", Name), winMain.Sidebar.Get(Name)); core.globals.Add(String.Format("UI:Body:{0}", Name), winMain.Body.Get(Name)); }
public void Add(SidebarItem value) { if (value.Name == null) { throw new ArgumentNullException("Name value expected"); } foreach (SidebarItem i in registrar) { if (i.Name == value.Name) { break; } } registrar.Add(value); value.uiElement.Visibility = Visibility.Hidden; content.Children.Add(value.uiElement); }
public void Add(SidebarItem value) { if (value.Name == null) { throw new ArgumentNullException("Name value expected"); } foreach (SidebarItem i in registrar) { if (i.Name == value.Name) { break; } } if (value.Icon == null) { value.Icon = (BitmapImage)Resources["I_Item_Default"]; } registrar.Add(value); }
private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { SidebarItem v = ((Grid)sender).DataContext as SidebarItem; foreach (SidebarItem i in registrar) { if (i.uiElement != null) { i.uiElement.Visibility = Visibility.Hidden; i.isSelected = false; } } if (v.uiElement != null) { v.uiElement.Visibility = Visibility.Visible; } v.isSelected = true; DataContext = null; DataContext = this; }