protected Agent(String filepath, Agenttype agenttype, Callback_on_status_changed callback, Results results, Main_view main_view) { this.filepath = filepath; this.agenttype = agenttype; this.callback = callback; this.results = results; this.main_view = main_view; }
public void stop_tests(Main_view mv) { foreach (Test t in mv.tests) { t.stop_test(); } mv.tests.Clear(); }
public Test(Testtype ttype, String filepath, String wifi_or_device_name, String ip_address_or_uuid_or_url, int port, Main_view mv) { _results = new Results(ttype); _main_view = mv; _test_agents = new List<Agent>(); _cancel_token_source = new CancellationTokenSource(); _cancel_token = _cancel_token_source.Token; switch (ttype) { case Testtype.Test_1: { _test_agents.Add(new Wifi_agent(filepath, Agenttype.Wifi_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).send_file(wifi_or_device_name, ip_address_or_uuid_or_url, port); }, _cancel_token); break; } case Testtype.Test_2: { _test_agents.Add(new Wifi_agent(filepath, Agenttype.Wifi_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).receive_file(wifi_or_device_name, ip_address_or_uuid_or_url, port); }, _cancel_token); break; } case Testtype.Test_3: { _test_agents.Add(new Bluetooth_agent(filepath, Agenttype.Bluetooth_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).send_file(wifi_or_device_name, ip_address_or_uuid_or_url, 0); }, _cancel_token); break; } case Testtype.Test_4: { _test_agents.Add(new Bluetooth_agent(filepath, Agenttype.Bluetooth_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).receive_file(wifi_or_device_name, ip_address_or_uuid_or_url, 0); }, _cancel_token); break; } case Testtype.Test_5: { _test_agents.Add(new Gsm_agent(filepath, Agenttype.Gsm_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).receive_file("", ip_address_or_uuid_or_url, 5000); }, _cancel_token); break; } } }
public Gsm_agent(String filepath, Agenttype agenttype, Callback_on_status_changed callback, Results results, Main_view main_view) : base(filepath, agenttype, callback, results, main_view) { }
public Wifi_agent(String filepath, Agenttype agenttype, Callback_on_status_changed callback, Results results, Main_view main_view) : base(filepath, agenttype, callback, results, main_view) { }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { this.mv = (Main_view)e.Parameter; this.nmbr = mv.selected_index; }
public Test(Testtype ttype, String filepath, String wifi_or_device_name, String ip_address_or_uuid_or_url, int port, Main_view mv) { _results = new Results(ttype); _main_view = mv; _test_agents = new List <Agent>(); _cancel_token_source = new CancellationTokenSource(); _cancel_token = _cancel_token_source.Token; switch (ttype) { case Testtype.Test_1: { _test_agents.Add(new Wifi_agent(filepath, Agenttype.Wifi_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).send_file(wifi_or_device_name, ip_address_or_uuid_or_url, port); }, _cancel_token); break; } case Testtype.Test_2: { _test_agents.Add(new Wifi_agent(filepath, Agenttype.Wifi_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).receive_file(wifi_or_device_name, ip_address_or_uuid_or_url, port); }, _cancel_token); break; } case Testtype.Test_3: { _test_agents.Add(new Bluetooth_agent(filepath, Agenttype.Bluetooth_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).send_file(wifi_or_device_name, ip_address_or_uuid_or_url, 0); }, _cancel_token); break; } case Testtype.Test_4: { _test_agents.Add(new Bluetooth_agent(filepath, Agenttype.Bluetooth_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).receive_file(wifi_or_device_name, ip_address_or_uuid_or_url, 0); }, _cancel_token); break; } case Testtype.Test_5: { _test_agents.Add(new Gsm_agent(filepath, Agenttype.Gsm_agent, new Callback_Instance(), _results, _main_view)); _task = new Task(() => { _test_agents.ElementAt(0).receive_file("", ip_address_or_uuid_or_url, 5000); }, _cancel_token); break; } } }