Example #1
0
        private void ASetInventory_Load(object sender, EventArgs e)
        {
            _dataTypes.Add('A', new List <string> {
                "Номер", "RFID бр-т"
            });
            _dataTypes.Add('B', new List <string> {
                "Бейсболка", "Бут.Воды"
            });
            _dataTypes.Add('C', new List <string> {
                "Футболка", "Сув.букл"
            });

            mainThread = new Thread(() =>
            {
                while (true)
                {
                    DateTime eTime;
                    DateTime.TryParse(s_GlobalMarathonDate, out eTime);
                    var resultTime = eTime.Subtract(DateTime.Now);
                    if (lbEndTime.InvokeRequired && !lbEndTime.IsDisposed)
                    {
                        if (resultTime > TimeSpan.Zero)
                        {
                            lbEndTime.BeginInvoke((MethodInvoker)(() => lbEndTime.Text = getTime(resultTime)));
                        }

                        lbEndTime.BeginInvoke((MethodInvoker)(() => lbEndTime.Location = new Point((this.Size.Width - lbEndTime.Size.Width) / 2, 16)));
                    }
                    Thread.Sleep(1000);
                }
            })
            {
                IsBackground = true,
                Priority     = ThreadPriority.Lowest
            };
            mainThread.Start();

            var m_DataTable = new DataTable();

            DataInventory.Rows.Add(_dataTypes['A'][0]); //0
            DataInventory.Rows.Add(_dataTypes['A'][1]); //1
            DataInventory.Rows.Add(_dataTypes['B'][0]); //2
            DataInventory.Rows.Add(_dataTypes['B'][1]); //3
            DataInventory.Rows.Add(_dataTypes['C'][0]); //4
            DataInventory.Rows.Add(_dataTypes['C'][1]); //5

            DataInventory.ClearSelection();
            DataInventory.CurrentCell = null;

            DataInventory[0, 1].ReadOnly                 =
                DataInventory[0, 2].ReadOnly             =
                    DataInventory[0, 3].ReadOnly         =
                        DataInventory[0, 4].ReadOnly     =
                            DataInventory[0, 5].ReadOnly = true;


            DataInventory.ClearSelection();
            DataInventory.CurrentCell = null;
        }