Ejemplo n.º 1
0
        private void downloadthread(dltype type)
        {
            try
            {
                List<int> items = new List<int>();
                switch(type)
                {
                    case dltype.All:
                        for (int i = 0; i < CHK_logs.Items.Count; ++i)
                            items.Add((int)CHK_logs.Items[i]);
                        break;
                    case dltype.Selected:
                        for (int i = 0; i < CHK_logs.CheckedItems.Count; ++i)
                            items.Add((int)CHK_logs.CheckedItems[i]);
                        break;
                }

                for (int i = 0; i < items.Count; ++i)
                {
                    currentlog = items[i];

                    var logname = GetLog((ushort)currentlog);

                    CreateLog(logname);
                }
                status = serialstatus.Done;

                Console.Beep();
            }
            catch (Exception ex)
            {
                CustomMessageBox.Show(ex.Message, "Error in log " + currentlog);
            }
        }
Ejemplo n.º 2
0
        private void downloadthread(dltype type)
        {
            try
            {
                downloading = true;

                List<int> items = new List<int>();
                switch(type)
                {
                    case dltype.All:
                        for (int i = 0; i < CHK_logs.Items.Count; ++i)
                            items.Add((int)CHK_logs.Items[i]);
                        break;
                    case dltype.Selected:
                        for (int i = 0; i < CHK_logs.CheckedItems.Count; ++i)
                            items.Add((int)CHK_logs.CheckedItems[i]);
                        break;
                    case dltype.MinusOne:
                        items.Add(-1);
                        break;
                }

                for (int i = 0; i < items.Count; ++i)
                {
                    currentlog = items[i];
                    comPort.Write("dump ");
                    comPort.Write(items[i].ToString() + "\r");

                    log.Info("state ->Createfile\r");
                    status = serialstatus.Createfile;

                    if (i==items.Count-1) downloading = false;

                    while (status != serialstatus.Done && status != serialstatus.Error)
                    {
                        System.Threading.Thread.Sleep(10);
                    }
                    if (exitpending || status == serialstatus.Error)
                    {
                        downloading = false;
                        return;
                    }
                }

                Console.Beep();
            }
            catch (Exception ex)
            {
                CustomMessageBox.Show(ex.Message, "Error in log " + currentlog);
            }
        }