public GridCommand(string href, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) : base(href, parsingMode, parsingOptions, docType) { Attr("data-command-type", "default"); _icon = new CommonElement(HtmlTag.I); Append(_icon); }
private void InitGridCommands() { var commandContainer = Find(ToSelector(Theme.CommandContainer)); var gridCommandContainer = commandContainer.Find(ToSelector(Theme.GridCommandContainer)); if (!gridCommandContainer.Any()) { gridCommandContainer = new CommonElement(HtmlTag.Span) { Class = Theme.GridCommandContainer }; commandContainer.Append(gridCommandContainer); } if (Commands == null) { Commands = new ObservableCollection <GridCommand>(); Commands.CollectionChanged += (sender, e) => { gridCommandContainer.Empty(); foreach (var command in Commands) { gridCommandContainer.Append(command.AddClass(Theme.GridCommandButton)); } }; } }
public NumericTextbox(string name, NumericTheme theme = null, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default) : base(HtmlTag.Div, parsingMode, parsingOptions, docType) { if (theme == null) { theme = DefaultTheme; } Target = name.StartsWith("#") ? name : "#" + name; Attr("data-toggle", "numeric"); AddClass(theme.Wrapper); _displayInput = new TextBox(); Append(_displayInput.AddClass(theme.Input)); _valueInput = new HiddenField { Name = name, Id = name }; Append(_valueInput); _increaseButton = new Button(); _increaseIcon = new CommonElement(HtmlTag.I); _increaseButton.AddClass(theme.IncreaseButton).Append(_increaseIcon.AddClass(theme.IncreaseIcon)); _decreaseButton = new Button(); _decreaseIcon = new CommonElement(HtmlTag.I); _decreaseButton.AddClass(theme.DecreaseButton).Append(_decreaseIcon.AddClass(theme.DecreaseIcon)); _addon = new CommonElement(HtmlTag.Span); _addon.AddClass(theme.Addon).Append(_increaseButton).Append(_decreaseButton); Append(_addon); }
/// <summary>Loads all the <see cref="Vertex"/>-s from the <see cref="List{T}"/> of <see cref="CommonElement"/>-s.</summary> /// <param name="elements">The <see cref="List{T}"/> of <see cref="CommonElement"/>-s from which all the <see cref="Vertex"/>-s are taken.</param> /// <remarks>When a <see cref="CommonElement"/> is used, it is also removed from the list.</remarks> private void LoadVertices(List <CommonElement> elements) { for (int i = elements.Count - 1; i >= 0; i--) { CommonElement elmn = elements[i]; if (elmn.GetStylePropertyValue("ellipse") != null) { Vertices.Add(new Vertex(elmn.Node, elmn.StyleProperties)); elements.RemoveAt(i); } } }
/// <summary>Loads all the <see cref="Text"/>-s from the <see cref="List{T}"/> of <see cref="CommonElement"/>-s.</summary> /// <param name="elements">The <see cref="List{T}"/> of <see cref="CommonElement"/>-s from which all the <see cref="Text"/>-s are taken.</param> /// <remarks>When a <see cref="CommonElement"/> is used, it is also removed from the list.</remarks> private void LoadTexts(List <CommonElement> elements) { for (int i = elements.Count - 1; i >= 0; i--) { CommonElement elmn = elements[i]; if (elmn.GetStylePropertyValue("text") != null) { Texts.Add(new Text( elmn.Node, elmn.StyleProperties, GetEdgeById(elmn.GetAttributeInnerText("parent")))); elements.RemoveAt(i); Root.RemoveChild(elmn.Node); } } }
/// <summary>Loads all the <see cref="Edge"/>-s from the <see cref="List{T}"/> of <see cref="CommonElement"/>-s.</summary> /// <param name="elements">The <see cref="List{T}"/> of <see cref="CommonElement"/>-s from which all the <see cref="Edge"/>-s are taken.</param> /// <remarks>When a <see cref="CommonElement"/> is used, it is also removed from the list.</remarks> private void LoadEdges(List <CommonElement> elements) { for (int i = elements.Count - 1; i >= 0; i--) { CommonElement elmn = elements[i]; if (elmn.GetAttributeInnerText("edge") != null) { Edges.Add(new Edge( elmn.Node, elmn.StyleProperties, GetVertexById(elmn.GetAttributeInnerText("source")), GetVertexById(elmn.GetAttributeInnerText("target")))); elements.RemoveAt(i); } } }
// This method is necessary when the CommandSink attached property is set on an element // in a template, or any other situation in which the element's CommandBindings have not // yet had a chance to be created and added to its CommandBindings collection. static bool ConfigureDelayedProcessing(DependencyObject depObj, ICommandSink commandSink) { bool isDelayed = false; CommonElement elem = new CommonElement(depObj); if (elem.IsValid && !elem.IsLoaded) { RoutedEventHandler handler = null; handler = delegate { elem.Loaded -= handler; ProcessCommandSinkChanged(depObj, commandSink); }; elem.Loaded += handler; isDelayed = true; } return isDelayed; }
// This method is necessary when the CommandSink attached property is set on an element // in a template, or any other situation in which the element's CommandBindings have not // yet had a chance to be created and added to its CommandBindings collection. static bool ConfigureDelayedProcessing(DependencyObject depObj, ICommandSink commandSink) { bool isDelayed = false; CommonElement elem = new CommonElement(depObj); if (elem.IsValid && !elem.IsLoaded) { RoutedEventHandler handler = null; handler = delegate { elem.Loaded -= handler; ProcessCommandSinkChanged(depObj, commandSink); }; elem.Loaded += handler; isDelayed = true; } return(isDelayed); }
static CommandBindingCollection GetCommandBindings(DependencyObject depObj) { var elem = new CommonElement(depObj); return elem.IsValid ? elem.CommandBindings : null; }
private static bool ConfigureDelayedProcessing(DependencyObject depObj, RoutedCommands routedCommands) { var isDelayed = false; var elem = new CommonElement(depObj); if (elem.IsValid && !elem.IsLoaded) { RoutedEventHandler handler = null; handler = delegate { elem.Loaded -= handler; ProcessRoutedCommandsChanged(depObj, routedCommands); }; elem.Loaded += handler; isDelayed = true; } return isDelayed; }
/// <summary> /// Creates a well formed working order document object model from fragments of data. /// </summary> /// <param name="userId">A list of items to be included in the DOM.</param> public MatchHistoryDocument(FragmentList fragmentList) { try { // Lock the tables System.Diagnostics.Debug.Assert(!ClientMarketData.IsLocked); ClientMarketData.BlotterLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.SourceOrderLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.DestinationOrderLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.ExecutionLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.MatchLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.ObjectLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.ObjectTreeLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.OrderTypeLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.PriceTypeLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.PriceLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.SecurityLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.StatusLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.StylesheetLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.TimeInForceLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.UserLock.AcquireReaderLock(CommonTimeout.LockWait); ClientMarketData.WorkingOrderLock.AcquireReaderLock(CommonTimeout.LockWait); // The root of the fragment document. XmlNode fragmentNode = this.AppendChild(this.CreateElement("Fragment")); // The insert, update and delete elements are only included only when there is data in those sections. XmlNode insertNode = null; XmlNode updateNode = null; XmlNode deleteNode = null; foreach (Fragment fragment in fragmentList) { // The generic record in the fragment is cast here to a WorkingOrderRow. By design, this is the only type of // record that will be placed into the FragmentList. ClientMarketData.MatchRow matchRow = (ClientMarketData.MatchRow)fragment.Row; // Insert, Update or Delete the fragment. switch (fragment.DataAction) { case DataAction.Insert: // The 'insert' element is optional until there is something to insert. if (insertNode == null) { insertNode = fragmentNode.AppendChild(this.CreateElement("Insert")); } // Insert the record. insertNode.AppendChild(new MatchElement(this, matchRow, FieldArray.Set)); break; case DataAction.Update: // The 'update' element is optional until there is something to update. if (updateNode == null) { updateNode = fragmentNode.AppendChild(this.CreateElement("Update")); } // Update individual properties of the record. updateNode.AppendChild(new MatchElement(this, matchRow, fragment.Fields)); break; case DataAction.Delete: // The 'delete' element is optional until there is something to delete. if (deleteNode == null) { deleteNode = fragmentNode.AppendChild(this.CreateElement("Delete")); } // The original record can't be used (because it has been deleted, duh). A key is constructed from the data // stored in the fragment list. CommonElement commonElement = new CommonElement("Match", this); commonElement.AddAttribute("MatchId", (int)fragment.Key[0]); deleteNode.AppendChild(commonElement); break; } } } catch (Exception exception) { // Write the error and stack trace out to the event log. EventLog.Error("{0}, {1}", exception.Message, exception.StackTrace); } finally { // Release the table locks. if (ClientMarketData.BlotterLock.IsReaderLockHeld) { ClientMarketData.BlotterLock.ReleaseReaderLock(); } if (ClientMarketData.SourceOrderLock.IsReaderLockHeld) { ClientMarketData.SourceOrderLock.ReleaseReaderLock(); } if (ClientMarketData.DestinationOrderLock.IsReaderLockHeld) { ClientMarketData.DestinationOrderLock.ReleaseReaderLock(); } if (ClientMarketData.ExecutionLock.IsReaderLockHeld) { ClientMarketData.ExecutionLock.ReleaseReaderLock(); } if (ClientMarketData.MatchLock.IsReaderLockHeld) { ClientMarketData.MatchLock.ReleaseReaderLock(); } if (ClientMarketData.ObjectLock.IsReaderLockHeld) { ClientMarketData.ObjectLock.ReleaseReaderLock(); } if (ClientMarketData.ObjectTreeLock.IsReaderLockHeld) { ClientMarketData.ObjectTreeLock.ReleaseReaderLock(); } if (ClientMarketData.OrderTypeLock.IsReaderLockHeld) { ClientMarketData.OrderTypeLock.ReleaseReaderLock(); } if (ClientMarketData.PriceTypeLock.IsReaderLockHeld) { ClientMarketData.PriceTypeLock.ReleaseReaderLock(); } if (ClientMarketData.PriceLock.IsReaderLockHeld) { ClientMarketData.PriceLock.ReleaseReaderLock(); } if (ClientMarketData.SecurityLock.IsReaderLockHeld) { ClientMarketData.SecurityLock.ReleaseReaderLock(); } if (ClientMarketData.StatusLock.IsReaderLockHeld) { ClientMarketData.StatusLock.ReleaseReaderLock(); } if (ClientMarketData.StylesheetLock.IsReaderLockHeld) { ClientMarketData.StylesheetLock.ReleaseReaderLock(); } if (ClientMarketData.TimeInForceLock.IsReaderLockHeld) { ClientMarketData.TimeInForceLock.ReleaseReaderLock(); } if (ClientMarketData.UserLock.IsReaderLockHeld) { ClientMarketData.UserLock.ReleaseReaderLock(); } if (ClientMarketData.WorkingOrderLock.IsReaderLockHeld) { ClientMarketData.WorkingOrderLock.ReleaseReaderLock(); } System.Diagnostics.Debug.Assert(!ClientMarketData.IsLocked); } }
public BasePage() { commonElement = new CommonElement(); dropdownControl = new DropdownControl(); }
private void InitPagerCommands() { var commandContainer = Find(ToSelector(Theme.CommandContainer)); var pagerContainer = commandContainer.Find(ToSelector(Theme.PagerContainer)); if (pagerContainer.Any()) { return; } pagerContainer = new CommonElement(HtmlTag.Span) { Class = Theme.PagerContainer }; var firstButton = new Button { Class = Theme.FirstButton, InnerHtml = new CommonElement(HtmlTag.I) { Class = Theme.FirstIcon }.RenderHtml().ToHtmlString() }; var previousButton = new Button { Class = Theme.PreviousButton, InnerHtml = new CommonElement(HtmlTag.I) { Class = Theme.PreviousIcon }.RenderHtml().ToHtmlString() }; var pageIndex = new TextBox { Class = Theme.PageIndex, Value = 1.ToString(CultureInfo.InvariantCulture) }; var total = new CommonElement(HtmlTag.Span) { Class = Theme.Total, InnerText = 1.ToString(CultureInfo.InvariantCulture) }; var pageDisplay = new CommonElement(HtmlTag.Span) { InnerHtml = string.Format(PageDisplay, pageIndex.RenderHtml(), total.RenderHtml()) }; var nextButton = new Button { Class = Theme.NextButton, InnerHtml = new CommonElement(HtmlTag.I) { Class = Theme.NextIcon }.RenderHtml().ToHtmlString() }; var lastButton = new Button { Class = Theme.LastButton, InnerHtml = new CommonElement(HtmlTag.I) { Class = Theme.LastIcon }.RenderHtml().ToHtmlString() }; var pageSizes = new DropdownList { Class = Theme.PageSizes, Items = new ObservableCollection <ListItem>(_pageSizes.Select(item => new ListItem { Value = item.ToString(CultureInfo.InvariantCulture), InnerText = item.ToString(CultureInfo.InvariantCulture) })) }; pagerContainer.Append(firstButton).Append(previousButton).Append(pageDisplay).Append(nextButton).Append(lastButton).Append(pageSizes); commandContainer.Append(pagerContainer); }
/// <summary> /// Recusively builds the XML document from the document outline. /// </summary> /// <param name="parentElement">The parent XML element the node being built.</param> /// <param name="parentSecurity">The parent security.</param> private void BuildDocument(CommonElement parentElement, AppraisalSet.ObjectRow parentObject) { // The code below will test to see if the current node is a sector or security, then create the appropriate // element. The outline doesn't have the full information about the securities, so we need to get a record // into the data model that can reference the security master. ClientMarketData.ObjectRow childObject = ClientMarketData.Object.FindByObjectId(parentObject.ObjectId); // Attach the sectors to this level of the document. foreach (ClientMarketData.SectorRow sectorRow in childObject.GetSectorRows()) { // Create the new sector element and attach it to the document. SectorElement sectorElement = new SectorElement(this, sectorRow); parentElement.InsertBySortOrder(sectorElement); // Recurse down into the children securities looking for more sectors or securities to attach. foreach (AppraisalSet.ObjectTreeRow objectTreeRow in parentObject.GetObjectTreeRowsByFKObjectObjectTreeParentId()) { BuildDocument(sectorElement, objectTreeRow.ObjectRowByFKObjectObjectTreeChildId); } } // Attach the securities to this level of the document. foreach (ClientMarketData.SecurityRow securityRow in childObject.GetSecurityRows()) { // Attach long and short Debts to this level of the document. foreach (ClientMarketData.DebtRow debtRow in securityRow.GetDebtRowsByFKSecurityDebtDebtId()) { foreach (AppraisalSet.SecurityRow driverSecurity in parentObject.GetSecurityRows()) { foreach (AppraisalSet.PositionRow driverPosition in driverSecurity.GetPositionRows()) { parentElement.InsertByName(new DebtElement(this, debtRow, driverPosition)); } } } // Attach long and short Currencies to this level of the document. foreach (ClientMarketData.CurrencyRow currencyRow in securityRow.GetCurrencyRows()) { foreach (AppraisalSet.SecurityRow driverSecurity in parentObject.GetSecurityRows()) { foreach (AppraisalSet.PositionRow driverPosition in driverSecurity.GetPositionRows()) { parentElement.InsertByName(new CurrencyElement(this, currencyRow, driverPosition)); } } } // Attach long and short Equities to this level of the document. foreach (ClientMarketData.EquityRow equityRow in securityRow.GetEquityRowsByFKSecurityEquityEquityId()) { foreach (AppraisalSet.SecurityRow driverSecurity in parentObject.GetSecurityRows()) { foreach (AppraisalSet.PositionRow driverPosition in driverSecurity.GetPositionRows()) { parentElement.InsertByName(new EquityElement(this, equityRow, driverPosition)); } } } } }
public BasePage(IWebDriver driver) { cmnElement = new CommonElement(); this.driver = driver; }
static CommandBindingCollection GetCommandBindings(DependencyObject depObj) { var elem = new CommonElement(depObj); return(elem.IsValid ? elem.CommandBindings : null); }
public LoginPage(IWebDriver driver) { this.driver = driver; commonElement = new CommonElement(); }