private void LoadCookies(ControlList control) { XmlItemList cookieData = new XmlItemList(CommonXml.GetNode(control.ParentNode, "items", EmptyNodeHandling.CreateNew)); foreach (String key in Process.HttpPage.Response.Cookies.Keys) { if (Process.Settings["general/cookies"].Contains("," + key + ",")) { HttpCookie httpCookie = Process.HttpPage.Response.Cookies[key]; if (httpCookie != null) { cookieData[key.Replace(".", String.Empty)] = HttpUtility.UrlEncode(httpCookie.Value); } } } foreach (String key in Process.HttpPage.Request.Cookies.Keys) { if (Process.Settings["general/cookies"].Contains("," + key + ",") && String.IsNullOrEmpty(cookieData[key.Replace(".", String.Empty)])) { HttpCookie httpCookie = Process.HttpPage.Request.Cookies[key]; if (httpCookie != null) { cookieData[key.Replace(".", String.Empty)] = HttpUtility.UrlEncode(httpCookie.Value); } } } }
public void TestSort([Values] SortType sortType, [Values] InitType initType) { Action <int[]> sortFunc = sortType switch { SortType.Merge => Sorts.MergeSort, SortType.Quick => Sorts.QuickSort, SortType.Radix => Sorts.RadixSort, _ => throw new ArgumentException("Unknown SortType"), }; var array = initType switch { InitType.Empty => new int[] { }, InitType.Single => new int[] { 1 }, InitType.Asc => new int[] { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 }, InitType.Desc => new int[] { 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5 }, InitType.Mixed => new int[] { 0, 2, -2, 5, -4, 1, 3, -1, -3, 4, -5 }, _ => throw new ArgumentException("Unknown InitType"), }; var expected = new ControlList(typeof(SortedArrayList)); expected.Initialize(array); sortFunc(array); Assert.AreEqual(expected.ToString(), $"[{string.Join(',', array)}]"); }
/// <summary> /// Renders <paramref name="control"/> to the <paramref name="document"/>. /// </summary> /// <param name="document">The PDF document.</param> /// <param name="control">The control to be rendered.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> /// <param name="controlList">The complete control list.</param> protected override void DoRender(Document document, Control control, int level, ControlList controlList) { TextFrame frameTemplate = this.CreateCharacterInputBox(document.Styles[StyleNames.Normal]); Paragraph paragraphTemplate = new Paragraph { Style = StyleNames.Normal, Format = { Alignment = ParagraphAlignment.Justify, Font = { Color = Colors.LightGray } } }; Unit spacer = new Unit((frameTemplate.Width.Point - paragraphTemplate.Format.Font.Size.Point) / 4, UnitType.Point); paragraphTemplate.Format.SpaceBefore = spacer; paragraphTemplate.Format.LeftIndent = spacer; frameTemplate.MarginBottom = frameTemplate.Height; for (int i = 0; i < 8; i++) { TextFrame frame = frameTemplate.Clone(); frame.WrapFormat.DistanceLeft = (frame.Width * i) + (new Unit(PdfConstants.IndentMultiplier * level, UnitType.Millimeter)); string watermark = i < 2 ? "D" : i < 4 ? "M" : "Y"; Paragraph paragraph = paragraphTemplate.Clone(); paragraph.AddText(watermark); frame.Add(paragraph); document.LastSection.Add(frame); } TextFrame clearFrame = frameTemplate.Clone(); clearFrame.WrapFormat.Style = WrapStyle.TopBottom; clearFrame.LineFormat.Width = 0; document.LastSection.Add(clearFrame); }
/// <summary> /// Loads the specified control. /// </summary> /// <param name="control">The control.</param> /// <param name="action">The action.</param> /// <param name="value">The value.</param> /// <param name="pathTrail">The path trail.</param> public new void Load(ControlList control, String action, String value, String pathTrail) { switch (action) { case "tree": LoadTree(control, value, pathTrail); break; case "page": LoadPage(control, value, pathTrail); break; case "elementlist": LoadElementList(control); break; case "pagestatus": LoadPageStatus(control); break; case "security": LoadPageSecurity(control); break; } }
/// <summary> /// Creates a new controller from the given node. /// </summary> /// <param name="validator">The validator to use for validation.</param> /// <param name="node">The controller node.</param> internal Controller(NodeValidator validator, Node node) : base(validator, node) { if (!string.IsNullOrEmpty(node.Tag)) { uuid = new Guid(node.Tag); } if (node.Attributes.ContainsKey(GROUP_ATTRIBUTE)) { group = DeviceGroupHelper.TryParse(node.Attributes[GROUP_ATTRIBUTE]); } foreach (var child in node.Children) { switch (child.Name.ToUpperInvariant()) { case MEMBER_CHILD_NODE: members.AddLast(new Member(validator, child)); break; case CONTROLS_CHILD_NODE: controls = new ControlList(validator, child); break; case SHIFTS_CHILD_NODE: shifts = new ShiftList(validator, child); break; } } }
/// <summary> /// Converts <paramref name="results"/> to a list of anonymous objects. /// </summary> /// <param name="results">The validation results to convert.</param> /// <param name="controlList">The control metadata list.</param> /// <param name="firstError">When the method returns, will contain the earliest control that has an error.</param> /// <returns>A new list of anonymous objects.</returns> public static Dictionary<string, List<string>> ConvertValidationResultsToErrorMessages(ValidationResults results, ControlList controlList, out Control firstError) { int minPos = int.MaxValue; firstError = null; Dictionary<string, List<string>> errors = new Dictionary<string, List<string>>(); foreach (ValidationResult result in results) { string errorKey = Regex.Replace(result.Key, "[" + Regex.Escape(".[") + "\\]]+", "-"); if (!errors.ContainsKey(errorKey)) { errors.Add(errorKey, new List<string>()); } errors[errorKey].Add(result.Message); string controlName = Regex.Match(errorKey, "[a-z0-9_]+$", RegexOptions.IgnoreCase).Value; Control control = controlList.FindRecursive(controlName); if (control == null) { controlName = Regex.Match(errorKey, "[a-z0-9_]+(?=-" + controlName + "$)", RegexOptions.IgnoreCase).Value; control = controlList.FindRecursive(controlName); } if (control.Position < minPos) { minPos = control.Position; firstError = control; } } return errors; }
// Note: ToString() is tested implicitly by Check() private (ITestCollection, ITestCollection) Startup(TestableType testableType, InitType initType) { var initial = initType switch { InitType.Empty => new int[] { }, InitType.Single => new int[] { 1 }, InitType.Asc => new int[] { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 }, InitType.Desc => new int[] { 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5 }, InitType.Mixed => new int[] { 0, 2, -2, 5, -4, 1, 3, -1, -3, 4, -5 }, _ => throw new ArgumentException("Unknown InitType"), }; ITestCollection collection = testableType switch { TestableType.ArrayList => new ArrayList(), TestableType.SortedArrayList => new SortedArrayList(), TestableType.LinkedList => new LinkedList(), TestableType.ArrayStack => new ArrayStack(), TestableType.LinkedQueue => new LinkedQueue(), TestableType.BinarySearchTree => new BinarySearchTree(), _ => throw new ArgumentException("Unknown TestableType"), }; var expected = new ControlList(collection.GetType()); expected.Initialize(initial); collection.Initialize(initial); Check(expected, collection); return(expected, collection); }
public StripMenu(MenuStrip menuStrip, IFactory factory) { _menuStrip = menuStrip; _factory = factory; Controls = new ControlList(menuStrip.Controls, factory); InnerTools = new StripMenuItemsCollection(menuStrip, factory); }
public void BaseTestInitialize() { JsonConvert.DefaultSettings = () => new JsonSerializerSettings { Formatting = Formatting.None, Converters = new JsonConverter[] { new JsonKnownTypeConverter() } }; var container = new UnityContainer().LoadConfiguration(); this.dataAccess = container.Resolve<IDataAccess>(); var formMetadata = this.dataAccess.GetProduct("1000"); var subpageMetadata = this.dataAccess.GetProduct("5000"); this.controlList = formMetadata.FormDefinition.Pages.AllControls; this.subpageControlList = subpageMetadata.FormDefinition.Pages.AllControls; this.validatorList = new RegexValidatorList { new RegexValidator { Id = "1", Regex = "^((\\+\\d{1,3}[\\- ]?)??(\\(?\\d{1,4}\\)?[\\- ])?((?:\\d{0,5})\\d{3,4}[\\- ]?\\d{3,4}))?$", Name = "Phone" } }; IEnumerable<Control> flatControls = this.controlList.Flatten(); this.defaultControlsAccess = new List<ControlAccess>(flatControls.Select(e => new ControlAccess(e.Id, AccessLevel.Write))); }
/// <summary> /// Adds the buttons (and other controls) to the screen in question. /// </summary> public override void InitGui() { ControlList.Clear(); if (Mc.TheWorld.GetWorldInfo().IsHardcoreModeEnabled()) { ControlList.Add(new GuiButton(1, Width / 2 - 100, Height / 4 + 96, StatCollector.TranslateToLocal("deathScreen.deleteWorld"))); } else { ControlList.Add(new GuiButton(1, Width / 2 - 100, Height / 4 + 72, StatCollector.TranslateToLocal("deathScreen.respawn"))); ControlList.Add(new GuiButton(2, Width / 2 - 100, Height / 4 + 96, StatCollector.TranslateToLocal("deathScreen.titleScreen"))); if (Mc.Session == null) { ControlList[1].Enabled = false; } } for (IEnumerator <GuiButton> iterator = ControlList.GetEnumerator(); iterator.MoveNext();) { GuiButton guibutton = iterator.Current; guibutton.Enabled = false; } }
/// <summary> /// Adds the buttons (and other controls) to the screen in question. /// </summary> public override void InitGui() { ControlList.Clear(); //Keyboard.enableRepeatEvents(true); ControlList.Add(new GuiButton(0, Width / 2 - 100, Height / 4 + 120, "Done")); EntitySign.Func_50006_a(false); }
private void HandlePlugin(XmlNode contentNode, string[] args, Process process) { IPlugin provider = GetProvider(contentNode.Attributes["provider"].Value); if (provider != null) { switch (contentNode.Name) { case "load": ControlList control = process.Content.GetSubControl(CommonXml.GetAttributeValue(contentNode, "place")); string action = CommonXml.GetAttributeValue(contentNode, "action"); string value = GetValue(contentNode, process); string pathTrail = JoinPath(Common.RemoveOne(args)); if (provider is IPlugin2) { ((IPlugin2)provider).Load(control, action, value, pathTrail); } else { provider.Load(control, action, pathTrail); } break; case "handle": string mainEvent = process.QueryEvents["main"]; if (mainEvent != "") { provider.Handle(mainEvent); } break; } } }
public void TestControlName() { string json = AssemblyResourceReader.ReadAsString("Test_Data.ValidateRule1.json"); ValidateTruthCondition condition = JsonConvert.DeserializeObject<ValidateTruthCondition>(json); ControlList controlList = new ControlList(); RepeaterControl repeater = new RepeaterControl { Id = 3, Name = "Repeater" }; controlList.Add(repeater); repeater.Controls.Add(new TextControl { Id = 1, Name = "Field1", ParentId = 3 }); repeater.Controls.Add(new TextControl { Id = 2, Name = "Field2", ParentId = 3 }); ApplicationData appData = new ApplicationData(); Dictionary<string, object>[] repeaterData = new Dictionary<string, object>[2]; appData.Add("Repeater", repeaterData); repeaterData[0] = new Dictionary<string, object> { { "Field1", "Is Valid" }, { "Field2", "When Combined With This" } }; repeaterData[1] = new Dictionary<string, object> { { "Field1", "Not Valid" }, { "Field2", "When Combined With This" } }; TruthConditionEvaluatorFactory evaluatorFactory = new TruthConditionEvaluatorFactory(); ITruthConditionValidator validator = new ITruthConditionValidator(condition, controlList, evaluatorFactory); ValidationResults results = validator.Validate(appData); Assert.AreEqual("Repeater[1].Field1", results.ToArray()[0].Key); }
public IList <Control> DeleteSelected() { IList <Control> result = new List <Control>(); foreach (Control control in ControlList) { if (control.IsSelected) { result.Add(control); } else { if (control is LineControl) { LineControl line = control as LineControl; //if (line.Source.IsSelected || line.Target.IsSelected) // result.Add(control); } } } foreach (Control control in result) { ControlList.Remove(control); } return(result); }
public void RepeaterHideRuleReferenceRootControl() { ITruthCondition condition = new HideTruthCondition { RuleType = "HIDE" }; TruthConditionList subRuleList = new TruthConditionList(); CompareDefinition compareDefinition = new CompareDefinition { CompareTo = ComparisonType.Value, Field = "Checkbox", FieldScope = FieldScope.Unknown, Operator = Operator.Equals, Value = "checked" }; subRuleList.Add(new CompareTruthCondition { RuleType = "EVAL", Value = compareDefinition }); condition.Value = subRuleList; ControlList controlList = new ControlList { new CheckboxControl { Name = "Checkbox" } }; RepeaterControl repeater = new RepeaterControl { Name = "Parent" }; repeater.AddChild(new ComboControl { Name = "Child", VisibilityRule = condition }); controlList.Add(repeater); ApplicationData applicationData = new ApplicationData { { "Checkbox", "checked" } }; Dictionary<string, object>[] repeaterValue = new Dictionary<string, object>[1]; repeaterValue[0] = new Dictionary<string, object>(); repeaterValue[0]["Child"] = string.Empty; applicationData.Add("Parent", repeaterValue); ITruthConditionEvaluator<ITruthCondition> evaluator = this.EvaluatorRegister.GetEvaluatorFor<HideTruthCondition>(); bool result = evaluator.Evaluate(condition, controlList, applicationData, null, this.EvaluatorRegister, "Parent[0]"); Assert.IsTrue(result); applicationData["Checkbox"] = string.Empty; result = evaluator.Evaluate(condition, controlList, applicationData, null, this.EvaluatorRegister, "Parent[0]"); Assert.IsFalse(result); }
/// <summary> /// Handles the different root. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> /// <param name="xmlNode">The XML node.</param> private static void HandleDifferentRoot(ControlList control, ref String value, XmlNode xmlNode) { String realName; String treeRootName; if (value.IndexOf("|", StringComparison.Ordinal) > 0) { treeRootName = value.Substring(0, value.IndexOf("|", StringComparison.Ordinal)); value = value.Substring(value.IndexOf("|", StringComparison.Ordinal) + 1); realName = GetTreeRootName(value); } else { treeRootName = GetTreeRootName(value); realName = treeRootName; } XmlDocument ownerDocument = control["sitetree"].OwnerDocument; if (ownerDocument != null) { XmlNode treeNode = ownerDocument.CreateElement(treeRootName); XmlNode copyNode = xmlNode.SelectSingleNode(value); if (copyNode != null) { treeNode.InnerXml = copyNode.InnerXml; } CommonXml.AppendAttribute(treeNode, "realname", realName); control["sitetree"].AppendChild(treeNode); } }
public void WriteDataTest() { // Assumed to be null String outFilePath = Path.Combine(TestContext.TestDir, "TestControlList.json"); FileInfo outFile = new FileInfo(outFilePath); Assert.IsTrue(outFile.Directory.Exists); ControlList controlList = new ControlList(); controlList.Controls.Add(new DataClasses.Controltem { VB6 = "TestVB6", CSharp = "TestCSharp", InvisibleAtRuntime = true, Unsupported = true, }); controlList.WriteData(outFile); Assert.IsTrue(outFile.Exists); String json = File.ReadAllText(outFile.FullName); StringAssert.Contains(json, "VB6"); StringAssert.Contains(json, "TestVB6"); StringAssert.Contains(json, "CSharp"); StringAssert.Contains(json, "TestCSharp"); StringAssert.Contains(json, "InvisibleAtRuntime"); StringAssert.Contains(json, "Unsupported"); }
/// <summary> /// Loads the page. /// </summary> /// <param name="control">The control.</param> /// <param name="value">The value.</param> /// <param name="pathTrail">The path trail.</param> private void LoadPage(ControlList control, string value, string pathTrail) { LoadDay(Process.Content.GetSubControl("basedata")); //ToDo: quick hack not nice string pagePath = GetCurrentPage(GetFullPath(value, pathTrail)); Page page = Tree.GetPage(pagePath); if (page == null) { return; } Process.Attributes["pageroot"] = pagePath.Split('/')[0]; Process.Attributes["pagepath"] = pagePath; Plugins(page); control["page"] = page.Node; Process.Content["templates"] = Process.Settings.GetAsNode("templates"); if (page["template"] != string.Empty && Process.CurrentProcess.Split('/')[0].ToLower() != "admin") { Process.MainTemplate = Process.Settings["templates/" + page["template"]]; } }
public ProgramListControl() { InitializeComponent(); ProgramList = new ControlList <ProgramControl, ProgramSet>(this.processScroll, (prog) => { return(new ProgramControl(prog, CatModel)); }, (prog) => prog.guid.ToString(), (list) => { list.Sort(DoSort); }, (item) => { return(CurFilter != null && FirewallPage.DoFilter(CurFilter, item.progSet)); }); ProgramList.SelectionChanged += (s, e) => { SelectionChanged?.Invoke(this, e); }; SuspendChange++; //this.rbbSort.Header = Translate.fmt("lbl_sort_and"); this.lblSort.Content = Translate.fmt("lbl_sort"); //this.chkNoLocal.Content = Translate.fmt("chk_ignore_local"); //this.chkNoLan.Content = Translate.fmt("chk_ignore_lan"); WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_no"), Sorts.Unsorted); WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_name"), Sorts.Name); WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_rname"), Sorts.NameRev); WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_act"), Sorts.LastActivity); WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_rate"), Sorts.DataRate); WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_socks"), Sorts.SocketCount); WpfFunc.CmbAdd(cmbSort, Translate.fmt("sort_count"), Sorts.ModuleCount); WpfFunc.CmbSelect(cmbSort, ((Sorts)App.GetConfigInt("GUI", "SortList", 0)).ToString()); this.chkNoLocal.IsChecked = App.GetConfigInt("GUI", "ActNoLocal", 0) == 1; this.chkNoLan.IsChecked = App.GetConfigInt("GUI", "ActNoLan", 0) == 1; SuspendChange--; }
/// <summary> /// Adds the buttons (and other controls) to the screen in question. /// </summary> public override void InitGui() { base.InitGui(); StringTranslate stringtranslate = StringTranslate.GetInstance(); ControlList.Add(new GuiButton(1, Width / 2 - 100, Height - 40, stringtranslate.TranslateKey("multiplayer.stopSleeping"))); }
public void AdministratorDefaultToWriteAccess() { Application application = new Application { FormId = "form-1", OrganisationId = "org-1", WorkflowState = "New" }; User user = new User { Id = "administrator-1", Roles = new Dictionary<string, string> { { "role-1", "role-1" }, { "Administrators", "Administrators" } } }; user.Organisations.Add("org-1", "Organisation One"); var controlsList = new ControlList { new TextControl { Id = 1 } }; AccessLevel applicationAccess = this.provider.GetApplicationAccess(new SecureSession(user), application, this.roleList, 1); List<ControlAccess> controlsAccess = this.provider.GetControlsAccess(new SecureSession(user), application, controlsList, this.roleList, 1); Assert.AreEqual(AccessLevel.Write, applicationAccess); Assert.AreEqual(AccessLevel.Write, controlsAccess[0].AccessLevel); }
/// <summary> /// Adds the buttons (and other controls) to the screen in question. /// </summary> public override void InitGui() { StringTranslate stringtranslate = StringTranslate.GetInstance(); ControlList.Clear(); ControlList.Add(new GuiButton(0, Width / 2 - 100, Height / 4 + 120 + 12, stringtranslate.TranslateKey("gui.toMenu"))); }
public RelativePanel() { //AutoScroll = true; _Children = new ControlList(base.Controls); //base.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) //| System.Windows.Forms.AnchorStyles.Left) //| System.Windows.Forms.AnchorStyles.Right))); }
/// <summary> /// Renders <paramref name="control"/> to the <paramref name="document"/>. /// </summary> /// <param name="document">The PDF document.</param> /// <param name="control">The control to be rendered.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> /// <param name="controlList">The complete control list.</param> protected override void DoRender(Document document, Control control, int level, ControlList controlList) { var indent = new Unit(PdfConstants.IndentMultiplier * level, UnitType.Millimeter); Shape shape = this.AddDefaultShape(document); shape.Width = shape.Width - indent; shape.Left = indent; shape.Height = shape.Height * 4; }
public Flow() { AutoScroll = true; FlowDirection = System.Windows.Forms.FlowDirection.LeftToRight; WrapContents = false; _Children = new ControlList(base.Controls); }
/// <summary> /// Adds the buttons (and other controls) to the screen in question. /// </summary> public override void InitGui() { StringTranslate stringtranslate = StringTranslate.GetInstance(); ControlList.Add(DoneButton = new GuiSmallButton(6, Width / 2 - 75, Height - 38, stringtranslate.TranslateKey("gui.done"))); LanguageList = new GuiSlotLanguage(this); LanguageList.RegisterScrollButtons(ControlList, 7, 8); }
public Stack() { Children = new ControlList(this); InnerGrid = new Grid(); ((IGrid)InnerGrid).ColumnCount = 1; base.Controls.Add(InnerGrid); }
public void DisposePopupAction() { if (_p_action != null) { _p_action.Dispose(); _p_action = null; } }
/// <summary> /// Adds the buttons (and other controls) to the screen in question. /// </summary> public override void InitGui() { LoadServerList(); //Keyboard.enableRepeatEvents(true); ControlList.Clear(); ServerSlotContainer = new GuiSlotServer(this); InitGuiControls(); }
public MainWindowViewModel() { AppControlManager.AppPages.ForEach(c => ControlList.Add(c)); if (ControlList != null) { SelectedControl = ControlList.FirstOrDefault(); } }
public Stack() { AutoScroll = true; FlowDirection = System.Windows.Forms.FlowDirection.TopDown; WrapContents = false; _Children = new ControlList(base.Controls); }
/// <summary> /// Renders <paramref name="control"/> to the <paramref name="document"/>. /// </summary> /// <param name="document">The PDF document.</param> /// <param name="control">The control to be rendered.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> /// <param name="controlList">The complete control list.</param> protected override void DoRender(Document document, Control control, int level, ControlList controlList) { HeadingControl headingControl = control as HeadingControl; string style = headingControl == null ? StyleNames.Normal : string.Format("Heading{0}", headingControl.Level); IControlWithContent contentControl = (IControlWithContent)control; Paragraph contentParagraph = document.LastSection.AddParagraph(contentControl.Content ?? string.Empty, style); contentParagraph.Format.LeftIndent = new Unit(PdfConstants.IndentMultiplier * level, UnitType.Millimeter); }
/// <summary> /// Renders <paramref name="controls"/> to a document. /// </summary> /// <param name="controls">The controls to be rendered.</param> /// <param name="factory">The renderer factory.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> /// <param name="allControls">The complete control list.</param> internal void Render(ControlList controls, ControlRendererFactory factory, int level, ControlList allControls) { IEnumerable<Control> orderedControls = controls.Where(c => this.controlsAccess.FirstOrDefault(a => a.ControlId == c.Id).AccessLevel == AccessLevel.Write).OrderBy(c => c.Position); foreach (Control control in orderedControls) { var renderer = factory.GetControlRenderer(control); renderer.Render(this.document, control, level, allControls); } }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationWorkflowItem"/> class. /// </summary> /// <param name="postedApplication">The updated <see cref="Application"/> containing /// the posted <see cref="ApplicationData"/>.</param> /// <param name="existingData">The existing <see cref="ApplicationData"/>. Defaults to <see langword="null"/>.</param> /// <param name="controlList">The controls. Defaults to <see langword="null"/>.</param> public ApplicationWorkflowItem(Application postedApplication, ApplicationData existingData = null, ControlList controlList = null) : this(postedApplication.FormId, postedApplication.LastEditBy) { this.ApplicationId = postedApplication.ApplicationId; this.VersionNumber = postedApplication.VersionNumber; this.PostedData = postedApplication.ApplicationData; this.ExistingData = existingData; this.ControlList = controlList; }
private void LoadUser(ControlList control, string value) { Users users = new Users(Process); if (value != null && users.UserList[value] != null) { control["user"].InnerXml = users.UserList[value].Node.InnerXml; } }
/// <summary> /// Recurses up through the control tree and adds any repeater controls to <paramref name="path"/>. /// </summary> /// <param name="control">The control which acts as the this instance.</param> /// <param name="controlList">The control list.</param> /// <param name="path">A <see cref="ApplicationDataPath"/> to update.</param> private static void CreatePathTemplate(this Control control, ControlList controlList, ApplicationDataPath path) { Control parent = control.GetRepeaterAncestor(controlList); if (parent != null) { path.Prepend(parent.Name); parent.CreatePathTemplate(controlList, path); } }
public new void Load(ControlList control, string action, string value, string pathTrail) { switch (action) { case "adminmenu": LoadMenu(control); break; } }
public new void Load(ControlList control, string action, string value, string pathTrail) { switch (action) { case "log": HandleLog(); break; } }
/// <summary> /// Resize the job controls. /// </summary> private void _resizeControls() { ControlList controls = this.ControlsCopy; foreach (System.Windows.Forms.Control control in controls) { this._resizeControl(control as CadKit.Threads.GUI.Job); } }
public new void Load(ControlList control, String action, String value, String pathTrail) { switch (action) { case "cookie": LoadCookies(control); break; } }
/// <summary> /// Loads the specified control. /// </summary> /// <param name="control">The control.</param> /// <param name="action">The action.</param> /// <param name="value">The value.</param> /// <param name="pathTrail">The path trail.</param> public new void Load(ControlList control, string action, string value, string pathTrail) { switch (action) { case "list": Loadlist(); break; } }
internal static ControlList CreateControlList() { ControlList list = new ControlList(); int id = 1; IEnumerable<JsonKnownTypeAttribute> knownTypeAttrs = typeof(Control).GetCustomAttributes<JsonKnownTypeAttribute>(); foreach (Control instance in knownTypeAttrs.Select(attr => Activator.CreateInstance(attr.KnownType)).OfType<Control>()) { instance.Id = id++; instance.Name = string.Format("Control{0}", instance.Id); list.Add(instance); } return list; }
/// <summary> /// Renders <paramref name="control"/> to the <paramref name="document"/>. /// </summary> /// <param name="document">The PDF document.</param> /// <param name="control">The control to be rendered.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> /// <param name="controlList">The complete control list.</param> protected override void DoRender(Document document, Control control, int level, ControlList controlList) { this.Label.Style = StyleNames.Heading2; RepeaterControl repeater = (RepeaterControl)control; level++; Paragraph template = this.Label; for (int i = 1; i <= (repeater.MaximumCount ?? PdfConstants.DefaultRepeaterLength); i++) { Paragraph itemHeader = template.Clone(); itemHeader.Style = StyleNames.Heading3; itemHeader.AddText(" " + i); itemHeader.Format.LeftIndent = new Unit(PdfConstants.IndentMultiplier * level, UnitType.Millimeter); document.LastSection.Add(itemHeader); this.ListRenderer.Render(repeater.Controls, this.Factory, level, controlList); } }
/// <summary> /// Converts a <see cref="LikertControl"/> to a <see cref="ControlList"/> of /// <see cref="RadioControl"/>s, which can then be each question as a radio /// in PDFs. /// </summary> /// <param name="control">The control to convert.</param> /// <returns>A <see cref="ControlList"/> of <see cref="RadioControl"/>s.</returns> /// <remarks> /// Each <see cref="RadioControl"/> in the returned <see cref="ControlList"/> /// represents a single <see cref="ControlSubField"/> question from the /// <paramref name="control"/>. /// </remarks> internal static ControlList ToProxyControlList(this LikertControl control) { ControlValueOptionList optionList = control.Scale != null ? control.Scale.ToOptionList() : new ControlValueOptionList(); ControlList proxyControlList = new ControlList(); foreach (ControlSubField item in control.Questions ?? new ControlSubFieldList()) { proxyControlList.Add(new RadioControl { Id = control.Id, Name = item.Name, OptionValues = optionList, Label = item.Label }); } return proxyControlList; }
public List<ControlAccess> GetControlsAccess( SecureSession session, Application application, ControlList controlList, RoleList roleList, int versionNumber, AccessLevel? defaultAccessLevel = null) { string resourceString; if (AssemblyResourceReader.TryReadAsString(string.Format("Test_Data.ControlPermissions.FORM-{0}-USER-{1}.json", application.FormId.PadLeft(2, '0'), session.AuthenticatedUser.Id), out resourceString)) { var entitlements = JsonConvert.DeserializeObject<ControlEntitlementList>(resourceString); entitlements.Merge(); return new List<ControlAccess>(entitlements.Select(e => new ControlAccess(e.ControlId, e.AccessLevel))); } return new List<ControlAccess>(); }
public void TestEmptyRepeaterBusinessRule() { string json = AssemblyResourceReader.ReadAsString("Test_Data.ValidateRule1.json"); ValidateTruthCondition condition = JsonConvert.DeserializeObject<ValidateTruthCondition>(json); ControlList controlList = new ControlList(); RepeaterControl repeater = new RepeaterControl { Id = 3, Name = "Repeater" }; controlList.Add(repeater); repeater.Controls.Add(new TextControl { Id = 1, Name = "Field1", ParentId = 3 }); repeater.Controls.Add(new TextControl { Id = 2, Name = "Field2", ParentId = 3 }); ApplicationData appData = new ApplicationData(); TruthConditionEvaluatorFactory evaluatorFactory = new TruthConditionEvaluatorFactory(); ITruthConditionValidator validator = new ITruthConditionValidator(condition, controlList, evaluatorFactory); ValidationResults results = validator.Validate(appData); Assert.AreEqual(true, results.IsValid); }
/// <summary> /// Renders <paramref name="control"/> to the <paramref name="document"/>. /// </summary> /// <param name="document">The PDF document.</param> /// <param name="control">The control to be rendered.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> /// <param name="controlList">The complete control list.</param> protected override void DoRender(Document document, Control control, int level, ControlList controlList) { IControlWithOptions controlWithOptions = control as IControlWithOptions; string suffix = string.Format(" {0}", controlWithOptions.AllowMultipleSelect ? PdfResources.SelectAll : PdfResources.SelectOne); FormattedText formattedSuffix = new FormattedText { Style = StyleNames.Normal, Italic = true }; formattedSuffix.AddText(suffix); this.Label.Add(formattedSuffix); foreach (var option in controlWithOptions.OptionValues ?? new ControlValueOptionList()) { Paragraph paragraph = document.LastSection.AddParagraph(); FormattedText checkboxText = this.CreateEmptyCheckbox(document.Styles[StyleNames.Normal]); paragraph.Format.LeftIndent = new Unit(PdfConstants.IndentMultiplier * level, UnitType.Millimeter); paragraph.Add(checkboxText); paragraph.AddText(option.Description); } }
/// <summary> /// Renders <paramref name="control"/> to the <paramref name="document"/>. /// </summary> /// <param name="document">The PDF document.</param> /// <param name="control">The control to be rendered.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> /// <param name="controlList">The complete control list.</param> protected override void DoRender(Document document, Control control, int level, ControlList controlList) { IControlWithOptions controlWithOptions = control as IControlWithOptions; string suffix = string.Format(" {0}", controlWithOptions.AllowMultipleSelect ? PdfResources.IndicateAll : PdfResources.IndicateOne); FormattedText formattedSuffix = new FormattedText { Style = StyleNames.Normal, Italic = true }; formattedSuffix.AddText(suffix); this.Label.Add(formattedSuffix); RepeaterOptionSource optionSource = controlWithOptions.OptionSource as RepeaterOptionSource; RepeaterControl repeater = controlList.FindRecursive<RepeaterControl>(optionSource.RepeaterName); ControlList valueList = new ControlList(); valueList.AddRange(optionSource.ValueFields.Select(valueField => repeater.Controls.FindRecursive<Control>(valueField))); for (int i = 1; i <= (repeater.MaximumCount ?? PdfConstants.DefaultRepeaterLength); i++) { this.ListRenderer.Render(valueList, this.Factory, level, controlList); } }
public CharacterCreator(ControlForm Form, CharakterErstellungsDaten Daten) { this.Universe = Daten.Universe; this.Form = Form; this.Data = new ManifestData(Universe); Desc = CreateLabel(""); ScrollDesc = new ScrollBox(Desc); ScrollDesc.Top = 20; ScrollDesc.Left = 20; Controls.Add(ScrollDesc); Liste = new ControlList(); Liste.Align = 1f; Liste.Location = new Point(50, 10); ScrollBox = new ScrollBox(Liste); ScrollBox.Top = 20; Controls.Add(ScrollBox); Werte = new List<CharakterWertControl>(); NeedSpeicherort = new List<Control>(); MakeSaveOpenDialogs(); }
/// <summary> /// Recursively initialises a control list. /// </summary> /// <param name="container">The container to initialise.</param> /// <param name="controlList">The control list.</param> private void InitControlList(Dictionary<string, object> container, ControlList controlList) { var controls = controlList.Flatten().OfType<IControlWithDefaultValue>().Cast<ValueControl>(); foreach (var valueControl in controls) { if (valueControl != null) { var initialValue = this.GetInitialControlValue(valueControl); var stringValue = initialValue as string; if (stringValue != null && stringValue == string.Empty) { continue; } var enumerable = initialValue as IEnumerable<object>; if (enumerable != null && !enumerable.Any()) { continue; } container.Add(valueControl.Name, initialValue); } } }
public LobbyWindow(Manager manager) : base(manager) { //Setup the window CaptionVisible = false; TopPanel.Visible = false; Movable = false; Resizable = false; Width = 700; Height = 500; Shadow = true; Center(); //Group panels grpLobby = new GroupPanel(Manager) { Width = ClientWidth / 2, Height = ClientHeight - BottomPanel.Height + 2, Text = "Rooms" }; grpLobby.Init(); Add(grpLobby); grpServer = new GroupPanel(Manager) { Left = (ClientWidth / 2) - 1, Width = (ClientWidth / 2) + 1, Height = ClientHeight - BottomPanel.Height + 2, Text = "Server" }; grpServer.Init(); Add(grpServer); //Top controls txtSearch = new TextBox(Manager) { Left = 8, Top = 8, Width = (ClientWidth / 4) - 16, }; txtSearch.Init(); txtSearch.Text = searchStr; txtSearch.TextChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { RefreshRooms(); }); //Show "Search..." text, but make it dissapear on focus txtSearch.FocusGained += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { if (txtSearch.Text.Trim() == searchStr) txtSearch.Text = string.Empty; }); txtSearch.FocusLost += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { if (txtSearch.Text.Trim() == string.Empty) txtSearch.Text = searchStr; }); grpLobby.Add(txtSearch); cmbSort = new ComboBox(Manager) { Left = txtSearch.Right + 8, Top = 8, Width = (ClientWidth / 4) - 16 - 20, }; cmbSort.Init(); cmbSort.Items.AddRange(sortFilters); cmbSort.ItemIndex = 0; cmbSort.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { RefreshRooms(); }); grpLobby.Add(cmbSort); btnReload = new Button(Manager) { Left = cmbSort.Right + 8, Top = 8, Width = 20, Height = 20, Text = string.Empty, }; btnReload.Init(); btnReload.Glyph = new Glyph(ContentPack.Textures["gui\\icons\\refresh"]); btnReload.ToolTip.Text = "Refresh"; btnReload.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { Game.NetManager.Send(new RequestMessage(MessageTypes.Lobby)); }); grpLobby.Add(btnReload); //Main room list RoomListCtrl = new ControlList<LobbyDataControl>(Manager) { Left = 8, Top = txtSearch.Bottom + 8, Width = grpLobby.Width - 16, Height = grpLobby.Height - 16 - txtSearch.Bottom - 24 }; RoomListCtrl.Init(); grpLobby.Add(RoomListCtrl); //Server info labels lblName = new Label(Manager) { Text = "Loading...", Top = 8, Font = FontSize.Default20, Left = 8, Alignment = Alignment.MiddleCenter, Height = 30, Width = grpServer.ClientWidth - 16 }; lblName.Init(); grpServer.Add(lblName); lblDescription = new Label(Manager) { Text = string.Empty, Top = 8 + lblName.Bottom, Left = 8, Alignment = Alignment.MiddleCenter, Width = grpServer.ClientWidth - 16 }; lblDescription.Init(); grpServer.Add(lblDescription); lblInfo = new Label(Manager) { Text = string.Empty, Top = 8 + lblDescription.Bottom, Left = 8, Alignment = Alignment.TopLeft, Width = grpServer.ClientWidth - 16, Height = grpServer.Height }; lblInfo.Init(); grpServer.Add(lblInfo); //Bottom buttons btnCreate = new Button(Manager) { Top = 8, Text = "Create" }; btnCreate.Left = (ClientWidth / 2) - (btnCreate.Width / 2); btnCreate.Init(); btnCreate.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { CreateWorldDialog window = new CreateWorldDialog(manager, this); window.Init(); Manager.Add(window); window.Show(); }); BottomPanel.Add(btnCreate); btnJoin = new Button(Manager) { Right = btnCreate.Left - 8, Top = 8, Text = "Join" }; btnJoin.Init(); btnJoin.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { JoinRoom(RoomListCtrl.ItemIndex); }); BottomPanel.Add(btnJoin); btnDisconnect = new Button(Manager) { Left = btnCreate.Right + 8, Top = 8, Text = "Quit" }; btnDisconnect.Init(); btnDisconnect.Click += new TomShane.Neoforce.Controls.EventHandler(delegate(object o, TomShane.Neoforce.Controls.EventArgs e) { Game.NetManager.Disconnect("Left Lobby"); Game.CurrentGameState = GameState.Login; Interface.MainWindow.ScreenManager.SwitchScreen(new LoginScreen()); }); BottomPanel.Add(btnDisconnect); //When finished, request server send lobby data Game.NetManager.Send(new RequestMessage(MessageTypes.Lobby)); }
/// <summary> /// Initializes a new instance of the <see cref="RepeaterValidator"/> class. /// </summary> /// <param name="allControls">The list of all controls.</param> /// <param name="wrappedValidator">The wrapped validator that does the actual validation.</param> /// <param name="controlName">The name of the control validated by the current instance.</param> public RepeaterValidator(ControlList allControls, Validator wrappedValidator, string controlName) : base(allControls, wrappedValidator, controlName) { }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationDataInitialiser"/> class. /// </summary> /// <param name="controlList">The control list used to initialise applications.</param> public ApplicationDataInitialiser(ControlList controlList) { this.controlList = controlList; }
public Stack() { _Children = new ControlList(base.Children); }
/// <summary> /// Renders <paramref name="control"/> to the <paramref name="document"/>. /// </summary> /// <param name="document">The PDF document.</param> /// <param name="control">The control to be rendered.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> /// <param name="controlList">The complete control list.</param> protected override void DoRender(Document document, Control control, int level, ControlList controlList) { this.Label.Format.LeftIndent = new Unit(PdfConstants.IndentMultiplier * level, UnitType.Millimeter); this.Label.Elements.InsertObject(0, this.CreateEmptyCheckbox(document.Styles[StyleNames.Normal])); }
public void EmailUserWithPdf() { MailQueue queue = new MailQueue(); EventActionEmailResponseHandler handler = new EventActionEmailResponseHandler(null, queue, null, new StringFormatter("{%", "%}"), new EmailTokenFormatter("{%", "%}"), new SummaryFormatter("{%", "%}"), new ApplicationPdfWriter(), string.Format("{0}/iapply.pdf", System.IO.Path.GetTempPath()), "*****@*****.**") { Roles = this.roleList, GetUsersFn = this.getUserFn, SystemSettings = this.systemSettings }; this.action.AttachPdf = true; this.application.ApplicationData.Add("Test", "Test"); this.recipientList.Users.Add("user-1"); ControlList controlList = new ControlList(); TextControl textControl = new TextControl { Name = "Test", Label = "Test" }; controlList.Add(textControl); PageList pages = new PageList { new UserPage { Controls = controlList } }; EventResult result = handler.Handle(null, this.action, this.application, pages, this.getApplicationAccessFn); Assert.IsTrue(result.Processed); MailMessageSerializable message = queue.Dequeue().Message as MailMessageSerializable; Assert.AreEqual(1, message.To.Count); Assert.AreEqual("*****@*****.**", message.To[0].Address); Assert.AreEqual("*****@*****.**", message.Sender.Address); Assert.AreEqual(1, message.Attachments.Count); Assert.AreEqual(this.action.Subject, message.Subject); }
/// <summary> /// Renders <paramref name="control" /> to the <paramref name="document" />. /// </summary> /// <param name="document">The PDF document.</param> /// <param name="control">The control to be rendered.</param> /// <param name="level">The depth down the control tree being rendered (affects indenting).</param> /// <param name="controlList">The complete control list.</param> public void Render(Document document, Control control, int level, ControlList controlList) { }
/// <summary> /// Initializes a new instance of the <see cref="CustomValidatorBase"/> class. /// </summary> /// <param name="allControls">The list of all controls.</param> protected CustomValidatorBase(ControlList allControls) : base(string.Empty, string.Empty) { this.AllControls = allControls; }
/// <summary> /// Creates a <see cref="ApplicationDataPath"/> template - with default indices - /// for <paramref name="control"/>. /// </summary> /// <param name="control">The control which acts as the this instance.</param> /// <param name="controlList">The control list.</param> /// <returns>A <see cref="ApplicationDataPath"/> template - with default indices - /// for <paramref name="control"/>.</returns> public static ApplicationDataPath CreatePathTemplate(this Control control, ControlList controlList) { ApplicationDataPath path = new ApplicationDataPath(); control.CreatePathTemplate(controlList, path); return path; }