/// <summary> /// Returns a TagPath object based on the current path with a new location. /// </summary> /// <param name="newLocation">The new location to be represented by the path.</param> public TagPath NewLocation(TagLocation newLocation) { TagPath path = new TagPath(ToPath()); path.location = newLocation; return(path); }
public static dynamic GetTSObject(TagLocation dynEnum) { var tsType = TSActivator.CreateInstance("Tekla.Structures.Drawing.TagLocation").GetType(); switch (dynEnum) { case TagLocation.AboveLine: return(System.Enum.Parse(tsType, "AboveLine")); case TagLocation.BelowLine: return(System.Enum.Parse(tsType, "BelowLine")); case TagLocation.MiddleLevelOfSymbol: return(System.Enum.Parse(tsType, "MiddleLevelOfSymbol")); case TagLocation.AboveSymbolCenterLine: return(System.Enum.Parse(tsType, "AboveSymbolCenterLine")); case TagLocation.BelowSymbolCenterLine: return(System.Enum.Parse(tsType, "BelowSymbolCenterLine")); case TagLocation.CustomRelativeToSymbol: return(System.Enum.Parse(tsType, "CustomRelativeToSymbol")); default: throw new DynamicAPIException(dynEnum.ToString() + "- enum value is not implemented"); } }
public TagPath(string path, string game, TagLocation location, string locationName) { //this.extension = System.IO.Path.GetExtension(path).TrimStart('.'); //this.path = path.Substring(0, path.Length - (extension.Length + 1)); Parse(path); this.game = game; this.location = location; this.locationName = locationName; }
/// <summary> /// Provides a state that corresponds to a sepcified document being opened in the DocumentManager. /// </summary> /// <param name="manager">The document manager that will be used to determine state.</param> /// <param name="gameID">The GameID of the game that opened documents will belong to.</param> /// <param name="location">The TagLocation that opened documents will exist in.</param> /// <param name="collapsedIcon">The icon that will be displayed when the node is collapsed.</param> /// <param name="expandedIcon">The icon that will be displayed when the node is expanded.</param> /// <param name="foregroundColor">The foreground color of the node.</param> /// <param name="backgroundColor">The background color of the node.</param> public DocumentOpenState(IDocumentManager manager, string gameID, TagLocation location, Bitmap collapsedIcon, Bitmap expandedIcon, Color foregroundColor, Color backgroundColor) : base("document_open", collapsedIcon, expandedIcon, foregroundColor, backgroundColor) { this.manager = manager; this.gameID = gameID; tagLocation = location; this.manager.DocumentOpened += new DocumentActionHandler(manager_DocumentOpened); this.manager.DocumentClosed += new DocumentClosedHandler(manager_DocumentClosed); }
// 更新标签位置,并返回变更状态。true 标识位置发生变化或者首次记录,并返回上一次位置的基站标识 private bool UpgradeTagLocation(UpLoadDataPackage data, out string preSiteId) { preSiteId = null; var handler = new TagLocationHandle(Repository); var lc = handler.First(t => t.TagId == data.TagId); var isAdd = (null == lc); // 没有之前的记录,并且标签进入基站 if (isAdd && !data.IsOut) { lc = new TagLocation { SiteId = data.SiteId, Status = (short)(data.IsOut ? LocationStatus.Out : LocationStatus.In), TagId = data.TagId, UpTime = data.TTime }; handler.Add(lc); return(true); } // 标签进入基站,并且位置发生变化 if (!isAdd && !data.IsOut && lc.SiteId != data.SiteId) { preSiteId = lc.SiteId; // 更新当前时间 lc.SiteId = data.SiteId; lc.Status = (short)LocationStatus.In; lc.UpTime = data.TTime; handler.Modify(lc); return(true); } // 标签离开当前基站 if (!isAdd && data.IsOut && lc.SiteId == data.SiteId) { lc.UpTime = data.TTime; lc.Status = (short)LocationStatus.Out; handler.Modify(lc); } return(false); }
/// <summary> /// Parses a given tag path into its constituent parts. /// </summary> /// <param name="tagPath">path to be parsed</param> public void Parse(string tagPath) { string regexPattern = @"(\<(?<game>\w*)\>)?((?<source>\w):\\)?(?<path>.*)"; Match match = Regex.Match(tagPath, regexPattern); game = match.Groups["game"].Value; switch (match.Groups["source"].Value) { case "p": location = TagLocation.Project; break; case "g": location = TagLocation.Archive; break; case "": location = TagLocation.Auto; break; } string relativePath = match.Groups["path"].Value; if (relativePath.Contains("|")) { // This path point to an attachment. string[] parts = relativePath.Split('|'); relativePath = parts[0]; attachmentName = parts[1]; } path = System.IO.Path.GetDirectoryName(relativePath); string filename = System.IO.Path.GetFileNameWithoutExtension(relativePath); extension = System.IO.Path.GetExtension(relativePath).TrimStart('.'); path = path + "\\" + filename; path = path.Trim('\\'); }
private Tag CreateTag(Genre genre, TagLocation location) { Thickness thickness = new Thickness(); switch (location) { case TagLocation.Top: thickness = new Thickness(0, 5, 0, 0); break; case TagLocation.Bottom: thickness = new Thickness(0, 5, 0, 0); break; } Tag tg = new Tag() { TagName = genre.ToString(), VerticalAlignment = VerticalAlignment.Center, Margin = thickness, HorizontalAlignment = HorizontalAlignment.Right, }; return(tg); }
public TagPath(string path, string game, TagLocation location) : this(path, game, location, "") { ; }