/// <summary> /// get single view by name /// </summary> /// <param name="view_name"></param> /// <returns></returns> public CView getFirstView_byGuid(String view_guid) { if (views_byGuid.Contains(view_guid)) { CView vtemp = views_byGuid[view_guid].First(); return((vtemp.Activa) ? vtemp : null); } else { return(null); } }
/// <summary> /// Remove view by name /// </summary> /// <param name="view_name"></param> public void removeViews_byGuid(String view_guid) { debug.add("Remove view: " + view_guid); IEnumerable <CView> views = views_byGuid[view_guid]; if (views.Count() > 0) { CView view = views.First(); view.Free(); listViews.Remove(view); views_byName = (Lookup <String, CView>)listViews.ToLookup(p => p.Name, p => p); views_byGuid = (Lookup <String, CView>)listViews.ToLookup(p => p.guid, p => p); } }
/// <summary> /// Add view /// </summary> /// <param name="main_control"></param> /// <returns></returns> public CView AddView(String main_control) { debug.add("Add view: " + main_control); // Init view CView view = new CView(cs, main_control); if (!errors.hasErrors()) { view.on_any_event += Ctrl_on_any_event; listViews.Add(view); views_byName = (Lookup <String, CView>)listViews.ToLookup(p => p.Name, p => p); views_byGuid = (Lookup <String, CView>)listViews.ToLookup(p => p.guid, p => p); return(view); } else { return(null); } }
/// <summary> /// get single view by name /// </summary> /// <param name="view_name"></param> /// <returns></returns> public CView getFirstView(String view_name) { if ((views_byName != null) && (views_byName.Contains(view_name))) { CView vtemp = views_byName[view_name].First(); if (vtemp.Activa) { return(vtemp); } else { removeViews(view_name); return(null); } } else { return(null); } }
/// <summary> /// Return main view Form /// </summary> /// <param name="view_name"></param> /// <returns></returns> public Control mainViewControl(String view_name) { CView vtemp = getFirstView(view_name); return((vtemp != null)? vtemp.mainControl(): null); }
/// <summary> /// Free all views /// </summary> public void freeView(CView view) { removeViews_byGuid(view.guid); }