Add listview group expander

This commit is contained in:
Иван Ивашкин
2024-10-26 22:43:27 +05:00
parent 11ac7c7c48
commit 8510db1a85
7 changed files with 61 additions and 12 deletions

View File

@@ -12,7 +12,10 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
{
public interface IOneVariableFunction : ICloneable, ISaveable
{
public const string GROUP_TYPE_1 = "System function";
public const string GROUP_TYPE_2 = "User function";
public bool IsUser { get; set; }
public string Group { get; set; }
public FunctionType Type { get; set; }
public string Name { get; set; }
public string Description { get; set; }

View File

@@ -1,4 +1,5 @@
using StructureHelperCommon.Infrastructures.Enums;
using Microsoft.VisualBasic.ApplicationServices;
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
@@ -13,8 +14,11 @@ namespace StructureHelperCommon.Models.Functions
public class FormulaFunction : IOneVariableFunction
{
private const string COPY = "copy";
public const string GROUP_TYPE_1 = "System function";
public const string GROUP_TYPE_2 = "User function";
public bool IsUser { get; set; }
public FunctionType Type { get; set; }
public string Group { get; set; }
public string Name { get; set; }
public string Description { get ; set; }
public List<GraphPoint> Table { get; set; }
@@ -23,9 +27,19 @@ namespace StructureHelperCommon.Models.Functions
public Guid Id => throw new NotImplementedException();
public ObservableCollection<IOneVariableFunction> Functions { get; set; }
public FormulaFunction()
public FormulaFunction(bool isUser = false)
{
Type = FunctionType.FormulaFunction;
if (isUser)
{
IsUser = true;
Group = GROUP_TYPE_2;
}
else
{
IsUser = false;
Group = GROUP_TYPE_1;
}
}
public bool Check()
@@ -43,6 +57,7 @@ namespace StructureHelperCommon.Models.Functions
formulaFunction.Description = Description;
formulaFunction.Formula = Formula;
formulaFunction.IsUser = true;
formulaFunction.Group = GROUP_TYPE_2;
return formulaFunction;
}

View File

@@ -13,10 +13,14 @@ namespace StructureHelperCommon.Models.Functions
public class TableFunction : IOneVariableFunction
{
private const string COPY = "copy";
public const string GROUP_TYPE_1 = "System function";
public const string GROUP_TYPE_2 = "User function";
private string name;
public bool IsUser { get; set; }
public FunctionType Type { get; set; }
public string Group { get; set; }
public string Name
{
get => name;
@@ -31,9 +35,19 @@ namespace StructureHelperCommon.Models.Functions
public Guid Id => throw new NotImplementedException();
public ObservableCollection<IOneVariableFunction> Functions { get; set; }
public TableFunction()
public TableFunction(bool isUser = false)
{
Type = FunctionType.TableFunction;
if (isUser)
{
IsUser = true;
Group = GROUP_TYPE_2;
}
else
{
IsUser = false;
Group = GROUP_TYPE_1;
}
}
public bool Check()
@@ -53,7 +67,7 @@ namespace StructureHelperCommon.Models.Functions
Table.ForEach(x => newTable.Add(x.Clone() as GraphPoint));
tableFunction.Table = newTable;
tableFunction.IsUser = true;
tableFunction.Group = GROUP_TYPE_2;
return tableFunction;
}