private object DoInclude(IInclude tag, IContainer parent, IValueStack stack) { var dal = ApplicationContext.Current.Dal; object component = CreateObject(stack, dal.GetScreenByName(tag.File)); if (!(component is IComponent)) { throw new Exception("Only Component container is allowed to be included"); } object[] controls = ((IContainer)component).Controls; if (parent != null) { foreach (var control in controls) { parent.AddChild(control); } return(parent); } // uglu hack: так как метод Build возвращает object, а нам нужно вернуть несколько объектов // , мы можем вернуть тут массив, но должны помнить, // что это массив (см. Controls/LayoutableContainerBehaviour.cs метод Inject) return(controls); }
private void AddSubcontainer() { var newContainer = GetNewFilterContainer(); _container.AddChild(newContainer); Publish((DatabaseEntity)_container); }
public override void Execute() { base.Execute(); if (_host != null && _container == null) { _host.CreateRootContainerIfNotExists(); _container = _host.RootFilterContainer; } if (_container == null) { throw new Exception("Container was null, either host failed to create or explicit null container was chosen"); } var wizard = new FilterImportWizard(BasicActivator); var import = wizard.ImportOneFromSelection(_container, _filters); if (import != null) { _container.AddChild(import); Publish((DatabaseEntity)import); Emphasise((DatabaseEntity)import); } }
public override void Execute() { base.Execute(); var factory = _container?.GetFilterFactory() ?? _host?.GetFilterFactory(); if (factory == null) { throw new Exception("Unable to determine FilterFactory, is host and container null?"); } var newContainer = factory.CreateNewContainer(); if (_host != null) { _host.RootFilterContainer_ID = newContainer.ID; _host.SaveToDatabase(); } else { if (_container == null) { throw new Exception("Command should take container or host but both were null"); } _container.AddChild(newContainer); } Publish(_host ?? (IMapsDirectlyToDatabaseTable)newContainer); Emphasise(newContainer); }
public override void Execute() { base.Execute(); var f = (DatabaseEntity)_factory.CreateNewFilter("New Filter " + Guid.NewGuid()); if (_host != null && _container == null) { if (_host.RootFilterContainer_ID == null) { _host.CreateRootContainerIfNotExists(); } _container = _host.RootFilterContainer; } if (_container != null) { _container.AddChild((IFilter)f); } Publish((DatabaseEntity)_container ?? f); Emphasise(f); Activate(f); }
public override void Execute() { base.Execute(); _containerCombineable.Container.MakeIntoAnOrphan(); _targetContainer.AddChild(_containerCombineable.Container); Publish((DatabaseEntity)_targetContainer); }
private void DeepClone(IContainer into, IContainer from, IFilterFactory factory) { //clone the subcontainers foreach (var container in from.GetSubContainers()) { var subContainer = factory.CreateNewContainer(); subContainer.Operation = container.Operation; into.AddChild(subContainer); DeepClone(subContainer, container, factory); } var wizard = new FilterImportWizard(BasicActivator); //clone the filters foreach (var filter in from.GetFilters()) { into.AddChild(wizard.Import(into, filter)); } }
public override void Execute() { base.Execute(); var wizard = new FilterImportWizard(); IFilter newFilter = wizard.Import(_targetContainer, _filterCommand.Filter); if (newFilter != null) { _targetContainer.AddChild(newFilter); Publish((DatabaseEntity)_targetContainer); } }
public override void Execute() { base.Execute(); var f = (DatabaseEntity)_factory.CreateNewFilter("New Filter " + Guid.NewGuid()); if (_container != null) { _container.AddChild((IFilter)f); } Publish(f); Activate(f); }
public override void Execute() { base.Execute(); var wizard = new FilterImportWizard(); var import = wizard.ImportOneFromSelection(_container, _filters); if (import != null) { _container.AddChild(import); Publish((DatabaseEntity)import); Activate((DatabaseEntity)import); } }
private IContainer DoInclude(Include tag, IContainer parent, ValueStack.ValueStack stack) { var dal = ApplicationContext.Context.DAL; object component = CreateObject(stack, dal.GetScreenByName(tag.File)); if (!(component is Component)) { throw new Exception("Only Component container is allowed to be included"); } object[] controls = ((IContainer)component).Controls; foreach (object child in controls) { parent.AddChild(child); } return(parent); }
public object Build(IContainer parent, XmlNode node, IValueStack stack) { if (node is XmlComment) return null; Type t = TypeFromNode(node); if (node.NamespaceURI == MarkupElementAttribute.ValueStackNamespace) { //control flow tag var tag = (IValueStackTag)CreateObject(t, stack); foreach (XmlAttribute a in node.Attributes) { PropertyInfo pi = FindProperty(t, a.Name); //string value = ApplicationContext.Current.Dal.TranslateString(a.Value); pi.SetValue(tag, a.Value); } var push = tag as IPush; if (push != null) return DoPush(push, parent, stack); var iif = tag as IIf; if (iif != null) return DoIf(iif, parent, node, stack); if (tag is IElse) return parent; var iterator = tag as IIterator; if (iterator != null) return DoIterator(iterator, parent, node, stack); var include = tag as IInclude; if (include != null) return DoInclude(include, parent, stack); throw new Exception("Unknown tag"); } //ui control object obj = CreateObject(t, stack); SetProperties(node, stack, obj); string id = null; var layoutable = obj as ILayoutable; if (layoutable != null) id = layoutable.Id; if (parent != null) parent.AddChild(obj); if (obj is IDataBind) (obj as IDataBind).DataBind(); if (id != null) { stack.Push(id, obj); // add current object to value stack LoadStepState(stack, obj, id); } var container = obj as IContainer; if (container != null) ProcessChildren(container, node, stack); return obj; }
public object Build(IContainer parent, XmlNode node, IValueStack stack) { if (node is XmlComment) { return(null); } Type t = TypeFromNode(node); if (node.NamespaceURI == MarkupElementAttribute.ValueStackNamespace) { //control flow tag var tag = (IValueStackTag)CreateObject(t, stack); foreach (XmlAttribute a in node.Attributes) { PropertyInfo pi = FindProperty(t, a.Name); //string value = ApplicationContext.Current.Dal.TranslateString(a.Value); pi.SetValue(tag, a.Value); } var push = tag as IPush; if (push != null) { return(DoPush(push, parent, stack)); } var iif = tag as IIf; if (iif != null) { return(DoIf(iif, parent, node, stack)); } if (tag is IElse) { return(parent); } var iterator = tag as IIterator; if (iterator != null) { return(DoIterator(iterator, parent, node, stack)); } var include = tag as IInclude; if (include != null) { return(DoInclude(include, parent, stack)); } throw new Exception("Unknown tag"); } //ui control object obj = CreateObject(t, stack); SetProperties(node, stack, obj); string id = null; var layoutable = obj as ILayoutable; if (layoutable != null) { id = layoutable.Id; } if (parent != null) { parent.AddChild(obj); } if (obj is IDataBind) { (obj as IDataBind).DataBind(); } if (id != null) { stack.Push(id, obj); // add current object to value stack LoadStepState(stack, obj, id); } var container = obj as IContainer; if (container != null) { ProcessChildren(container, node, stack); } return(obj); }
object Build(IContainer parent, XmlNode node, ValueStack.ValueStack stack) { if (node is XmlComment) { return(null); } Type t = TypeFromNode(node); if (t.IsSubclassOf(typeof(ValueStackTag))) { //control flow tag ConstructorInfo ci = t.GetConstructor(new Type[] { }); var tag = (ValueStackTag)ci.Invoke(new object[] { }); foreach (XmlAttribute a in node.Attributes) { PropertyInfo pi = t.GetProperty(a.Name, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); string value = ApplicationContext.Context.DAL.TranslateString(a.Value); pi.SetValue(tag, Convert.ChangeType(value, pi.PropertyType), null); } if (tag is Include) { return(DoInclude((Include)tag, parent, stack)); } if (tag is If) { return(DoIf((If)tag, parent, node, stack)); } if (tag is Else) { return(parent); } if (tag is Iterator) { return(DoIterator((Iterator)tag, parent, node, stack)); } if (tag is Push) { object newObject = null; if (node.ChildNodes.Count == 1) { newObject = Build(null, node.FirstChild, stack); } return(DoPush((Push)tag, parent, stack, newObject)); } throw new Exception("Unknown tag"); } else { //ui control object obj = CreateObject(t, stack); string id = InitObjectId(node, stack, obj); SetProperties(node, stack, obj); if (parent != null) { parent.AddChild(obj); } if (obj is IDataBind) { (obj as IDataBind).DataBind(); } if (id != null) { LoadStepState(stack, obj, id); } if (obj is IContainer) { ProcessChildren((IContainer)obj, node, stack); } return(obj); } }
object Build(IContainer parent, XmlNode node, ValueStack.ValueStack stack) { if (node is XmlComment) return null; Type t = TypeFromNode(node); if (t.IsSubclassOf(typeof(ValueStackTag))) { //control flow tag ConstructorInfo ci = t.GetConstructor(new Type[] { }); var tag = (ValueStackTag)ci.Invoke(new object[] { }); foreach (XmlAttribute a in node.Attributes) { PropertyInfo pi = t.GetProperty(a.Name, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); string value = ApplicationContext.Context.DAL.TranslateString (a.Value); pi.SetValue(tag, Convert.ChangeType(value, pi.PropertyType), null); } if (tag is Include) { return DoInclude((Include)tag, parent, stack); } if (tag is If) { return DoIf((If)tag, parent, node, stack); } if (tag is Else) { return parent; } if (tag is Iterator) { return DoIterator((Iterator)tag, parent, node, stack); } if (tag is Push) { object newObject = null; if (node.ChildNodes.Count == 1) { newObject = Build(null, node.FirstChild, stack); } return DoPush((Push)tag, parent, stack, newObject); } throw new Exception("Unknown tag"); } else { //ui control object obj = CreateObject(t, stack); string id = InitObjectId(node, stack, obj); SetProperties(node, stack, obj); if (parent != null) parent.AddChild(obj); if (obj is IDataBind) (obj as IDataBind).DataBind(); if (id != null) LoadStepState(stack, obj, id); if (obj is IContainer) ProcessChildren((IContainer)obj, node, stack); return obj; } }
private IContainer DoInclude(Include tag, IContainer parent, ValueStack.ValueStack stack) { var dal = ApplicationContext.Context.DAL; object component = CreateObject(stack, dal.GetScreenByName(tag.File)); if (!(component is Component)) throw new Exception("Only Component container is allowed to be included"); object[] controls = ((IContainer)component).Controls; foreach (object child in controls) parent.AddChild(child); return parent; }
public void Show(IContainer parent, int x, int y, bool bottomAlign = false) { int w = 0; int i; bool addSubs = false; // Check for empty or bad parent if (_items == null || parent.TopLevelContainer != Core.ActiveContainer) { return; } // Calculate Size int h = GetMenuItem(_items); for (i = 0; i < _items.Length; i++) { int j = FontManager.ComputeExtentEx(_font, _items[i].Text).Width; if (_items[i].Length > 0) { addSubs = true; } if (j > w) { w = j; } } w += (addSubs) ? 40 : 8; // Update Position if (bottomAlign) { y -= h; } if (y + h > Core.Screen.Height) { y = y - h; } if (y < 0) { y = 0; } if (x + w > Core.Screen.Width) { x = x - w; } if (x < 0) { x = 0; } X = x; Y = y; Width = w; Height = h; if (!Visible) { Visible = true; } parent.AddChild(this); parent.ActiveChild = this; }
static void LoadChildren(Stream fs, IContainer parent) { while (true) { int id = fs.ReadByte(); switch (id) { case 0: // Button parent.AddChild(LoadButton(fs)); break; case 1: // Checkbox parent.AddChild(LoadCheckbox(fs)); break; case 2: // Combobox parent.AddChild(LoadCombobox(fs)); break; case 3: // Filebox parent.AddChild(LoadFilebox(fs)); break; case 5: // Label parent.AddChild(LoadLabel(fs)); break; case 6: // Listbox parent.AddChild(LoadListbox(fs)); break; case 7: // ListboxItem break; case 8: // MenuStrip parent.AddChild(LoadMenuStrip(fs)); break; case 9: // MenuItem parent.AddChild(LoadMenuItem(fs)); break; case 10: // NumericUpDown parent.AddChild(LoadNumericUpDown(fs)); break; case 11: // Panel parent.AddChild(LoadPanel(fs)); break; case 12: // Picturebox parent.AddChild(LoadPicturebox(fs)); break; case 13: // Progressbar parent.AddChild(LoadProgressbar(fs)); break; case 14: // RadioButton parent.AddChild(LoadRadioButton(fs)); break; case 15: // RichTextLabel parent.AddChild(LoadRichTextLabel(fs)); break; case 16: // Scrollbar parent.AddChild(LoadScrollbar(fs)); break; case 17: // Slider parent.AddChild(LoadSlider(fs)); break; case 18: // Tab break; case 19: // TabDialog parent.AddChild(LoadTabDialog(fs)); break; case 20: // Textbox parent.AddChild(LoadTextbox(fs)); break; case 21: // Treeview parent.AddChild(LoadTreeview(fs)); break; case 22: // TreviewNode break; case 255: // End of Container return; default: // Unknown/Invalid throw new Exception("Control Ident failure (" + id + ")"); } } }
private object DoInclude(IInclude tag, IContainer parent, IValueStack stack) { var dal = ApplicationContext.Current.Dal; object component = CreateObject(stack, dal.GetScreenByName(tag.File)); if (!(component is IComponent)) throw new Exception("Only Component container is allowed to be included"); object[] controls = ((IContainer)component).Controls; if (parent != null) { foreach (var control in controls) parent.AddChild(control); return parent; } // uglu hack: так как метод Build возвращает object, а нам нужно вернуть несколько объектов // , мы можем вернуть тут массив, но должны помнить, // что это массив (см. Controls/LayoutableContainerBehaviour.cs метод Inject) return controls; }
static void LoadChildren(Stream fs, IContainer parent, int offsetX = 0, int offsetY = 0) { IControl ctrl = null; while (true) { var id = fs.ReadByte(); switch (id) { case 0: // Button ctrl = (LoadButton(fs)); break; case 1: // Checkbox ctrl = (LoadCheckbox(fs)); break; case 2: // Combobox ctrl = (LoadCombobox(fs)); break; case 3: // Filebox ctrl = (LoadFilebox(fs)); break; case 5: // Label ctrl = (LoadLabel(fs)); break; case 6: // Listbox ctrl = (LoadListbox(fs)); break; case 7: // ListboxItem break; case 8: // MenuStrip ctrl = (LoadMenuStrip(fs)); break; case 9: // MenuItem ctrl = (LoadMenuItem(fs)); break; case 10: // NumericUpDown ctrl = (LoadNumericUpDown(fs)); break; case 11: // Panel ctrl = (LoadPanel(fs)); break; case 12: // Picturebox ctrl = (LoadPicturebox(fs)); break; case 13: // Progressbar ctrl = (LoadProgressbar(fs)); break; case 14: // RadioButton ctrl = (LoadRadioButton(fs)); break; case 15: // RichTextLabel ctrl = (LoadRichTextLabel(fs)); break; case 16: // Scrollbar ctrl = (LoadScrollbar(fs)); break; case 17: // Slider ctrl = (LoadSlider(fs)); break; case 18: // Tab break; case 19: // TabDialog ctrl = (LoadTabDialog(fs)); break; case 20: // Textbox ctrl = (LoadTextbox(fs)); break; case 21: // Treeview ctrl = (LoadTreeview(fs)); break; case 22: // TreviewNode break; case 23: // Appbar ctrl = (LoadAppbar(fs)); break; case 26: // GraphicLock ctrl = (LoadGraphicLock(fs)); break; case 27: // LineGraph ctrl = (LoadLineGraph(fs)); break; case 29: // Listview ctrl = (LoadListView(fs)); break; case 32: // SlidePanelDialog ctrl = (LoadSlidePanelDialog(fs)); break; case 34: // TextArea ctrl = (LoadTextArea(fs)); break; case 35: // Window ctrl = (LoadWindow(fs)); break; case 255: // End of Container return; default: // Unknown/Invalid throw new Exception("Control Ident failure (" + id + ")"); } if (ctrl != null) { ctrl.X -= offsetX; ctrl.Y -= offsetY; parent.AddChild(ctrl); } } }