Пример #1
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;
                    }
            }
        }
Пример #2
0
 public Results(Testtype tt)
 {
     DateTime dt = DateTime.Now;
     this._logfilepath = "Logfile_" + tt.ToString() + "_" + dt.TimeOfDay.ToString("hh\\-mm\\-ss\\,ff") + ".txt";
 }
Пример #3
0
        public Results(Testtype tt)
        {
            DateTime dt = DateTime.Now;

            this._logfilepath += "Logfile_" + tt.ToString() + "_" + dt.TimeOfDay.ToString("hh\\-mm\\-ss\\,ff") + ".txt";
        }
Пример #4
0
        public Test(Testtype ttype, String filepath, String wifi_or_device_name, String ip_address_or_uuid, 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, 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, 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, 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, 0);
                    }, _cancel_token);

                break;
            }
            }
        }