Ejemplo n.º 1
0
        private void port_HotPlugCallback(object sender, EventArgs e)
        {
            HotPlugEventArgs hotPlugEventArgs = null;

            try
            {
                hotPlugEventArgs = (HotPlugEventArgs)e;
            }
            catch (InvalidCastException ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }
            /* this is nesecarry because ui changes have to run in main thread */
            Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => {
                NewPort newPort = new NewPort();
                newPort.SetMessageText(hotPlugEventArgs.Message);
                newPort.Show();
            }));
        }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     mac  = "1";
     port = GetComponent <NewPort>();
 }