Example #1
0
 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;
 }
Example #2
0
        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 void on_transfer_speed_change(String report, Results results)
 {
     results.append_to_log(report);
 }
 public void on_file_transfer_error(String report, Results results)
 {
     results.append_to_log(report);
 }
 public void on_file_received(String report, Results results)
 {
     results.append_to_log(report);
 }
 public Bluetooth_agent(String filepath, Agenttype agenttype, Callback_on_status_changed callback, Results results, Main_view main_view) : base(filepath, agenttype, callback, results, main_view)
 {
 }