❔ cs-script causes WPF to throw error when creating new form/page
public class Module
{
public string? Name { get; set; }
public string? File { get; set; }
public Dictionary<string, object>? Options;
}
public class HostedModule
{
public dynamic? runtime;
public Module? module;
}
public enum AuxFuncType
{
None,
RequestsMenu
}
public class AuxFunc
{
// todo: options dictionary
public string? Name { get; set; }
public AuxFuncType Type { get; set; }
public Action<Dictionary<string, object>>? Action { get; set; }
}
public static class ModuleManager
{
static List<AuxFunc> auxFuncs = new List<AuxFunc>();
static Dictionary<string, HostedModule> modules = new Dictionary<string, HostedModule>();
public static void AddAuxFunc(AuxFunc auxFunc)
{
auxFuncs.Add(auxFunc);
}
public static void LoadModules()
{
foreach (var file in Directory.GetFiles("Scripts"))
{
var newModule = new HostedModule
{
runtime = CSScript.Evaluator
.ReferenceAssembly(Assembly.GetAssembly(typeof(Message)))
.LoadFile(file)
};
newModule.module = newModule.runtime!.module;
newModule.module.File = file;
newModule.runtime.OnModuleLoad();
modules.Add(newModule.module.Name!, newModule);
}
}
}
} public class Module
{
public string? Name { get; set; }
public string? File { get; set; }
public Dictionary<string, object>? Options;
}
public class HostedModule
{
public dynamic? runtime;
public Module? module;
}
public enum AuxFuncType
{
None,
RequestsMenu
}
public class AuxFunc
{
// todo: options dictionary
public string? Name { get; set; }
public AuxFuncType Type { get; set; }
public Action<Dictionary<string, object>>? Action { get; set; }
}
public static class ModuleManager
{
static List<AuxFunc> auxFuncs = new List<AuxFunc>();
static Dictionary<string, HostedModule> modules = new Dictionary<string, HostedModule>();
public static void AddAuxFunc(AuxFunc auxFunc)
{
auxFuncs.Add(auxFunc);
}
public static void LoadModules()
{
foreach (var file in Directory.GetFiles("Scripts"))
{
var newModule = new HostedModule
{
runtime = CSScript.Evaluator
.ReferenceAssembly(Assembly.GetAssembly(typeof(Message)))
.LoadFile(file)
};
newModule.module = newModule.runtime!.module;
newModule.module.File = file;
newModule.runtime.OnModuleLoad();
modules.Add(newModule.module.Name!, newModule);
}
}
}
}so i have a modular system for my c# application but i just noticed that it makes my app crash
System.Exception: 'The component 'myappname.WindowControl' does not have a resource identified by the URI '/myappname;component/windowcontrol.xaml'.'System.Exception: 'The component 'myappname.WindowControl' does not have a resource identified by the URI '/myappname;component/windowcontrol.xaml'.'this happens everytime i call
LoadModules()LoadModules()... can somebody help me in this matter?