/// <summary> /// Remove style library. /// </summary> /// <param name="project">The project instance.</param> /// <param name="library">The style library instance.</param> public static void RemoveStyleLibrary(this XProject project, XLibrary <ShapeStyle> library) { if (project?.CurrentStyleLibrary != null && library != null) { var previous = project.StyleLibraries; var next = project.StyleLibraries.Remove(library); project?.History?.Snapshot(previous, next, (p) => project.StyleLibraries = p); project.StyleLibraries = next; } }
/// <summary> /// Add item. /// </summary> /// <param name="project">The project instance.</param> /// <param name="library">The library instance.</param> /// <param name="item">The item instance.</param> public static void AddItem <T>(this XProject project, XLibrary <T> library, T item) { if (library?.Items != null && item != null) { var previous = library.Items; var next = library.Items.Add(item); project?.History?.Snapshot(previous, next, (p) => library.Items = p); library.Items = next; } }
/// <summary> /// Remove group library. /// </summary> /// <param name="project">The project instance.</param> /// <param name="library">The group library instance.</param> public static void RemoveGroupLibrary(this XProject project, XLibrary <XGroup> library) { if (project?.GroupLibraries != null && library != null) { var previous = project.GroupLibraries; var next = project.GroupLibraries.Remove(library); project?.History?.Snapshot(previous, next, (p) => project.GroupLibraries = p); project.GroupLibraries = next; } }
public void SetSelected_Sets_Selected() { var target = new XLibrary<XContainer>(); var item = XContainer.CreateTemplate(); target.Items = target.Items.Add(item); target.SetSelected(item); Assert.Equal(item, target.Selected); }
public void SetCurrentStyleLibrary_Sets_CurrentStyleLibrary() { var target = new XProject(); var library = XLibrary <ShapeStyle> .Create("Library1"); target.StyleLibraries = target.StyleLibraries.Add(library); target.SetCurrentStyleLibrary(library); Assert.Equal(library, target.CurrentStyleLibrary); }
public void SetCurrentGroupLibrary_Sets_CurrentGroupLibrary() { var target = new XProject(); var library = XLibrary <XGroup> .Create("Library1"); target.GroupLibraries = target.GroupLibraries.Add(library); target.SetCurrentGroupLibrary(library); Assert.Equal(library, target.CurrentGroupLibrary); }
public void SetSelected_Sets_Selected() { var target = new XLibrary <XContainer>(); var item = XContainer.CreateTemplate(); target.Items = target.Items.Add(item); target.SetSelected(item); Assert.Equal(item, target.Selected); }
/// <summary> /// Add items. /// </summary> /// <param name="project">The project instance.</param> /// <param name="library">The library instance.</param> /// <param name="items">The items collection.</param> public static void AddItems <T>(this XProject project, XLibrary <T> library, IEnumerable <T> items) { if (library?.Items != null && items != null) { var builder = library.Items.ToBuilder(); builder.AddRange(items); var previous = library.Items; var next = builder.ToImmutable(); project?.History?.Snapshot(previous, next, (p) => library.Items = p); library.Items = next; } }
private void Add(XLibrary <XGroup> gl) { if (gl == null) { return; } if (gl.Items != null) { Add(gl.Items); } gl.PropertyChanged += ObserveGroupLibrary; }
private void Add(XLibrary <ShapeStyle> sg) { if (sg == null) { return; } if (sg.Items != null) { Add(sg.Items); } sg.PropertyChanged += ObserveStyleLibrary; }
private void Remove(XLibrary <XGroup> gl) { if (gl == null) { return; } if (gl.Items != null) { Remove(gl.Items); } gl.PropertyChanged -= ObserveGroupLibrary; }
private void Remove(XLibrary <ShapeStyle> sg) { if (sg == null) { return; } if (sg.Items != null) { Remove(sg.Items); } sg.PropertyChanged -= ObserveStyleLibrary; }
/// <summary> /// Creates a new instance of the <see cref="XLibrary{ShapeStyle}"/> class. /// </summary> /// <returns>The new instance of the <see cref="XLibrary{ShapeStyle}"/>.</returns> public static XLibrary <ShapeStyle> TemplateStyleLibrary() { var sgt = XLibrary <ShapeStyle> .Create("Template"); var gs = ShapeStyle.Create("Grid", 255, 222, 222, 222, 255, 222, 222, 222, 1.0); var builder = sgt.Items.ToBuilder(); builder.Add(gs); sgt.Items = builder.ToImmutable(); sgt.Selected = sgt.Items.FirstOrDefault(); return(sgt); }
/// <summary> /// Creates a new instance of the <see cref="XLibrary{ShapeStyle}"/> class. /// </summary> /// <returns>The new instance of the <see cref="XLibrary{ShapeStyle}"/>.</returns> public static XLibrary <ShapeStyle> DefaultStyleLibrary() { var sgd = XLibrary <ShapeStyle> .Create("Default"); var builder = sgd.Items.ToBuilder(); builder.Add(ShapeStyle.Create("Black", 255, 0, 0, 0, 80, 0, 0, 0, 2.0)); builder.Add(ShapeStyle.Create("Red", 255, 255, 0, 0, 80, 255, 0, 0, 2.0)); builder.Add(ShapeStyle.Create("Green", 255, 0, 255, 0, 80, 0, 255, 0, 2.0)); builder.Add(ShapeStyle.Create("Blue", 255, 0, 0, 255, 80, 0, 0, 255, 2.0)); builder.Add(ShapeStyle.Create("Cyan", 255, 0, 255, 255, 80, 0, 255, 255, 2.0)); builder.Add(ShapeStyle.Create("Magenta", 255, 255, 0, 255, 80, 255, 0, 255, 2.0)); builder.Add(ShapeStyle.Create("Yellow", 255, 255, 255, 0, 80, 255, 255, 0, 2.0)); sgd.Items = builder.ToImmutable(); sgd.Selected = sgd.Items.FirstOrDefault(); return(sgd); }
/// <summary> /// Creates a new instance of the <see cref="XLibrary{ShapeStyle}"/> class. /// </summary> /// <returns>The new instance of the <see cref="XLibrary{ShapeStyle}"/>.</returns> public static XLibrary <ShapeStyle> LinesStyleLibrary() { var sgdl = XLibrary <ShapeStyle> .Create("Lines"); var solid = ShapeStyle.Create("Solid", 255, 0, 0, 0, 80, 0, 0, 0, 2.0); solid.Dashes = default(string); solid.DashOffset = 0.0; var dash = ShapeStyle.Create("Dash", 255, 0, 0, 0, 80, 0, 0, 0, 2.0); dash.Dashes = "2 2"; dash.DashOffset = 1.0; var dot = ShapeStyle.Create("Dot", 255, 0, 0, 0, 80, 0, 0, 0, 2.0); dot.Dashes = "0 2"; dot.DashOffset = 0.0; var dashDot = ShapeStyle.Create("DashDot", 255, 0, 0, 0, 80, 0, 0, 0, 2.0); dashDot.Dashes = "2 2 0 2"; dashDot.DashOffset = 1.0; var dashDotDot = ShapeStyle.Create("DashDotDot", 255, 0, 0, 0, 80, 0, 0, 0, 2.0); dashDotDot.Dashes = "2 2 0 2 0 2"; dashDotDot.DashOffset = 1.0; var builder = sgdl.Items.ToBuilder(); builder.Add(solid); builder.Add(dash); builder.Add(dot); builder.Add(dashDot); builder.Add(dashDotDot); sgdl.Items = builder.ToImmutable(); sgdl.Selected = sgdl.Items.FirstOrDefault(); return(sgdl); }
/// <summary> /// Add group. /// </summary> /// <param name="project">The project instance.</param> /// <param name="library">The group library instance.</param> /// <param name="group">The group instance.</param> public static void AddGroup(this XProject project, XLibrary <XGroup> library, XGroup group) { AddItem(project, library, group); }
/// <summary> /// Add style. /// </summary> /// <param name="project">The project instance.</param> /// <param name="library">The style library instance.</param> /// <param name="style">The style instance.</param> public static void AddStyle(this XProject project, XLibrary <ShapeStyle> library, ShapeStyle style) { AddItem(project, library, style); }
public void Selected_Is_Null() { var target = new XLibrary <XContainer>(); Assert.Null(target.Selected); }
/// <inheritdoc/> public override bool CanRun(XLibrary <ShapeStyle> library) => ServiceProvider.GetService <ProjectEditor>().IsEditMode();
public JObject LoadManual(int?id) { JObject obManual = new JObject(); // Product id 있는 지 확인 if (id == null) { obManual.Add("result", "id 값이 null입니다."); return(obManual); } Product product = db.Products.Find(id); IEnumerable <XAppComponent> xAppComponents = db2.XAppComponents.Where(e => e.AppCategory == "LIB" && e.ComponentIdx == product.ComponentIdx); JArray arrFile = new JArray(); foreach (XAppComponent xAppComponent in xAppComponents) { var xLibraries = db2.XLibraries.Where(e => e.LibIdx == xAppComponent.AppIdx); if (xLibraries.Count() == 0) { continue; } XLibrary xlib = xLibraries.First(); var xResource = db2.XResources.Where(e => e.AppIdx == xlib.LibIdx && e.AppCategory == "LIB" && e.IsUrl == 0 && e.FileCategory == "MNL" && e.SubCategory == "IST"); // X_Resource의 subCategory에 "IST"가 들어가있지 않으면 못불러옴 (ERP2에서 수정해야 함) if (xResource.Count() == 0) { continue; } XResource xRes = xResource.First(); var xFileRepoes = db2.XFileRepositories.Where(e => e.AppIdx == xRes.ResIdx && e.AppCategory == "RES"); if (xFileRepoes.Count() == 0) { continue; } XFileRepository xFileRepo = xFileRepoes.First(); var xFiles = db2.XFiles.Where(e => e.FileIdx == xFileRepo.FileIdx); if (xFiles.Count() == 0) { continue; } XFile xFile = xFiles.First(); JObject obFile = new JObject(); obFile.Add("AppIdx", xAppComponent.AppIdx); obFile.Add("FileName", xFile.FileName); obFile.Add("Code", xRes.Code); obFile.Add("Date", xRes.MDate); obFile.Add("Edition", xRes.FileVersion); obFile.Add("ChangeDate", string.Format("{0:yyyy/MM/dd HH:mm:ss}", xRes.EDate)); obFile.Add("ChangeUser", xRes.EUser); arrFile.Add(obFile); } obManual.Add("Manuals", arrFile); obManual.Add("Result", "Success"); return(obManual); }
public void Selected_Is_Null() { var target = new XLibrary<XContainer>(); Assert.Null(target.Selected); }
public void Items_Not_Null() { var target = new XLibrary<XContainer>(); Assert.NotNull(target.Items); }
public void Inherits_From_ObservableObject() { var target = new XLibrary<XContainer>(); Assert.True(target is ObservableObject); }
/// <inheritdoc/> public override void Run(XLibrary <XGroup> library) => ServiceProvider.GetService <ProjectEditor>().OnAddGroup(library);
public void Inherits_From_ObservableObject() { var target = new XLibrary <XContainer>(); Assert.True(target is ObservableObject); }
private void Add(XLibrary<ShapeStyle> sg) { if (sg == null) return; if (sg.Items != null) { Add(sg.Items); } sg.PropertyChanged += ObserveStyleLibrary; }
/// <inheritdoc/> XProject IProjectFactory.GetProject() { var factory = this as IProjectFactory; var project = XProject.Create(); // Group Libraries var glBuilder = project.GroupLibraries.ToBuilder(); glBuilder.Add(XLibrary <XGroup> .Create("Default")); project.GroupLibraries = glBuilder.ToImmutable(); project.SetCurrentGroupLibrary(project.GroupLibraries.FirstOrDefault()); // Style Libraries var sgBuilder = project.StyleLibraries.ToBuilder(); sgBuilder.Add(DefaultStyleLibrary()); sgBuilder.Add(LinesStyleLibrary()); sgBuilder.Add(TemplateStyleLibrary()); project.StyleLibraries = sgBuilder.ToImmutable(); project.SetCurrentStyleLibrary(project.StyleLibraries.FirstOrDefault()); // Templates var templateBuilder = project.Templates.ToBuilder(); templateBuilder.Add(factory.GetTemplate(project, "Empty")); templateBuilder.Add(CreateGridTemplate(this, project, "Grid")); project.Templates = templateBuilder.ToImmutable(); project.SetCurrentTemplate(project.Templates.FirstOrDefault(t => t.Name == "Grid")); // Documents and Pages var document = factory.GetDocument(project, "Document"); var page = factory.GetPage(project, "Page"); var pageBuilder = document.Pages.ToBuilder(); pageBuilder.Add(page); document.Pages = pageBuilder.ToImmutable(); var documentBuilder = project.Documents.ToBuilder(); documentBuilder.Add(document); project.Documents = documentBuilder.ToImmutable(); project.Selected = document.Pages.FirstOrDefault(); // Databases var db = XDatabase.Create("Db"); var columnsBuilder = db.Columns.ToBuilder(); columnsBuilder.Add(XColumn.Create(db, "Column0")); columnsBuilder.Add(XColumn.Create(db, "Column1")); db.Columns = columnsBuilder.ToImmutable(); project.Databases = project.Databases.Add(db); project.SetCurrentDatabase(db); return(project); }
/// <inheritdoc/> public override void Run(XLibrary <ShapeStyle> library) => ServiceProvider.GetService <ProjectEditor>().OnAddStyle(library);
private void Remove(XLibrary<ShapeStyle> sg) { if (sg == null) return; if (sg.Items != null) { Remove(sg.Items); } sg.PropertyChanged -= ObserveStyleLibrary; }
public void Items_Not_Null() { var target = new XLibrary <XContainer>(); Assert.NotNull(target.Items); }
private void Add(XLibrary<XGroup> gl) { if (gl == null) return; if (gl.Items != null) { Add(gl.Items); } gl.PropertyChanged += ObserveGroupLibrary; }
// Search public JArray LoadProducts(string search, string category) { string txt = category ?? ""; if (txt.ToUpper() == "MODELS" || txt.ToUpper() == "MANUALS") { txt = "GOODS"; } else if (txt.ToUpper() == "ALL") { txt = ""; } var products = db.Products.Include(e => e.Equipment).AsNoTracking() .Where(e => e.Completion.Contains(txt) && (e.Equipment.Name.Contains(search ?? "") || e.Model.Contains(search ?? ""))); int x = products.Count() - 50; if (x > 0) { products = products.OrderBy(e => e.Id).Skip(x); } JArray arrProduct = new JArray(); foreach (Product product in products) { // Category가 Manual이면, Manual이 있는 지 확인하고 없으면 continue if (txt.ToUpper() == "MANUALS") { var xComponents = db2.XComponents.Where(e => e.Model == product.Model && e.CompTechGroupIdx != null); if (xComponents.Count() != 1) { continue; } int componentIdx = xComponents.First().ComponentIdx; var xAppComponents = db2.XAppComponents.Where(e => e.ComponentIdx == componentIdx && e.AppCategory == "LIB"); foreach (XAppComponent xAppComponent in xAppComponents) { var xLibraries = db2.XLibraries.Where(e => e.LibIdx == xAppComponent.AppIdx); if (xLibraries.Count() == 0) { continue; } XLibrary xlib = xLibraries.First(); var xResource = db2.XResources.Where(e => e.AppIdx == xlib.LibIdx && e.AppCategory == "LIB" && e.IsUrl == 0 && e.FileCategory == "MNL" && e.SubCategory == "IST"); if (xResource.Count() == 0) { continue; } XResource xRes = xResource.First(); var xFileRepoes = db2.XFileRepositories.Where(e => e.AppIdx == xRes.ResIdx && e.AppCategory == "RES"); if (xFileRepoes.Count() == 0) { continue; } XFileRepository xFileRepo = xFileRepoes.First(); var xFiles = db2.XFiles.Where(e => e.FileIdx == xFileRepo.FileIdx); if (xFiles.Count() == 0) { continue; } } } JObject item = new JObject(); item.Add("ProductId", product.Id); item.Add("ProductModel", product.Model); item.Add("Title", product.Title); item.Add("Completion", product.Completion); item.Add("Mass", product.Mass); arrProduct.Add(item); } return(arrProduct); }
private void Remove(XLibrary<XGroup> gl) { if (gl == null) return; if (gl.Items != null) { Remove(gl.Items); } gl.PropertyChanged -= ObserveGroupLibrary; }