void onDragDrop(object sender, DragEventArgs e) { if (!Helper.CanDragAndDrop(e)) { return; } if (_modelPanel.Model.IsSubModel) { return; } Button button = null; if (e.Data.GetDataPresent(typeof(TreeNode))) { TreeNode elementNode = (TreeNode)e.Data.GetData(typeof(TreeNode)); button = _modelPanel.AddElement(this, (MetaColumn)elementNode.Tag, true); _modelPanel.MainForm.IsModified = true; _modelPanel.MainForm.CannotRenderAnymore(); _modelPanel.UpdateLINQModel(); } if (e.Data.GetDataPresent(typeof(Button))) { button = (Button)e.Data.GetData(typeof(Button)); } if (button != null) { ElementPanel source = null; if (button.Parent != this) { //Button comes from another panel ReportElement element = (ReportElement)button.Tag; source = (ElementPanel)button.Parent; source.Controls.Remove(button); element.PivotPosition = Position; element.InitEditor(); source.RedrawPanel(); Controls.Add(button); _modelPanel.MainForm.IsModified = true; _modelPanel.MainForm.CannotRenderAnymore(); _modelPanel.PanelsToElements(); } //Set new position int index = getIndexFocus(e); if (index != -1 && Controls[index] != button) { Controls.SetChildIndex(button, index); _modelPanel.MainForm.IsModified = true; _modelPanel.MainForm.CannotRenderAnymore(); _modelPanel.PanelsToElements(); } RedrawPanel(); button.Focus(); } _modelPanel.Model.CheckSortOrders(); }
public void RestrictionTextToModel() { List <ReportRestriction> restrictions = new List <ReportRestriction>(); int startPos = 0, endPos = 0; string text = restrictionsTextBox.Text; while (startPos < text.Length) { ReportRestriction restriction = getRestriction(ref startPos, ref endPos, text); if (restriction != null) { restrictions.Add(restriction); //replace by restriction GUID text = text.Remove(startPos + 1, endPos - startPos - 1); text = text.Insert(startPos + 1, restriction.GUID); startPos = startPos + 1 + restriction.GUID.Length + 1; } } //Restrictions not used are then removed if (IsAggregate) { ModelPanel.Model.AggregateRestriction = text; //If a restriction is removed, update the LINQ model if (ModelPanel.Model.AggregateRestrictions.Exists(i => !restrictions.Contains(i))) { ModelPanel.UpdateLINQModel(); } ModelPanel.Model.AggregateRestrictions = restrictions; } else { ModelPanel.Model.Restriction = text; //If a restriction is removed, update the LINQ model if (ModelPanel.Model.Restrictions.Exists(i => !restrictions.Contains(i))) { ModelPanel.UpdateLINQModel(); } ModelPanel.Model.Restrictions = restrictions; } }