Exemplo n.º 1
0
 private void ResetToNewOrder()
 {
     try
     {
         _foundImages.Clear();
         _foundImagesEnumerator  = null;
         DestinationBox.ReadOnly = false;
         DestinationBox.Clear();
         DestinationBox.BackColor = SystemColors.Control;
         InputBarcodeBox.Visible  = false;
         if (PictureBox.Image != null)
         {
             PictureBox.Image.Dispose();
             PictureBox.Image = null;
         }
         NextBtnPanel.Visible    = false;
         SearchModePanel.Visible = false;
         ProductImagesList.Items.Clear();
         BarcodeCountLabel.Text = "0";
         ProductCountLabel.Text = "0";
         _copiedImages.Clear();
         _copyFileService.SetDestinationDirectory(null);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 private async void DestinationBtn_Click(object sender, EventArgs e)
 {
     folderBrowserDialog1.RootFolder = Environment.SpecialFolder.DesktopDirectory;
     try
     {
         if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
         {
             DestinationBox.Text = folderBrowserDialog1.SelectedPath;
             await new TaskFactory().StartNew(() => _copyFileService.SetDestinationDirectory(DestinationBox.Text));
             DestinationBox.BackColor = Color.LimeGreen;
             InputBarcodeBox.Visible  = _copyFileService.IsSourceDirectorySet();
             DestinationBox.ReadOnly  = true;
             ProductImagesList.Items.Clear();
             _copiedImages = await new TaskFactory().StartNew(() => _copyFileService.LoadFromDestinationDirectory());
             _copiedImages.CollectionChanged += CopiedImages_Change;
             if (_copiedImages.Any())
             {
                 ProductImagesList.Items.AddRange(ConvertCopiedToList(_copiedImages));
                 FixProductListCount();
                 RecalculateCopiedImagesCollection();
             }
         }
     }
     catch (FileLoadException fl)
     {
         MessageBox.Show("Загрузка списка изображений из сохраненного файла со списком не удалась\n" + fl.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         DestinationBox.ReadOnly = false;
         DestinationBox.Clear();
         DestinationBox.BackColor = SystemColors.Control;
     }
 }
Exemplo n.º 3
0
 private void DestinationBox_ItemCheck(object sender, ItemCheckEventArgs e)
 {
     for (int ix = 0; ix < DestinationBox.Items.Count; ++ix)
     {
         if (ix != e.Index)
         {
             DestinationBox.SetItemChecked(ix, false);
         }
     }
 }
Exemplo n.º 4
0
 private void SendButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (host.sendMesage(MessageTextBox.Text, System.Net.IPAddress.Parse(DestinationBox.GetItemText(DestinationBox.SelectedItem))))
         {
             MessageTextBox.Clear();
         }
     }
     catch (System.FormatException ex)
     {
         host.messageQueue.Enqueue(Logger.Log(ex.Message, LogType.ERROR));
     }
 }
Exemplo n.º 5
0
        private async void DestinationBox_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                switch (e.KeyCode)
                {
                case Keys.Enter:
                    if (!string.IsNullOrWhiteSpace(DestinationBox.Text) && !DestinationBox.ReadOnly)
                    {
                        await new TaskFactory().StartNew(() => _copyFileService.SetDestinationDirectory(DestinationBox.Text));
                        DestinationBox.BackColor = Color.LimeGreen;
                        InputBarcodeBox.Visible  = _copyFileService.IsSourceDirectorySet();
                        DestinationBox.ReadOnly  = true;
                        ProductImagesList.Items.Clear();
                        _copiedImages = await new TaskFactory().StartNew(() => _copyFileService.LoadFromDestinationDirectory());
                        _copiedImages.CollectionChanged += CopiedImages_Change;
                        if (_copiedImages.Any())
                        {
                            ProductImagesList.Items.AddRange(ConvertCopiedToList(_copiedImages));
                            FixProductListCount();
                            RecalculateCopiedImagesCollection();
                        }
                    }
                    break;

                case Keys.Delete:
                    DestinationBox.Clear();
                    DestinationBox.ReadOnly  = false;
                    DestinationBox.BackColor = SystemColors.Control;
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }