Example #1
0
        public static void Main(string[] args)
        {
            var d = new DeviceA("asdfsdf");

            DeviceFactory.Create(d, "asdfsdf");

            Console.ReadKey();
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // Load the device configutation
            DeviceConfiguration.Load();

            // Initialize the devices
            deviceA = new DeviceA();
            deviceB = new DeviceB();

            textBox1.Focus();
        }
Example #3
0
        private static void Main(string[] args)
        {
            var deviceA = new DeviceA();
            var deviceB = new DeviceB();

            Console.Write("Connecting to device A: ");
            deviceA.Connect();
            Console.WriteLine("Connected!");

            Console.Write("Connecting to device B: ");
            deviceB.Connect();
            Console.WriteLine("Connected!");


            Console.Write("Reading data from device A");
            var data = deviceA.ReadData();

            Console.WriteLine("this is really: {0}", data.Content);

            Console.Write("Analyzing data with device B");

            var success = deviceB.Analyze(new DataToAnalyze
            {
                Something = data.Content
            });

            if (success)
            {
                Console.WriteLine("Yep, it really is: {0}", data.Content);
            }

            Console.Write("Disconnecting device A: ");
            deviceA.Disconnect();
            Console.WriteLine("Done!");

            Console.Write("Disconnecting device B: ");
            deviceB.Disconnect();
            Console.WriteLine("Done!");
        }