public void LoadViews() { searchOrderView = new SearchInfo(DataBase, this); ViewDictionary.Add("SearchOrder", searchOrderView); searchOrderView.Dock = DockStyle.Fill; panel1.Controls.Add(searchOrderView); searchOrderView.Hide(); searchComponentView = new SearchComponent(DataBase, this); ViewDictionary.Add("SearchComponent", searchComponentView); searchComponentView.Dock = DockStyle.Fill; panel1.Controls.Add(searchComponentView); searchComponentView.Hide(); createComponentView = new CreateComponent(DataBase, this); ViewDictionary.Add("CreateComponent", createComponentView); createComponentView.Dock = DockStyle.Fill; panel1.Controls.Add(createComponentView); createComponentView.Hide(); OrderSuppliersView = new OrderSuppliers(DataBase, this); ViewDictionary.Add("OrderSuppliersView", OrderSuppliersView); OrderSuppliersView.Dock = DockStyle.Fill; panel1.Controls.Add(OrderSuppliersView); OrderSuppliersView.Hide(); }
public void AddDockAbleContent(FrmState thisState, object thisControl, string name) { string name2 = null; var count = ViewDictionary.Count(d => d.Name == name); if (count != 0) { name2 = name + count; } else { name2 = name; } var viewitem = new ViewItem(thisControl, name, thisState); LayoutAnchorable layout = null; ViewDictionary.Add(viewitem); try { switch (thisState) { case FrmState.Large: layout = Factory(name, thisControl); documentMain.Children.Add(layout); layout.IsActive = true; break; case FrmState.Buttom: layout = Factory(name, thisControl); var view = thisControl as DebugManagerUI; if (view != null) { RichTextBoxAppender.SetRichTextBox(view.richtextBox, DebugText, notifier); } documentButtom.Children.Add(layout); documentButtom.Children.RemoveElementsNoReturn(d => d.Content == null); layout.IsActive = true; layout.CanClose = false; break; case FrmState.Middle: layout = Factory(name, thisControl); viewitem.Container = layout; dockablePane1.Children.Add(layout); dockablePane1.Children.RemoveElementsNoReturn(d => d.Content == null); layout.IsActive = true; layout.CanClose = false; break; case FrmState.Mini: layout = Factory(name, thisControl); viewitem.Container = layout; dockablePane2.Children.Add(layout); dockablePane2.Children.RemoveElementsNoReturn(d => d.Content == null); layout.IsActive = true; break; case FrmState.Mini2: layout = Factory(name, thisControl); viewitem.Container = layout; dockablePane3.Children.Add(layout); dockablePane3.Children.RemoveElementsNoReturn(d => d.Content == null); layout.IsActive = true; layout.CanClose = false; break; case FrmState.Custom: var window = new Window { Title = name }; window.Content = thisControl; window.ShowDialog(); break; case FrmState.Float: layout = Factory(name, thisControl); dockablePane1.Children.Add(layout); layout.Float(); break; } var canNotClose = new[] { GlobalHelper.Get("ModuleMgmt"), GlobalHelper.Get("SysState"), GlobalHelper.Get("DebugView") }; if (canNotClose.Contains(name)) { if (layout != null) { layout.CanClose = false; } } viewitem.Container = layout; } catch (Exception ex) { XLogSys.Print.ErrorFormat("{0}{1},{2}", GlobalHelper.Get("ControlLoad"), GlobalHelper.Get("Error"), ex.Message); } }