private void numGrElemCnt_ValueChanged(object sender, EventArgs e) { // update number of elements if (elemGroup != null) { int oldElemCnt = elemGroup.Elems.Count; int newElemCnt = (int)numGrElemCnt.Value; if (oldElemCnt < newElemCnt) { // add new elements ElemType elemType = elemGroup.DefaultElemType; for (int elemInd = oldElemCnt; elemInd < newElemCnt; elemInd++) { ElemConfig elem = elemGroup.CreateElemConfig(); elem.ElemType = elemType; elemGroup.Elems.Add(elem); } } else if (oldElemCnt > newElemCnt) { // remove redundant elements for (int i = newElemCnt; i < oldElemCnt; i++) { elemGroup.Elems.RemoveAt(newElemCnt); } } OnObjectChanged(TreeUpdateTypes.ChildCount); } }
/// <summary> /// Saves the command into the XML node. /// </summary> public virtual void SaveToXml(XmlElement cmdElem) { if (cmdElem == null) { throw new ArgumentNullException("cmdElem"); } cmdElem.SetAttribute("tableType", TableType); cmdElem.SetAttribute("multiple", Multiple); cmdElem.SetAttribute("address", Address); if (ElemTypeEnabled) { cmdElem.SetAttribute("elemType", ElemType.ToString().ToLowerInvariant()); } if (Multiple) { cmdElem.SetAttribute("elemCnt", ElemCnt); } if (ByteOrderEnabled) { cmdElem.SetAttribute("byteOrder", ByteOrderStr); } cmdElem.SetAttribute("cmdNum", CmdNum); cmdElem.SetAttribute("name", Name); }
private void numGrElemCnt_ValueChanged(object sender, EventArgs e) { // изменение количества элементов в группе if (elemGroup != null) { int oldElemCnt = elemGroup.Elems.Count; int newElemCnt = (int)numGrElemCnt.Value; if (oldElemCnt < newElemCnt) { // добавление новых элементов ElemType elemType = elemGroup.DefElemType; for (int elemInd = oldElemCnt; elemInd < newElemCnt; elemInd++) { Elem elem = elemGroup.CreateElem(); elem.ElemType = elemType; elemGroup.Elems.Add(elem); } } else if (oldElemCnt > newElemCnt) { // удаление лишних элементов for (int i = newElemCnt; i < oldElemCnt; i++) { elemGroup.Elems.RemoveAt(newElemCnt); } } OnObjectChanged(TreeUpdateTypes.UpdateSignals); } }
public DataRow LoadRTDataRow(string username, ElemType dtype) { string tbName = ""; switch (dtype) { case ElemType.etZone: tbName = "ZoneInfo"; break; case ElemType.etPeople: tbName = "PeopleInfo"; break; case ElemType.etAsset: tbName = "AssetInfo"; break; } DataTable currTable = RTDS.Tables[tbName]; DataRow drow = currTable.Rows.Find(username); if (drow == null) { drow = currTable.NewRow(); drow["UserName"] = username; currTable.BeginLoadData(); currTable.LoadDataRow(drow.ItemArray, true); currTable.EndLoadData(); currTable.AcceptChanges(); } else { } return(currTable.Rows.Find(username)); }
/// <summary> /// Loads the group from the XML node. /// </summary> public virtual void LoadFromXml(XmlElement groupElem) { if (groupElem == null) { throw new ArgumentNullException("groupElem"); } Name = groupElem.GetAttribute("name"); Address = (ushort)groupElem.GetAttrAsInt("address"); Active = groupElem.GetAttrAsBool("active", true); XmlNodeList elemNodes = groupElem.SelectNodes("Elem"); int maxElemCnt = MaxElemCnt; ElemType defElemType = DefElemType; foreach (XmlElement elemElem in elemNodes) { if (Elems.Count >= maxElemCnt) { break; } Elem elem = CreateElem(); elem.Name = elemElem.GetAttribute("name"); elem.ElemType = elemElem.GetAttrAsEnum("type", defElemType); if (ByteOrderEnabled) { elem.ByteOrderStr = elemElem.GetAttribute("byteOrder"); elem.ByteOrder = ModbusUtils.ParseByteOrder(elem.ByteOrderStr); } Elems.Add(elem); } }
public ObjTemperature(string ouri, ElemType etype, double temp, DateTime time) { this.objuri = ouri; this.temperature = temp; this.dtime = time; elemType = etype; }
public ZoneHumidity(string ouri, ElemType etype, double hum, DateTime time) { this.objuri = ouri; this.humidity = hum; this.dtime = time; this.elemType = etype; }
public string GetFieldInfo(string username, ElemType dtype, string fieldname) { string tbName = ""; switch (dtype) { case ElemType.etZone: tbName = "ZoneInfo"; break; case ElemType.etPeople: tbName = "PeopleInfo"; break; case ElemType.etAsset: tbName = "AssetInfo"; break; } DataTable currTable = RTDS.Tables[tbName]; DataRow drow = currTable.Rows.Find(username); if (drow != null) { try { return(drow[fieldname].ToString()); } catch (Exception ex) { return(""); } } return(""); }
public void SaveRTDataRow(string username, ElemType dtype) { string tbName = ""; switch (dtype) { case ElemType.etZone: tbName = "ZoneInfo"; break; case ElemType.etPeople: tbName = "PeopleInfo"; break; case ElemType.etAsset: tbName = "AssetInfo"; break; default: return; } DataTable currTable = RTDS.Tables[tbName]; //the row which will be changed. DataRow drow = currTable.Rows.Find(username); drow.AcceptChanges(); //string strCurrentPath = System.IO.Directory.GetCurrentDirectory().ToString(); //string path = strCurrentPath + "\\data\\" + Properties.Settings.Default.RTDataFile; //RTDS.WriteXml(path, XmlWriteMode.WriteSchema); //send message }
/// <summary> /// Loads the configuration from the XML node. /// </summary> public virtual void LoadFromXml(XmlElement xmlElem) { if (xmlElem == null) { throw new ArgumentNullException(nameof(xmlElem)); } Active = xmlElem.GetAttrAsBool("active"); DataBlock = xmlElem.GetAttrAsEnum("dataBlock", xmlElem.GetAttrAsEnum <DataBlock>("tableType")); Address = xmlElem.GetAttrAsInt("address"); Name = xmlElem.GetAttrAsString("name"); ElemType defaultElemType = DefaultElemType; bool defaultReadOnly = !ReadOnlyEnabled; bool defaultBitMask = !BitMaskEnabled; int maxElemCnt = MaxElemCnt; foreach (XmlElement elemElem in xmlElem.SelectNodes("Elem")) { if (Elems.Count >= maxElemCnt) { break; } ElemConfig elemConfig = CreateElemConfig(); elemConfig.ElemType = elemElem.GetAttrAsEnum("type", defaultElemType); elemConfig.ByteOrder = elemElem.GetAttrAsString("byteOrder"); elemConfig.ReadOnly = elemElem.GetAttrAsBool("readOnly", defaultReadOnly); elemConfig.IsBitMask = elemElem.GetAttrAsBool("isBitMask", defaultBitMask); elemConfig.TagCode = elemElem.GetAttrAsString("tagCode"); elemConfig.Name = elemElem.GetAttrAsString("name"); Elems.Add(elemConfig); } }
private static bool IsOpenBrace(ElemType _type, string _cur, List <string> _list) { if (ElemIdentify.IsOpenComment(_cur)) { return(true); } if (_list.Count > 0) { string nextLine = _list[0]; if (nextLine.Equals("{") || nextLine.Equals("(")) { if (IElement.IsBraceType(_type)) { _list.RemoveAt(0); return(true); } else { string msg = "ElementParser::IsOpenBrace() Invalid open brace."; msg += string.Format(" type = {0}, cur = {1}, next = {2}", _type, _cur, nextLine); Debug.Assert(false, msg); throw new Exception(msg); } } } return(false); }
public virtual void ElementPret(ElemType elemType, MainWindow mw) { typeCurrentElement = elemType; PostureMageBrasLeves(mw); mw.MediaPlayerSons.Open(new Uri(string.Format(@"../../Sons/ElementsPrets/{0}", mw.SonsElements[elemType]), UriKind.Relative)); mw.MediaPlayerSons.Play(); RemiseAZeroBouclier(mw); }
public ObjLocation(string ouri, string zuri, ElemType etype, DateTime time, string still) { this.objuri = ouri; this.zoneuri = zuri; this.dtime = time; this.isStill = still; this.elemType = etype; }
public static bool TextEmpty(ElemType element) { if (element.AsOther().Text == String.Empty) { return(true); } return(false); }
public Segment(Node a, Node b) { this.a = a; this.b = b; segtype = ElemType.Boundary; indexA = 0; indexB = 0; edgeNumber = 0; }
public IElement(IElement _parent, ElemType _type, string _data) { parent = _parent; elemType = _type; originData = DebugInfo.AddElemType(_data, _type); child.Clear(); formatData.Clear(); }
public Segment(Node a, Node b, int edgeNumber) { this.a = a; this.b = b; segtype = ElemType.Boundary; indexA = 0; indexB = 0; this.edgeNumber = edgeNumber; }
public Segment(Node a, Node b, ElemType et, int indexA, int indexB, int edgeNumber) { this.a = a; this.b = b; segtype = et; this.indexA = indexA; this.indexB = indexB; this.edgeNumber = edgeNumber; }
public static bool TextEqualsCaseSensitive(ElemType element, Await awaitFor) { if (element.AsOther().Text == awaitFor.Value) { return(true); } return(false); }
public static bool TextEquals(ElemType element, Await awaitFor) { if (element.AsOther().Text.ToLower() == awaitFor.Value.ToLower()) { return(true); } return(false); }
public static bool TextPartExistCaseSensitive(ElemType element, Await awaitFor) { if (element.AsOther().Text.Contains(awaitFor.Value)) { return(true); } return(false); }
public override void ElementPret(ElemType elemType, MainWindow mw) { base.ElementPret(elemType, mw); foreach (var imageElt in mw.ImagesElementsJoueur2.Values) { imageElt.Opacity = 0.4; } mw.ImagesElementsJoueur2[elemType].Opacity = 1.0; }
public Segment() { a = new Node(); b = new Node(); segtype = ElemType.Boundary; indexA = 0; indexB = 0; edgeNumber = 0; }
public static bool TextPartExist(ElemType element, Await awaitFor) { string subString = awaitFor.Value.ToLower(); if (element.AsOther().Text.ToLower().Contains(subString)) { return(true); } return(false); }
public static ElemType Flip(ElemType elemType) { switch (elemType) { case ElemType.BLACK: return(ElemType.WHITE); default: return(ElemType.BLACK); } }
private static IElement ParseEmelent(IElement _parent, int _indent, List <string> _list) { try { string curLine = ""; ElemType curType = ElemType.None; IElement curElem = null; int curIndent = _parent.indent = _indent; ++curIndent; while (_list.Count > 0) { curLine = _list[0]; _list.RemoveAt(0); if (IsCloseBrace(_parent.elemType, curLine)) { break; } if (_parent.elemType == ElemType.GroupComment) { curElem = ElementFactory.Create(_parent, ElemType.Comment, curLine, curIndent); } else { curType = ElementFactory.GetType(ref curLine); curElem = ElementFactory.Create(_parent, curType, curLine, curIndent); if (IsOpenBrace(curType, curLine, _list)) { _parent.Add(ParseEmelent(curElem, curIndent, _list)); continue; } } _parent.Add(curElem); } --curIndent; } catch (Exception e) { string msg = string.Format("ElementParser::ParseEmelent() {0} ", e); Debug.Assert(false, msg); throw new Exception(msg); } return(_parent); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { ElemType elemType = (ElemType)value; if (!images.ContainsKey(elemType)) { return(null); } string image = images[elemType]; Uri source = new Uri(string.Format("Images/Boules/{0}", image), UriKind.RelativeOrAbsolute); return(source); }
public string formatValue(string value, ElemType type) { switch (type) { case ElemType.datetime: return(Util.formatDateTime(value)); case ElemType.number: return(Util.formatNumber(value)); //return date("", strToTime(value)); } return(value); }
public Elem(string name,DBModelDtoBase obj ,ElemType type,ref ProjectStructure structure) { Name = name; Type = type; Object = obj; Children = new List<Elem>(); if(Type == ElemType.Folder) { Folder = (FolderDto) obj; Children = Elem.GetFilesFromFolder(ref structure, (FolderDto)Object); var folders = Elem.GetFoldersFromFolder(ref structure, (FolderDto) Object); Children.AddRange(folders); } }
public override void DebugCheck(ISemanticResolver s) { ElemType.DebugCheck(s); Debug.Assert(m_ArrayTypeRec != null); // Parallel data structures: // (ArrayTypeSig : TypeSig) as (ArrayTypeEntry : TypeEntry) // So verify the integrity there if (m_sigBase != null) { Debug.Assert(m_sigBase.BlueType == m_ArrayTypeRec.ElemType); } } // DebugCheck
public void Update(object sender, UpdateEventArgs e) { if (e.NewEvents != null) { //foreach (EventBean @event in e.NewEvents) // { string objuri = (string)e.NewEvents[0].Get("objuri"); double temp = (double)e.NewEvents[0].Get("temperature"); ElemType et = (ElemType)(e.NewEvents[0].Get("elemType")); MainFrm.rtDataManager.WriteRTDataRow(objuri, et, "Temperature", temp.ToString()); frm.updateChart(objuri, temp); // } } }
//Methods: //Functions: private Texture2D getTextureFromType(ElemType type, Texture2D[] listofTextures) { if (this.Type == ElemType.Null) return listofTextures[0]; else if (this.Type == ElemType.Tree) return listofTextures[1]; else if (this.Type == ElemType.Water) return listofTextures[2]; else if (this.Type == ElemType.Bridge) return listofTextures[3]; /* else if (this.Type == ElemType.Gargouille) return listofTextures[5]; else if (this.Type == ElemType.Torche) return listofTextures[6];*/ else //if (this.Type == ElemType.Stone) return listofTextures[4]; }
//Properties: public ME_Element(ElemType type, Texture2D[] listOfTextures) { this.Type = type; this.Texture = getTextureFromType(type, listOfTextures); }
public Entry(ElemType t, string a1, string a2) { Type = t; Arg1 = a1; Arg2 = a2; }
private Boolean BuildRecursiveTag(Control control, Control Parent, Boolean Start, ElemType type, object Container) { if (control is CustomPanel) AddContent(new InnerHTMLText() { Text = Start ? "<div>" : "</div>" }, Container); else if (control is LayoutGroupTemplateContainer) { var layoutGroup = (LayoutGroupTemplateContainer)control; if (Parent is TabbedGroupTemplateContainer) { var manager = Helpers.RequestManager; String activeTabId = String.Concat(manager.Request.Form[(Parent as TabbedGroupTemplateContainer).Model.Id + "_state"]); Boolean isActive = ((activeTabId != "" && layoutGroup.Model.Id == activeTabId) || (activeTabId == "" && type == ElemType.FirstObject)); AddContent(new InnerHTMLText() { Text = Start ? String.Format("<li role=\"presentation\"{2}><a href=\"#{0}\" role=\"tab\" data-toggle=\"tab\" onclick=\"$('#{3}_state').val('{0}'); {4} \">{1}</a>".Replace("'",""") , layoutGroup.Model.Id , layoutGroup.Caption , isActive ? " class='active'" : "" , (Parent as TabbedGroupTemplateContainer).Model.Id , manager.Request.Form[layoutGroup.Model.Id + "_activated"] != "1" && !isActive ? String.Format("$('#{0}_activated').val(1); {1}".Replace("'", """), layoutGroup.Model.Id, handler.GetScript("")) : "" ) : "</li>" }, Container); } else { if (Parent is LayoutGroupTemplateContainer && (Parent as LayoutGroupTemplateContainer).Model.Direction == DevExpress.ExpressApp.Layout.FlowDirection.Horizontal && (Parent as LayoutGroupTemplateContainer).Items.Count > 0) { var ParentGroup = (Parent as LayoutGroupTemplateContainer); int Col = 12; if (ParentGroup.Model.Direction == DevExpress.ExpressApp.Layout.FlowDirection.Horizontal) Col = (int)(12 / ParentGroup.Items.Count); if (Col > 12) Col = 12; if (Col < 1) Col = 1; var customColumnClass = layoutGroup.Model as IModelBootstrapLayoutGroupColumnClass; AddContent(new InnerHTMLText() { Text = Start ? customColumnClass != null && String.Concat(customColumnClass.CustomColClass) != "" ? String.Format(@"<div class=""{0}"">", customColumnClass.CustomColClass) : String.Format(@"<div class=""col-sm-{0}"">", Col) : "</div>" }, Container); } else { if (Parent != null && layoutGroup.Model.ShowCaption == true && Start) { AddContent(new InnerHTMLText() { Text = String.Format(@" <div class=""panel panel-default""> <div class=""panel-heading"">{0}</div> <div class=""panel-body""> ", layoutGroup.Model.Caption) }, Container); } if (layoutGroup.Model.Direction == DevExpress.ExpressApp.Layout.FlowDirection.Horizontal && layoutGroup.Items.Count > 0) { AddContent(new InnerHTMLText() { Text = Start ? @"<div class=""row"">" : "</div>" }, Container); } else { AddContent(new InnerHTMLText() { Text = Start ? @"<div>" : "</div>" }, Container); } if (Parent != null && layoutGroup.Model.ShowCaption == true && !Start) { AddContent(new InnerHTMLText() { Text = @"</div> </div><br>" }, Container); } } } } else if (control is TabbedGroupTemplateContainer) { var tabbedGroup = (control as TabbedGroupTemplateContainer); if (tabbedGroup.Items.Count == 0) return true; var manager = Helpers.RequestManager; String activeTabId = String.Concat(manager.Request.Form[tabbedGroup.Model.Id + "_state"]); AddContent(new InnerHTMLText() { Text = Start ? String.Format("<div style=\"padding:2px\"><ul class='nav nav-tabs' role='tablist'><input type=\"hidden\" name = \"{0}_state\" runat=\"server\" id = \"{0}_state\" value=\"{1}\">", tabbedGroup.Model.Id, activeTabId) : "</ul></div>" }, Container); } else if (control is LayoutItemTemplateContainer) { if ((control as LayoutItemTemplateContainer).ViewItem == null) return true; if (Start && Parent is LayoutGroupTemplateContainer && (Parent as LayoutGroupTemplateContainer).Model.Direction == DevExpress.ExpressApp.Layout.FlowDirection.Horizontal && (Parent as LayoutGroupTemplateContainer).Items.Count > 0) { var ParentGroup = (Parent as LayoutGroupTemplateContainer); int Col = 12; if (ParentGroup.Model.Direction == DevExpress.ExpressApp.Layout.FlowDirection.Horizontal) Col = (int)(12 / ParentGroup.Items.Count); if (Col > 12) Col = 12; if (Col < 1) Col = 1; var customColumnClass = (control as LayoutItemTemplateContainer).Model as IModelBootstrapLayoutGroupColumnClass; AddContent(new InnerHTMLText() { Text = customColumnClass != null && String.Concat(customColumnClass.CustomColClass) != "" ? String.Format(@"<div class=""{0}"">", customColumnClass.CustomColClass) : String.Format(@"<div class=""col-sm-{0}"">", Col) }, Container); } if ((control as LayoutItemTemplateContainer).ViewItem is PropertyEditor) { var editor = (control as LayoutItemTemplateContainer).ViewItem as PropertyEditor; if (editor is WebPropertyEditor) if (View is DetailView) (editor as WebPropertyEditor).ViewEditMode = (View as DetailView).ViewEditMode; else if (View is DashboardView) (editor as WebPropertyEditor).ViewEditMode = ViewEditMode.Edit; if (editor != null) { if (Start) { if (editor is ListPropertyEditor) AddContent(new InnerHTMLText() { Text = String.Format(@" <div class='form-group'> ", editor.Caption) }, Container); else if ((control as LayoutItemTemplateContainer).ShowCaption && !(editor is XafBootstrapBooleanPropertyEditor)) { var delimeter = ""; var location = ""; switch((control as LayoutItemTemplateContainer).Model.CaptionLocation) { case DevExpress.Utils.Locations.Left: case DevExpress.Utils.Locations.Right: location = "form-inline form-group"; delimeter = ":"; break; default: location = ""; break; } AddContent(new InnerHTMLText() { Text = String.Format(@" <div class='{1}'> <label><b>{0}{2}</b></label> <div class='form-group'> ", editor.Caption , location , delimeter) }, Container); } else AddContent(new InnerHTMLText() { Text = @"<div class='form-group'>" }, Container); if (editor is ListPropertyEditor) { AddContent(new HTMLViewItem() { BootstrapView = this, ViewItem = editor, ObjectSpace = View.ObjectSpace, Application = (WebApplication.Instance as XafApplication) }, Container); } else { if (!(editor is IXafBootstrapEditor)) { } AddContent(new HTMLViewItem() { BootstrapView = this, ViewItem = editor, ObjectSpace = View.ObjectSpace, Application = (WebApplication.Instance as XafApplication) }, Container); } } else { if (editor is ListPropertyEditor) { AddContent(new InnerHTMLText() { Text = @"</div>" }, Container); } else if ((control as LayoutItemTemplateContainer).ShowCaption && !(editor is XafBootstrapBooleanPropertyEditor)) { AddContent(new InnerHTMLText() { Text = @"</div></div>" }, Container); } else { AddContent(new InnerHTMLText() { Text = @"</div>" }, Container); } } } } else { if (Start) { AddContent(new HTMLViewItem() { BootstrapView = this, ViewItem = (control as LayoutItemTemplateContainer).ViewItem, ObjectSpace = View.ObjectSpace, Application = (WebApplication.Instance as XafApplication) }, Container); } } if (!Start && Parent is LayoutGroupTemplateContainer && (Parent as LayoutGroupTemplateContainer).Model.Direction == DevExpress.ExpressApp.Layout.FlowDirection.Horizontal && (Parent as LayoutGroupTemplateContainer).Items.Count > 0) { AddContent(new InnerHTMLText() { Text = "</div>" }, Container); } } else { if (Start) { AddContent(new InnerHTMLText() { Text = "<div class='table-responsive'>" }, Container); AddContent(control, Container); return false; } else { AddContent(new InnerHTMLText() { Text = "</div>" }, Container); } } return true; }
private Boolean BuildRecursiveElement(Control control, Control Parent, ElemType type, object Container) { if (control is LayoutItemTemplateContainerBase) { bool Visible = true; bool Enabled = true; var baseControl = (control as LayoutItemTemplateContainerBase); #region CALCULATE ELEMENT APPEARANCE if (View.ObjectTypeInfo != null) { var member = View.ObjectTypeInfo.FindMember(baseControl.Model.Id); if (member != null) foreach (var appearanceItem in member.FindAttributes<AppearanceAttribute>().Where(f => (String.Concat(f.Context) == "" || String.Concat(f.Context) == "Any" || f.Context.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList().IndexOf("DetailView") > -1) )) { if (Convert.ToBoolean(View.ObjectSpace.GetExpressionEvaluator(View.ObjectTypeInfo.Type, CriteriaOperator.Parse(appearanceItem.Criteria)).Evaluate(View.CurrentObject))) { var aItem = (appearanceItem as DevExpress.ExpressApp.ConditionalAppearance.IAppearance); switch (aItem.Visibility) { case ViewItemVisibility.ShowEmptySpace: case ViewItemVisibility.Hide: Visible = false; break; case ViewItemVisibility.Show: Visible = true; break; } switch (aItem.Enabled) { case true: case false: Enabled = (Boolean)aItem.Enabled; break; } } } foreach (var appearanceItem in View.ObjectTypeInfo.FindAttributes<AppearanceAttribute>().Where(f => (String.Concat(f.TargetItems).IndexOf("*") > -1 || String.Concat(f.TargetItems).Split(',').Where(s => s.Trim() == baseControl.Model.Id).Count() > 0) && ( String.Concat(f.Context) == "" || String.Concat(f.Context) == "Any" || f.Context.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList().IndexOf("DetailView") > -1 ) )) { if (Convert.ToBoolean(View.ObjectSpace.GetExpressionEvaluator(View.ObjectTypeInfo.Type, CriteriaOperator.Parse(appearanceItem.Criteria)).Evaluate(View.CurrentObject))) { var aItem = (appearanceItem as DevExpress.ExpressApp.ConditionalAppearance.IAppearance); switch (aItem.Visibility) { case ViewItemVisibility.ShowEmptySpace: case ViewItemVisibility.Hide: Visible = false; break; case ViewItemVisibility.Show: Visible = true; break; } switch (aItem.Enabled) { case true: case false: Enabled = (Boolean)aItem.Enabled; break; } } } } #endregion if (!Visible) return false; else { if (!Enabled) DisabledItems.Add((control as LayoutItemTemplateContainerBase).Model.Id); } } if (control is TabbedGroupTemplateContainer) { var container = (control as TabbedGroupTemplateContainer); var i = 0; var minVisibleIndex = -1; var maxVisibleIndex = -1; IList<int> VisibleIndexes = new List<int>(); IList<KeyValuePair<string, LayoutItemTemplateContainerBase>> AccessableItems = new List<KeyValuePair<string, LayoutItemTemplateContainerBase>>(); foreach (KeyValuePair<string, LayoutItemTemplateContainerBase> item in container.Items) { bool Visible = true; bool Enabled = true; #region CALCULATE ELEMENT APPEARANCE if (View.ObjectTypeInfo != null) { var member = View.ObjectTypeInfo.FindMember(item.Value.Model.Id); if (member != null) foreach (var appearanceItem in member.FindAttributes<AppearanceAttribute>().Where(f => (String.Concat(f.Context) == "" || String.Concat(f.Context) == "Any" || f.Context.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList().IndexOf("DetailView") > -1))) { if (Convert.ToBoolean(View.ObjectSpace.GetExpressionEvaluator(View.ObjectTypeInfo.Type, CriteriaOperator.Parse(appearanceItem.Criteria)).Evaluate(View.CurrentObject))) { var aItem = (appearanceItem as DevExpress.ExpressApp.ConditionalAppearance.IAppearance); switch (aItem.Visibility) { case ViewItemVisibility.ShowEmptySpace: case ViewItemVisibility.Hide: Visible = false; break; case ViewItemVisibility.Show: Visible = true; break; } switch (aItem.Enabled) { case true: case false: Enabled = (Boolean)aItem.Enabled; break; } } } foreach (var appearanceItem in View.ObjectTypeInfo.FindAttributes<AppearanceAttribute>().Where(f => String.Concat(f.TargetItems).Split(',').Where(s => s.Trim() == item.Value.Model.Id).Count() > 0 && (String.Concat(f.Context) == "" || String.Concat(f.Context) == "Any" || f.Context.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()).ToList().IndexOf("DetailView") > -1))) { if (Convert.ToBoolean(View.ObjectSpace.GetExpressionEvaluator(View.ObjectTypeInfo.Type, CriteriaOperator.Parse(appearanceItem.Criteria)).Evaluate(View.CurrentObject))) { var aItem = (appearanceItem as DevExpress.ExpressApp.ConditionalAppearance.IAppearance); switch (aItem.Visibility) { case ViewItemVisibility.ShowEmptySpace: case ViewItemVisibility.Hide: Visible = false; break; case ViewItemVisibility.Show: Visible = true; break; } switch (aItem.Enabled) { case true: case false: Enabled = (Boolean)aItem.Enabled; break; } } } } #endregion if (Visible) { if (minVisibleIndex == -1) minVisibleIndex = i; maxVisibleIndex = i; VisibleIndexes.Add(i); AccessableItems.Add(item); } i++; } if (VisibleIndexes.Count > 0) { //BUILD TAB DATA IDictionary<int, List<Control>> checkTabs = new Dictionary<int, List<Control>>(); i = 0; Boolean ActiveWasSet = false; foreach (KeyValuePair<string, LayoutItemTemplateContainerBase> item in AccessableItems) { var checkTab = new List<Control>(); var manager = Helpers.RequestManager; String activeTabId = String.Concat(manager.Request.Form[container.Model.Id + "_state"]); String classActive = " activeState"; if (activeTabId != "") { ActiveWasSet = true; classActive = (item.Value.Model.Id == activeTabId) ? " active" : ""; } AddContent(new InnerHTMLText() { Text = String.Format("<div role='tabpanel' class='tab-pane fade in{1}' id='{0}'><input type='hidden' id='{0}_activated' value='{2}' name = '{0}_activated'/>", item.Value.Model.Id, classActive, manager.Request.Form[item.Value.Model.Id + "_activated"] == "1" || (i == 0) ? "1" : "0") }, checkTab); AddContent(new InnerHTMLText() { Text = String.Format(@"<div class=""row no-margin""><div class=""col-sm-12"">") }, checkTab); var checkTabCounter = new List<Control>(); BuildRecursiveElement(item.Value, null, (i == 0) ? ElemType.FirstObject : (i == 0) ? ElemType.LastObject : ElemType.SingleObject, checkTabCounter); if (manager.Request.Form[item.Value.Model.Id + "_activated"] == "1" || (i == 0)) checkTab.AddRange(checkTabCounter); else if (checkTabCounter.Count(f => !(f is InnerHTMLText)) > 0) { AddContent(new HTMLText() { Text = @"<div class=""progress loading-progress""> <div class=""progress-bar progress-bar-info progress-bar-striped active"" role=""progressbar"" aria-valuenow=""100"" aria-valuemin=""0"" aria-valuemax=""100"" style=""width: 100%""> <span class=""sr-only"">40% Complete (success)</span> </div> </div>" }, checkTab); } AddContent(new InnerHTMLText() { Text = String.Format(@"</div></div>") }, checkTab); AddContent(new InnerHTMLText() { Text = "</div>" }, checkTab); checkTabs.Add(i, checkTab); i++; } AddContent(new InnerHTMLText() { Text = "<div class='panel panel-default'>" }, Container); //BUILD HEADERS i = 0; var k = 0; BuildRecursiveTag(control, Parent, true, type, Container); var visibleCount = (checkTabs.Where(f => f.Value.Count > 4).Count()); foreach (KeyValuePair<string, LayoutItemTemplateContainerBase> item in AccessableItems) { if (checkTabs[i].Count(f => !(f is InnerHTMLText)) > 0) { BuildRecursiveTag(item.Value, control, true, (k == 0) ? ElemType.FirstObject : (k == visibleCount) ? ElemType.LastObject : ElemType.SingleObject, Container); BuildRecursiveTag(item.Value, control, false, (k == 0) ? ElemType.FirstObject : (k == visibleCount) ? ElemType.LastObject : ElemType.SingleObject, Container); k++; } i++; } BuildRecursiveTag(control, Parent, false, type, Container); //DISPLAY TAB DATA AddContent(new InnerHTMLText() { Text = "<div class='tab-content'>" }, Container); foreach (var tab in checkTabs.Where(f => f.Value.Count > 2)) { foreach (Control c in tab.Value) { if (!ActiveWasSet && c is HTMLText && (c as HTMLText).Text.IndexOf("activeState") > -1) { ActiveWasSet = true; (c as HTMLText).Text = (c as HTMLText).Text.Replace("activeState", "active"); } AddContent(c, Container); } } AddContent(new InnerHTMLText() { Text = "</div>" }, Container); AddContent(new InnerHTMLText() { Text = "</div><br>" }, Container); } } else { var checkContainer = new List<Control>(); if (BuildRecursiveTag(control, Parent, true, type, checkContainer)) { if (control is LayoutGroupTemplateContainer) { var container = (control as LayoutGroupTemplateContainer); var i = 0; foreach (KeyValuePair<string, LayoutItemTemplateContainerBase> item in container.Items) { BuildRecursiveElement(item.Value, control, (i == 0) ? ElemType.FirstObject : (i == container.Items.Count) ? ElemType.LastObject : ElemType.SingleObject, checkContainer); i++; } } else if (control.Controls.Count > 0) { var i = 0; foreach (Control item in control.Controls.OfType<Control>().ToList()) { BuildRecursiveElement(item, control, (i == 0) ? ElemType.FirstObject : (i == control.Controls.Count) ? ElemType.LastObject : ElemType.SingleObject, checkContainer); i++; } } } BuildRecursiveTag(control, Parent, false, type, checkContainer); if (checkContainer.OfType<InnerHTMLText>().Count() < checkContainer.Count) foreach (Control c in checkContainer) AddContent(c, Container); } return true; }