Пример #1
0
        private void printOnlyButton_Click(object sender, EventArgs e)
        {
            List <LabelObject> labels = new List <LabelObject>();

            try
            {
                foreach (DataGridViewRow v in deviceList.SelectedRows)
                {
                    StringBuilder builder = new StringBuilder();

                    LabelObject label = new LabelObject();

                    Console.WriteLine("THIS IS VALIUE: " + v.Cells[0].Value);

                    label.title = v.Cells[0].Value == null ? " " : v.Cells[0].Value.ToString();
                    builder.AppendLine(v.Cells[1].Value == null ? " " : v.Cells[1].Value.ToString());
                    builder.AppendLine(v.Cells[2].Value == null ? " " : v.Cells[2].Value.ToString());
                    builder.AppendLine(v.Cells[3].Value == null ? " " : v.Cells[3].Value.ToString());
                    builder.AppendLine(v.Cells[4].Value == null ? " " : v.Cells[4].Value.ToString());
                    builder.AppendLine(v.Cells[6].Value == null ? " " : v.Cells[6].Value.ToString());
                    label.content        = builder.ToString();
                    label.qrCodeLocation = AppDomain.CurrentDomain.BaseDirectory + "code.png";
                    label.uuid           = v.Cells[1].Value == null ? " " : v.Cells[1].Value.ToString();

                    labels.Add(label);
                }

                Console.WriteLine(labels.Count);
                ProcessLabels(labels, @"C:\Users\Vince\Documents\QrCodeLabelTemp2.dotx", true);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
            }
        }
Пример #2
0
        private async void printButton_Clicked(object sender, EventArgs e)
        {
            List <LabelObject>  labels  = new List <LabelObject>();
            List <DeviceObject> devices = new List <DeviceObject>();

            try
            {
                foreach (DataGridViewRow v in deviceList.SelectedRows)
                {
                    StringBuilder builder = new StringBuilder();

                    LabelObject label = new LabelObject();

                    Task <DeviceObject> t1 = Task.Run(() => RunDataGridView(v));
                    await t1;



                    Console.WriteLine("THIS IS VALIUE: " + v.Cells[0].Value);

                    label.title = v.Cells[0].Value == null ? " " : v.Cells[0].Value.ToString();
                    builder.AppendLine(v.Cells[1].Value == null ? " " : v.Cells[1].Value.ToString());
                    builder.AppendLine(v.Cells[2].Value == null ? " " : v.Cells[2].Value.ToString());
                    builder.AppendLine(v.Cells[3].Value == null ? " " : v.Cells[3].Value.ToString());
                    builder.AppendLine(v.Cells[4].Value == null ? " " : v.Cells[4].Value.ToString());
                    builder.AppendLine(v.Cells[6].Value == null ? " " : v.Cells[6].Value.ToString());
                    label.content        = builder.ToString();
                    label.qrCodeLocation = "code.png";
                    label.uuid           = v.Cells[1].Value == null ? " " : v.Cells[1].Value.ToString();

                    labels.Add(label);

                    if (!skuCheckBox.Checked)
                    {
                        LocationPrompt locs = new LocationPrompt();

                        DeviceObject device = new DeviceObject();

                        device.serialID = v.Cells[1].Value == null ? " " : v.Cells[1].Value.ToString();
                        device.location = locs.location;
                        device.caseID   = locs.theCase;

                        devices.Add(device);
                    }
                    else
                    {
                        if (t1.Result != null)
                        {
                            devices.Add(t1.Result);
                        }
                    }
                }

                if (devices.Count != 0)
                {
                    Console.WriteLine(labels.Count);
                    await ProcessLabels(labels, @"C:\Users\Vince\Documents\QrCodeLabelTemp2.dotx", true);

                    CheckInDevices(devices);
                }
            }
            catch (Exception ex) {
                Trace.WriteLine(ex.ToString());
            }
        }