Files
LIAM/LiamTestTeams/NodesBase.cs
Drechsler, Meik f563d78417 initial
2025-10-15 14:56:07 +02:00

125 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using C4IT.LIAM;
namespace LiamTestTeams
{
public class TreeNodeBase
{
public const int iconIndexUnknown = 8;
public TreeNodeBase Parent = null;
public virtual bool AutoResolved()
{
return false;
}
virtual public string GetInfoText()
{
return "";
}
virtual public string GetUID()
{
return null;
}
virtual public async Task<List<TreeNodeBase>> ResolveAsync(bool ResolveAlways = false)
{
await Task.Delay(0);
return null;
}
virtual public bool IsResolved()
{
return true;
}
public virtual int ImageIndex()
{
return iconIndexUnknown;
}
public string GetJson()
{
var set = new JsonSerializerSettings()
{
Formatting = Formatting.Indented
};
var RetVal = JsonConvert.SerializeObject(GetJsonObject(), set);
return RetVal;
}
public virtual dynamic GetJsonObject()
{
return null;
}
public virtual bool SupportPermissionAdd()
{
return false;
}
public virtual bool SupportPermissionRemoveDirect()
{
return false;
}
public virtual bool SupportPermissionRemoveByValue()
{
return false;
}
public virtual async Task<bool> AddPermission(eLiamAccessRoles Role, string Identity)
{
await Task.Delay(0);
throw new InvalidOperationException($"Add permission not supported for '{this.GetType()}'");
}
public virtual async Task<bool> RemovePermissionByValue(eLiamAccessRoles Role, string Identity)
{
await Task.Delay(0);
throw new InvalidOperationException($"Add permission not supported for '{this.GetType()}'");
}
public virtual async Task<bool> RemovePermissionDirect()
{
await Task.Delay(0);
throw new InvalidOperationException($"Remove permission not supported for '{this.GetType()}'");
}
public virtual List<eLiamAccessRoles> ValidPermissionRoles()
{
return null;
}
public virtual string getLastError() { return null; }
public virtual async Task<TreeNodeBase> LoadFromUID()
{
await Task.Delay(0);
return null;
}
}
public abstract class TreeNodeRoot : TreeNodeBase
{
public cLiamProviderData Provider;
public TreeNodeRoot(cLiamProviderData Provider)
{
this.Provider = Provider;
}
public abstract Task<bool> LogonAsync();
}
}