private void BtnUndo_Click(object sender, System.EventArgs e) { ControlDefinition oUndoControl = _InvApp.CommandManager.ControlDefinitions["AppUndoCmd"]; switch (_undoSta) { case 0: break; case 1: if (_InvApp.ActiveEditDocument is DrawingDocument) { oUndoControl.Execute2(true); // for edit } else { oUndoControl.Execute2(true); // for select oUndoControl.Execute2(true); // for edit } break; case 2: oUndoControl.Execute2(true); break; } Helper.ProduceRows(); BtnUndo.Enabled = false; }
public Response <ControlDefinition> UpdateControl([FromBody] ControlDefinition control) { return(GetResponse(() => { return new EditorService(User).UpdateControl(control); })); }
public Control Make(ControlDefinition definition, DAL.Models.DbSearchResponse ticketSet, UI.Instance parentNode, Action <Control> controlAction) { var control = new UI.Control { ControlType = Mapper.Map <UI.ControlType>(definition.ControlType), ParentNode = parentNode }; var ticket = ticketSet.Tickets.FirstOrDefault(); var dalControl = (DAL.Models.Control)definition.Entity; if (ticket != null) { control.DocId = Convert.ToInt32(ticket[dalControl.Field.TemplateId, "Id"]); } control.Props.Add("DisplayName", definition.DisplayName); control.Props.Add("FieldId", dalControl.Field.Id); control.Props.Add("DictionaryId", dalControl.Field.Dictionary.Id); control.Props.Add("DictionaryName", dalControl.Field.Dictionary.Name); control.Props.Add("DictionaryType", Enum.GetName(typeof(DAL.Models.DictionaryType), dalControl.Field.Dictionary.DictionaryType)); control.Props.Add("Order", definition.OrderIndex); control.Props.Add("Width", definition.Width); control.Props.Add("Style", Mapper.Map <UI.StyleDefinition>(((DAL.Models.Control)definition.Entity).Style)); var options = DbDictionaryCache.GetDictionaryRecords(dalControl.Field.Dictionary); var controlOptions = options.Select(i => new KeyValuePair <object, string>(i.Key, i.Value)).ToList(); control.Props.Add("Options", controlOptions); control.Value = DbDictionaryCache.GetValues(dalControl.Field.Dictionary, dalControl.Field.Id, control.DocId.Value); return(control); }
private void RemoveFromDisabledList() { try { ControlDefinition parallelEnvButton = mInventorApp.CommandManager.ControlDefinitions[Resources.IDC_ENV_INTERNAL_NAME]; if (null != parallelEnvButton) { UserInterfaceManager userInterFaceMgr = mInventorApp.UserInterfaceManager; int iEnvCount = userInterFaceMgr.Environments.Count; Inventor.Environment env; for (int i = 1; i <= iEnvCount; i++) { env = userInterFaceMgr.Environments[i]; if (env.InternalName != "PMxPartEnvironment" && env.BuiltIn == true) { // check for existing button in disabled list int index = FindEnvironment(env, parallelEnvButton); if (0 != index) { env.DisabledCommandList.Remove(index); } } } } } catch (Exception e) { MessageBox.Show(e.InnerException.Message); } }
public UI.Control Make(ControlDefinition definition, DbSearchResponse ticketSet, UI.Instance parentNode, Action <UI.Control> controlAction) { var control = new UI.Control { ControlType = Mapper.Map <UI.ControlType>(definition.ControlType), ParentNode = parentNode }; var ticket = ticketSet.Tickets.FirstOrDefault(); var dalControl = (DAL.Models.Control)definition.Entity; control.Events = definition .Events .Select(e => BehaviourSelector.EventBehaviours[Mapper.Map <UI.EventType>(e.EventType)](CurrentUser).Make(e, ticketSet, control)) .ToList(); control.Props.Add("DisplayName", definition.DisplayName); control.Props.Add("Order", definition.OrderIndex); control.Props.Add("Width", definition.Width); control.Props.Add("Style", Mapper.Map <UI.StyleDefinition>(((DAL.Models.Control)definition.Entity).Style)); if (dalControl.Field != null) { control.Props.Add("FieldId", dalControl.Field.Id); } if (ticket != null) { control.DocId = Convert.ToInt32(ticket[dalControl.Field.TemplateId, "Id"]); if (dalControl.Field.FieldType.In(DAL.Models.FieldType.Dictionary)) { control.Props.Add("DictionaryId", dalControl.Field.Dictionary.Id); control.Props.Add("DictionaryName", dalControl.Field.Dictionary.Name); control.Props.Add("DictionaryType", Enum.GetName(typeof(DAL.Models.DictionaryType), dalControl.Field.Dictionary.DictionaryType)); var options = DbDictionaryCache.GetDictionaryRecords(dalControl.Field.Dictionary); var values = DbDictionaryCache.GetValues(dalControl.Field.Dictionary, dalControl.Field.Id, control.DocId.Value); control.Value = string.Join(", ", values.Select(v => options[v])); } else if (dalControl.Field.FieldType == DAL.Models.FieldType.Flag) { control.Value = (ticket[dalControl.Field] == null) ? string.Empty : (bool)ticket[dalControl.Field] ? $"{definition.DisplayName}" : string.Empty; } else if (dalControl.Field.FieldType == DAL.Models.FieldType.DateTime) { control.Value = (ticket[dalControl.Field] != null) ? ((DateTime)ticket[dalControl.Field]).ToString("dd.MM.yyyy") : string.Empty; } else { control.Value = ticket[dalControl.Field] ?? string.Empty; } } return(control); }
public Control Make(ControlDefinition definition, DAL.Models.DbSearchResponse ticketSet, UI.Instance parentNode, Action <Control> controlAction) { var button = new UI.Control() { Virtual = true, ParentNode = parentNode, ControlType = ControlType.ButtonSearch }; button.Props = new Dictionary <string, object>() { { "DisplayName", RC.BTN_SEARCH }, { "Width", 3 }, { "Order", 0 }, //{ "PageSize", ticketSet.PageSize.ToString() }, //{ "PageNumber", "1" }, //{ "SortFieldId", "Id"}, //{ "SortDirection", "asc" }, { "Style", GetStyle() } }; var evt = new Event() { Virtual = true, EventType = EventType.Click, ParentNode = button }; evt.Actions.Add(new SearchActionBehaviour(CurrentUser).Make(null, null, evt)); button.Events.Add(evt); return(button); }
public async Task <IActionResult> PutControlDefinition([FromRoute] Guid id, [FromBody] ControlDefinition controlDefinition) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != controlDefinition.ControlTypeId) { return(BadRequest()); } _context.Entry(controlDefinition).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ControlDefinitionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
void RestoreCurrentKey() { ControlDefinition.Key = ControlDefinition.OldKeyCode; ControlDefinition.HasModifier = ControlDefinition.OldHasModifier; ControlDefinition.ModifierKey = ControlDefinition.OldModifierKey; ControlDefinition.IsShift = ControlDefinition.OldIsShift; ControlDefinition = null; }
/// <summary> /// Adds control to existing control group /// </summary> /// <param name="controlDefinition">Definition of ribbon control.</param> /// <param name="controlGroupId">Id of a control group, where the control will be inserted into. For example: "Ribbon.ListItem.New"</param> /// <param name="controlSequence">Sequence value for this control to position it inside the group.</param> public void AddControl(ControlDefinition controlDefinition, string controlGroupId, int controlSequence) { RibbonXML = ConcatXML(RibbonXML, XmlGenerator.Current.GetCommandUIDefinitionXML( controlGroupId + ".Controls._children", XmlGenerator.Current.GetControlXML(controlDefinition, controlSequence, controlGroupId))); RibbonCommandsXML = ConcatXML(RibbonCommandsXML, GetCommandsXML(controlDefinition)); }
public void Remove() { OnRemove(); if (ControlDefinition != null) { ControlDefinition.Delete(); } }
void SetCurrentKey(ControlDefinition c) { ControlDefinition = c; c.OldKeyCode = c.Key; c.OldModifierKey = c.ModifierKey; c.OldHasModifier = c.HasModifier; c.Key = KeyCode.None; c.HasModifier = false; }
public async Task <IActionResult> PostControlDefinition([FromBody] ControlDefinition controlDefinition) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ControlDefinition.Add(controlDefinition); await _context.SaveChangesAsync(); return(CreatedAtAction("GetControlDefinition", new { id = controlDefinition.ControlTypeId }, controlDefinition)); }
private XElement GetControlElement(ControlDefinition control, int controlIndex, string groupId) { var controlElement = new XElement(control.Tag, new XAttribute("Sequence", controlIndex) ); control.NameSpace = groupId; control.AddAttributes(controlElement); AddContainerAttributes(controlElement, control as IContainer, control.FullId); return(controlElement); }
/// <summary> /// Replaces control with custom one. /// </summary> /// <param name="controlDefinition">Definition of ribbon control.</param> /// <param name="controlId">Id of the old control, which will be replaced</param> /// <param name="controlSequence">Sequence value for this control to position it inside the group.</param> public void ReplaceControl(ControlDefinition controlDefinition, string controlId, int controlSequence) { RibbonXML = ConcatXML(RibbonXML, XmlGenerator.Current.GetCommandUIDefinitionXML( controlId, XmlGenerator.Current.GetControlXML( controlDefinition, controlSequence, controlId.Substring(0, controlId.LastIndexOf('.')) ))); RibbonCommandsXML = ConcatXML(RibbonCommandsXML, GetCommandsXML(controlDefinition)); }
public Control Make(ControlDefinition definition, DAL.Models.DbSearchResponse ticketSet, UI.Instance parentNode, Action <UI.Control> controlAction) { var header = new Control() { ControlType = UI.ControlType.TableHeaderControl, ParentNode = parentNode, Virtual = true }; header.Props = new Dictionary <string, object>() { { "DisplayName", definition.DisplayName }, { "Width", definition.Width }, { "Order", definition.OrderIndex }, { "Style", GetStyle() } }; var dalControl = (DAL.Models.Control)definition.Entity; if (dalControl.FieldId.HasValue && !dalControl.Field.FieldType.In(DAL.Models.FieldType.Dictionary, DAL.Models.FieldType.File)) { var controlFieldId = ((DAL.Models.Control)definition.Entity).Field.Id; header.Props.Add("IsCurrentSortControl", ticketSet.SortField.Id == controlFieldId); header.Props.Add("PageSize", ticketSet.PageSize.ToString()); header.Props.Add("PageNumber", ticketSet.PageNumber.ToString()); header.Props.Add("SortFieldId", ((DAL.Models.Control)definition.Entity).Field?.Id.ToString()); header.Props.Add("SortDirection", (ticketSet.SortField.Id != controlFieldId) ? "asc" : ticketSet.SortDirection == "asc" ? "desc" : "asc"); var evt = new Event() { Virtual = true, EventType = EventType.Click, ParentNode = header }; evt.Actions.Add(new SearchActionBehaviour(CurrentUser).Make(null, null, evt)); header.Events.Add(evt); } return(header); }
private int FindEnvironment(Inventor.Environment env, ControlDefinition ctrlDef) { try { int index = 0; for (int i = 1; i <= env.DisabledCommandList.Count; i++) { if (ctrlDef == env.DisabledCommandList[i]) { index = i; break; } } return(index); } catch (Exception e) { } return(0); }
public Control Make(ControlDefinition definition, DAL.Models.DbSearchResponse ticketSet, UI.Instance parentNode, Action <Control> controlAction) { var control = new Control() { ControlType = Mapper.Map <UI.ControlType>(definition.ControlType), ParentNode = parentNode }; control.Props = new Dictionary <string, object>() { { "Id", definition.Id }, { "DisplayName", definition.DisplayName }, { "Width", definition.Width }, { "Order", definition.OrderIndex }, { "Style", Mapper.Map <UI.StyleDefinition>(((DAL.Models.Control)definition.Entity).Style) } }; var dalControl = (DAL.Models.Control)definition.Entity; if (dalControl.Field != null) { control.Props.Add("FieldId", dalControl.Field.Id); control.Props.Add("Name", dalControl.Field.Name); } var ticket = ticketSet.Tickets.FirstOrDefault(); control.Events = definition .Events .Select(e => BehaviourSelector.EventBehaviours[Mapper.Map <UI.EventType>(e.EventType)](CurrentUser).Make(e, ticketSet, control)) .ToList(); if (ticket != null && dalControl.FieldId.HasValue) { control.Value = ticket[dalControl.Field]; control.DocId = Convert.ToInt32(ticket[dalControl.Field.TemplateId, "Id"]); } return(control); }
public UI.Control Make(ControlDefinition definition, DAL.Models.DbSearchResponse ticketSet, UI.Instance parentNode, Action <UI.Control> controlAction) { var button = new UI.Control() { Virtual = true, ParentNode = parentNode, ControlType = ControlType.SectionSettingsButton }; var evt = new Event() { Virtual = true, EventType = EventType.Click, ParentNode = button }; evt.Actions.Add(new GetSectionSettingsBehaviour(CurrentUser).Make(null, null, evt)); button.Events.Add(evt); return(button); }
public UI.Control Make(ControlDefinition definition, DAL.Models.DbSearchResponse ticketSet, Instance parentNode, Action <UI.Control> controlAction) { var control = new Control { ControlType = ControlType.AutoComplete, ParentNode = parentNode }; control.Events = definition .Events .Select(a => BehaviourSelector.EventBehaviours[Mapper.Map <UI.EventType>(a.EventType)](CurrentUser).Make(a, ticketSet, null)) .ToList(); control.Props = new Dictionary <string, object>() { { "DisplayName", definition.DisplayName }, { "Width", definition.Width }, { "Order", definition.OrderIndex }, { "Id", definition.Id } }; return(control); }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public ErrorAlert(ControlDefinition definition) : base(definition) { }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public InstructionMessage(ControlDefinition definition) : base(definition) { }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public ErrorMessage(ControlDefinition definition) : base(definition) { }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public InfoMessage(ControlDefinition definition) : base(definition) { }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public WarningMessage(ControlDefinition definition) : base(definition) { }
/// <summary> /// Creates the <see cref="Control"/>. /// </summary> /// <param name="context">The <see cref="IMansionWebContext"/>.</param> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> protected override AlertBase CreateMessageControl(IMansionWebContext context, ControlDefinition definition) { return new InfoAlert(definition); }
/* * Use this code to perform own security checks * protected virtual void CheckCustomRights() * { * * bool userCheckedForCustomLogic = false; * //write here a custom logic to check if user has enough rights to access application page * //if yes, set userCheckedForCustomLogic to true; * * if (!userCheckedForCustomLogic) * { * SPUtility.HandleAccessDenied(new UnauthorizedAccessException()); * } * } * * protected override void OnLoad(EventArgs e) * { * this.CheckCustomRights(); * } */ public override Common.Ribbon.Definitions.TabDefinition GetTabDefinition() { TabDefinition tab = new TabDefinition(); tab.Id = "ModulesRibbon"; tab.Title = "Modules"; tab.Sequence = "110"; tab.GroupTemplates = GroupTemplateLibrary.AllTemplates; GroupDefinition[] group = new GroupDefinition[3]; GroupDefinition Navigationlayouts = new GroupDefinition(); Navigationlayouts.Id = "ActionsGroup"; Navigationlayouts.Title = "Navigation"; Navigationlayouts.Sequence = "10"; Navigationlayouts.Template = GroupTemplateLibrary.SimpleTemplate; ControlDefinition[] Navigationcontrols = new ControlDefinition[1]; ButtonDefinition backbutton = new ButtonDefinition(); backbutton.Id = "GoBackModules"; backbutton.TemplateAlias = "o1"; backbutton.Title = "Go back"; //button.Description = master.Description; backbutton.CommandEnableJavaScript = "true"; backbutton.CommandJavaScript = String.Format("__doPostBack('{0}','{1}');", RibbonPostbackId, "GoModules"); backbutton.Image = ImageLibrary.GetStandardImage(3, 13); Navigationcontrols[0] = backbutton; Navigationlayouts.Controls = Navigationcontrols; group[0] = Navigationlayouts; GroupDefinition Modulelayouts = new GroupDefinition(); Modulelayouts.Id = "ModulesGroup"; Modulelayouts.Title = "Manage Module"; Modulelayouts.Sequence = "20"; Modulelayouts.Template = GroupTemplateLibrary.SimpleTemplate; ControlDefinition[] Modulescontrols = new ControlDefinition[2]; ButtonDefinition savebutton = new ButtonDefinition(); savebutton.Id = "SaveModules"; savebutton.TemplateAlias = "o1"; savebutton.Title = "Save Module"; //button.Description = master.Description; savebutton.CommandEnableJavaScript = "true"; savebutton.CommandJavaScript = String.Format("__doPostBack('{0}','{1}');", RibbonPostbackId, "Save"); savebutton.Image = ImageLibrary.GetStandardImage(8, 4); Modulescontrols[0] = savebutton; ButtonDefinition deletebutton = new ButtonDefinition(); deletebutton.Id = "DeleteModules"; deletebutton.TemplateAlias = "o1"; deletebutton.Title = "Delete Module"; //button.Description = master.Description; deletebutton.CommandEnableJavaScript = Guid.Empty.Equals(_guid) ? Boolean.FalseString : Boolean.TrueString; deletebutton.CommandJavaScript = String.Format("__doPostBack('{0}','{1}');", RibbonPostbackId, "Delete"); deletebutton.Image = ImageLibrary.GetStandardImage(4, 4); Modulescontrols[1] = deletebutton; Modulelayouts.Controls = Modulescontrols; group[1] = Modulelayouts; GroupDefinition Rulelayouts = new GroupDefinition(); Rulelayouts.Id = "RulesGroup"; Rulelayouts.Title = "Manage Rules"; Rulelayouts.Sequence = "30"; Rulelayouts.Template = GroupTemplateLibrary.SimpleTemplate; ControlDefinition[] Rulecontrols = new ControlDefinition[1]; ButtonDefinition Rulebutton = new ButtonDefinition(); Rulebutton.Id = "ManageRule"; Rulebutton.TemplateAlias = "o1"; Rulebutton.Title = "Manage Rules"; //button.Description = master.Description; Rulebutton.CommandEnableJavaScript = Guid.Empty.Equals(_guid) ? Boolean.FalseString : Boolean.TrueString; Rulebutton.CommandJavaScript = String.Format("__doPostBack('{0}','{1}');", RibbonPostbackId, "Rules"); Rulebutton.Image = ImageLibrary.GetStandardImage(0, 7); Rulecontrols[0] = Rulebutton; Rulelayouts.Controls = Rulecontrols; group[2] = Rulelayouts; tab.Groups = group; return(tab); }
/// <summary> /// Creates the <see cref="Control"/>. /// </summary> /// <param name="context">The <see cref="IMansionWebContext"/>.</param> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> protected override MessageBase CreateMessageControl(IMansionWebContext context, ControlDefinition definition) { return new SuccessMessage(definition); }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public SuccessAlert(ControlDefinition definition) : base(definition) { }
void OnGUI() { GUI.skin = Resources.Load("RPGMakerAssets/EditorSkinRPGMaker") as GUISkin; GUILayout.BeginHorizontal(); GUILayout.Label("Move Forward"); var selectedB = ControlDefinition == MyDefinitionB ? " PRESS KEY " : MyDefinitionB.KeyString; if (GUILayout.Button(selectedB, GUILayout.MaxHeight(30))) { if (ControlDefinition == null) { SetCurrentKey(MyDefinitionB); } else if (ControlDefinition == MyDefinitionB) { RestoreCurrentKey(); } } var evt = Event.current; if (ControlDefinition != null) { if (evt.type == EventType.Repaint) { if (Input.GetKey(KeyCode.LeftShift)) { GotShift = "Left"; LastShift = "Left"; } else if (Input.GetKey(KeyCode.RightShift)) { GotShift = "Right"; LastShift = "Right"; } else { GotShift = ""; } } if (evt.type == EventType.KeyDown) { if (Event.current.modifiers > 0) { GotShiftSolo = false; if ((Event.current.modifiers & EventModifiers.Shift) == EventModifiers.Shift) { ControlDefinition.HasModifier = true; ControlDefinition.ModifierKey = EventModifiers.Shift; } else if ((Event.current.modifiers & EventModifiers.Control) == EventModifiers.Control) { ControlDefinition.HasModifier = true; ControlDefinition.ModifierKey = EventModifiers.Control; } else if ((Event.current.modifiers & EventModifiers.Alt) == EventModifiers.Alt) { ControlDefinition.HasModifier = true; ControlDefinition.ModifierKey = EventModifiers.Alt; } else if ((Event.current.modifiers & EventModifiers.Command) == EventModifiers.Command) { ControlDefinition.HasModifier = true; ControlDefinition.ModifierKey = EventModifiers.Command; } else { ControlDefinition.HasModifier = false; } } KeyCode[] keyCode = new KeyCode[] { KeyCode.Escape, KeyCode.None }; if (keyCode.All(k => evt.keyCode != k)) { ControlDefinition.Key = Event.current.keyCode; GotShift = ""; GotShiftSolo = false; evt.Use(); } else if (evt.keyCode == KeyCode.Escape) { RestoreCurrentKey(); evt.Use(); } GUI.FocusControl(""); } else if ((string.IsNullOrEmpty(GotShift) && GotShiftSolo)) { ControlDefinition.Key = LastShift == "Left" ? KeyCode.LeftShift : KeyCode.RightShift; ControlDefinition.HasModifier = false; // var sameKey = MyDefinitions.FirstOrDefault(c => c.HasModifier == ControlDefinition.HasModifier && // c.ModifierKey == ControlDefinition.ModifierKey && // c.Key == ControlDefinition.Key && // c.IsShift == ControlDefinition.IsShift && // c.ID != ControlDefinition.ID // ); // // if (sameKey != null) // { // Debug.Log("Unassigned key for [" + sameKey.VisibleName + "]"); // sameKey.Key = KeyCode.None; // sameKey.HasModifier = false; // sameKey.ModifierKey = EventModifiers.CapsLock; // sameKey.IsShift = false; // } ControlDefinition = null; GotShift = ""; GotShiftSolo = false; evt.Use(); } else if (evt.type == EventType.KeyUp) { KeyCode[] modKeyCodes = new KeyCode[] { KeyCode.LeftShift, KeyCode.RightShift, KeyCode.RightControl, KeyCode.LeftControl, KeyCode.RightAlt, KeyCode.LeftAlt, KeyCode.AltGr }; if (modKeyCodes.Any(k => k == ControlDefinition.Key)) { ControlDefinition.HasModifier = false; } // var sameKey = MyDefinitions.FirstOrDefault(c => c.HasModifier == ControlDefinition.HasModifier && // c.ModifierKey == ControlDefinition.ModifierKey && // c.Key == ControlDefinition.Key && // c.IsShift == ControlDefinition.IsShift && // c.ID != ControlDefinition.ID // ); // // if (sameKey != null) // { // Debug.Log("Unassigned key for [" + sameKey.VisibleName + "]"); // sameKey.Key = KeyCode.None; // sameKey.HasModifier = false; // sameKey.ModifierKey = EventModifiers.CapsLock; // sameKey.IsShift = false; // } GotShift = ""; GotShiftSolo = false; ControlDefinition = null; evt.Use(); } if (GotShift != "") { GotShiftSolo = true; } else { GotShiftSolo = false; } } GUILayout.EndHorizontal(); }
public void AddCommands(RibbonDefinition definition) { IEnumerable <ControlDefinition> controls; if (definition is ContextualGroupDefinition) { controls = (definition as ContextualGroupDefinition).Tabs.SelectMany(t => t.Groups).SelectMany(g => g.Controls).ToArray(); } else if (definition is TabDefinition) { controls = (definition as TabDefinition).Groups.SelectMany(g => g.Controls).ToArray(); } else if (definition is GroupDefinition) { controls = (definition as GroupDefinition).Controls.ToArray(); } else if (definition is ControlDefinition) { controls = new ControlDefinition[] { definition as ControlDefinition } } ; else { throw new ArgumentException(); } // MRUSplitButtonDefinition: Command="{Id}MenuCommand" commands.AddRange( controls .WithDescendants(c => c is IContainer ? (c as IContainer).Controls : null) .OfType <MRUSplitButtonDefinition>() .Select <MRUSplitButtonDefinition, FluentRibbonCommand>(c => new FluentRibbonCommand( c.FullId + "MenuCommand", "handleCommand(properties['CommandValueId']);", "true" ) ).ToArray() ); // Buttons of all types, including Button, SplitButton, ToggleButton commands.AddRange( controls .WithDescendants(c => c is IContainer ? (c as IContainer).Controls : null) .OfType <ButtonBaseDefinition>() .Select <ButtonBaseDefinition, FluentRibbonCommand>(b => new FluentRibbonCommand(b.FullId + "Command", b.CommandJavaScript, b.CommandEnableJavaScript)).ToArray()); // Initializable controls var initializationScript = "var initialValue = function() { {IVScript} }; var v = initialValue(); if (v != null) { properties['On'] = true; properties['Value'] = v; }"; var buttonInitializationScript = "var initialValue = function() { {IVScript} }; var v = initialValue(); if (v != null) { properties['On'] = v; properties['Value'] = v; }"; commands.AddRange( controls .WithDescendants(c => c is IContainer ? (c as IContainer).Controls : null) .Where(c => c is IInitializable) .SelectMany(c => c is ButtonBaseDefinition ? new FluentRibbonCommand[] { new FluentRibbonCommand(c.FullId + "QueryCommand", buttonInitializationScript.Replace("{IVScript}", (c as IInitializable).InitialValueJavaScript), "true") } : new FluentRibbonCommand[] { new FluentRibbonCommand(c.FullId + "Command", String.Empty, "true"), new FluentRibbonCommand(c.FullId + "QueryCommand", initializationScript.Replace("{IVScript}", (c as IInitializable).InitialValueJavaScript), "true") }).ToArray()); }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public InstructionAlert(ControlDefinition definition) : base(definition) { }
public static WidgetContext BuildContext(FormContext formContext, string widgetId, ControlDefinition controlDef = null) { var cnxt = new WidgetContext(formContext); cnxt.ControlId = widgetId; cnxt.ControlDefinition = controlDef; return(cnxt); }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public InfoAlert(ControlDefinition definition) : base(definition) { }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> protected FormControlContainer(ControlDefinition definition) : base(definition) { }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public WarningAlert(ControlDefinition definition) : base(definition) { }
internal string GetControlXML(ControlDefinition definition, int sequence, string groupId) { definition.Validate(); return(new XDocument(GetControlElement(definition, sequence, groupId)).ToString()); }
/// <summary> /// Constructs a control with the specified ID. /// </summary> /// <param name="definition">The <see cref="ControlDefinition"/>.</param> public SuccessMessage(ControlDefinition definition) : base(definition) { }
public Control Make(ControlDefinition definition, DAL.Models.DbSearchResponse ticketSet, Instance parentNode, Action <Control> controlAction) { Control control = new Control { ControlType = Mapper.Map <ControlType>(definition.ControlType), ParentNode = parentNode }; var ticket = ticketSet.Tickets.FirstOrDefault(); if (ticket == null) { throw new CustomValidationException("Ticket is null"); } DAL.Models.Control dalControl = (DAL.Models.Control)definition.Entity; if (!dalControl.FieldId.HasValue || dalControl.FieldId <= 0) { throw new CustomValidationException("Control.FieldId must have value"); } control.DocId = Convert.ToInt32(ticket[dalControl.Field.TemplateId, "Id"]); if (!control.DocId.HasValue || control.DocId <= 0) { throw new CustomValidationException("Control.DocId must has value"); } control.Props.Add("DisplayName", definition.DisplayName); control.Props.Add("FieldId", dalControl.Field.Id); control.Props.Add("Order", definition.OrderIndex); control.Props.Add("Width", definition.Width); control.Props.Add("Style", Mapper.Map <StyleDefinition>(((DAL.Models.Control)definition.Entity).Style)?.GetPropertiesAsArray()); DbFileService fileService = new DbFileService(); List <DAL.Models.File> files = fileService.GetFiles(dalControl.FieldId.Value, control.DocId.Value); control.Props.Add("Files", files); Event eventUpload = new Event() { Virtual = true, EventType = EventType.Click, ParentNode = control }; var actionUpload = new UploadFileActionBehaviour(CurrentUser).Make(null, null, eventUpload); eventUpload.Actions = new List <UI.Action>() { actionUpload }; control.Events = new List <Event>() { eventUpload }; return(control); }