Ejemplo n.º 1
0
        private void timerConnection_Tick(object sender, EventArgs e)
        {
            if (ConnectionHandlerUSB.connection == null)
            {
                pictureUsbStatus.Image = USB_OFF;
            }
            else
            {
                pictureUsbStatus.Image = USB_ON;

                byte[] cmd = { 1 };
                ConnectionHandlerUSB.SendBytes(cmd);
            }
        }
Ejemplo n.º 2
0
 private void timerLookForConnection_Tick(object sender, EventArgs e)
 {
     if (ConnectionHandlerUSB.connection == null)
     {
         labelStatus.Text = "Connect mobile device and open app";
         List <string> ids = ConnectionHandlerUSB.GetIDs();
         foreach (string id in ids)
         {
             Console.WriteLine(id);
             ConnectionHandlerUSB.Connect(id);
         }
         if (ids.Count > 0)
         {
             Console.WriteLine("\n");
         }
     }
     else
     {
         ConnectionHandlerUSB.CheckConnection();
     }
 }
Ejemplo n.º 3
0
        public Form1()
        {
            try
            {
                Storage.Initialize();
            }
            catch
            {
                MessageBox.Show("Storage initialization error.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(1);
            }

            InitializeComponent();
            graphicalOverlay1.Owner = this;
            this.DoubleBuffered     = true;

            NativeLibraries.Load();
            ConnectionHandlerUSB.Init(timerLookForConnection, timerConnection, labelStatus);

            pictureUsbStatus.Image = ((System.Drawing.Image)(Properties.Resources.usb_off));

            notifyIcon1.Icon    = ((System.Drawing.Icon)(Properties.Resources.TrayIcon));
            notifyIcon1.Visible = true;

            this.AllowDrop = true;

            CreateAccordion();

            InitSettings();

            //Setting up the panel
            Slots.Add(slot_1);
            Slots.Add(slot_2);
            Slots.Add(slot_3);
            Slots.Add(slot_4);
            Slots.Add(slot_5);
            Slots.Add(slot_6);
            Slots.Add(slot_7);
            Slots.Add(slot_8);
            Slots.Add(slot_9);
            Slots.Add(slot_10);
            Slots.Add(slot_11);
            Slots.Add(slot_12);
            Slots.Add(slot_13);
            Slots.Add(slot_14);
            Slots.Add(slot_15);

            foreach (ActionSlot slot in Slots)
            {
                slot.AllowDrop         = true;
                slot.DragEnter        += new DragEventHandler(slot_DragEnter);
                slot.DragLeave        += new EventHandler(slot_DragLeave);
                slot.DragDrop         += new DragEventHandler(slot_DragDrop);
                slot.MouseDown        += new MouseEventHandler(slot_MouseDown);
                slot.MouseUp          += new MouseEventHandler(slot_MouseUp);
                slot.MouseMove        += new MouseEventHandler(slot_MouseMove);
                slot.MouseDoubleClick += new MouseEventHandler(slot_MouseDoubleClick);
            }

            InitLabels();
            SyncSlots();
        }