Асинхронная задача получения данных из интерфейса? ⇐ C#
-
Гость
Асинхронная задача получения данных из интерфейса?
so I've been working on something for the past few days and currently at the point of implementing the server, but having a little problem finding the correct avenue for getting access to accounts
This is where I need to access Accounts
Inside ServerModule.cs, ran by Main as SM
static async Task ClientAsync(TcpClient client) { // here I need to get to the Accounts some how } I have these on Form1.cs
AccountHolderInterface Accounts = new AccountHolder(); TaskInterface Tasks = new TaskHolder(); ServerInterface Servers = new ServerHolder(); Inside these will have:
Form1.Accounts Form1.Accounts.Sectors Form1.Servers Form1.Servers.Main -> running async task, but needs access to data in Accounts Form1.Servers.Cont -> likewise situation here Form1.Servers.Main has:
IServer.Server.Main.MainModels.ServerModule SM; public string Name { get; set; } public int Port { get; set; } public string Status { get; set; } public Main() { Status = "Stopped"; } public bool Start() { StartMain(Name, Port); Status = "Started"; return true; } private async Task StartMain(string name, int port) { SM = new IServer.Server.Main.MainModels.ServerModule(); await SM.Main(name, port); }
Источник: https://stackoverflow.com/questions/780 ... -interface
so I've been working on something for the past few days and currently at the point of implementing the server, but having a little problem finding the correct avenue for getting access to accounts
This is where I need to access Accounts
Inside ServerModule.cs, ran by Main as SM
static async Task ClientAsync(TcpClient client) { // here I need to get to the Accounts some how } I have these on Form1.cs
AccountHolderInterface Accounts = new AccountHolder(); TaskInterface Tasks = new TaskHolder(); ServerInterface Servers = new ServerHolder(); Inside these will have:
Form1.Accounts Form1.Accounts.Sectors Form1.Servers Form1.Servers.Main -> running async task, but needs access to data in Accounts Form1.Servers.Cont -> likewise situation here Form1.Servers.Main has:
IServer.Server.Main.MainModels.ServerModule SM; public string Name { get; set; } public int Port { get; set; } public string Status { get; set; } public Main() { Status = "Stopped"; } public bool Start() { StartMain(Name, Port); Status = "Started"; return true; } private async Task StartMain(string name, int port) { SM = new IServer.Server.Main.MainModels.ServerModule(); await SM.Main(name, port); }
Источник: https://stackoverflow.com/questions/780 ... -interface
Мобильная версия