ch3rry
ch3rry
CC#
Created by ch3rry on 10/2/2023 in #help
❔ Avoiding "MySql connection is already in use"
so i have a bunch of C# scripts that all use the same api (mysql wrapper) but i came to notice that sometimes i get "connection in use" errors. by script i mean functions loaded through cs-script, but i guess you can think of it like a thread to avoid this, i thought of using separate connections for every script. i thought this idea is what's called pooling, but apparently i was wrong. so how can i get by this issue?
17 replies
CC#
Created by ch3rry on 9/22/2023 in #help
❔ 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()... can somebody help me in this matter?
3 replies
CC#
Created by ch3rry on 9/16/2023 in #help
❔ Weird WPF exception
No description
19 replies
CC#
Created by ch3rry on 9/15/2023 in #help
❔ Exception: the component does not have a resource identified by the uri
No description
5 replies
CC#
Created by ch3rry on 9/15/2023 in #help
❔ ✅ CS-Script throwing strange errors on load
No description
4 replies
CC#
Created by ch3rry on 9/13/2023 in #help
❔ Fastreports opensource, how do i use it?
var rep = new Report();
rep.Load("report.frx");
rep.Report.Prepare();
var rep = new Report();
rep.Load("report.frx");
rep.Report.Prepare();
i have this piece of code which i supposed to load a report, but i can't get it to show the print dialog. is this something i have to do on my own?
3 replies
CC#
Created by ch3rry on 9/12/2023 in #help
✅ (Solved) (Dapper) how to make a single query with one-to-many objects?
connection.QueryAsync<Request, Patient, Registrant, Request>
connection.QueryAsync<Request, Patient, Registrant, Request>
i don't think QuerySingleAsync (or QuerySingleOrDefaultAsync) accepts more than 1 template object, or am i missing something here?
83 replies