Example #1
0
        private void buttonConvertPartFromCode_Click(object sender, EventArgs e)
        {
            ObjectWrapper returnable = new ObjectWrapper();
            ObjectWrapper sendable   = new ObjectWrapper();

            var hexagonParseForm = new HexagonParseForm(returnable, sendable);
            var thr = new Thread(() => { Application.Run(hexagonParseForm); });

            thr.SetApartmentState(ApartmentState.STA);
            thr.Start();
            this.Visible = false;
            while (!hexagonParseForm.IsDisposed)
            {
                Thread.Sleep(10);
            }

            this.Visible = true;

            var parsedContent = (string)returnable.O;

            if (parsedContent != null)
            {
                var parsedId  = int.Parse(parsedContent);
                var itemIndex = LocalDataHolder.Part_SelectAll().FindIndex(t => t.Id == parsedId);
                if (itemIndex != -1)
                {
                    listBoxParts.SelectedIndex = itemIndex;
                }
            }
        }
Example #2
0
        private void FillData()
        {
            listBoxParts.Items.Clear();
            listBoxCountries.Items.Clear();
            listBoxManufacturers.Items.Clear();

            LocalDataHolder.Part_SelectAll()
            .ForEach(part => listBoxParts.Items.Add($"{part.Id}: {part.Name}"));
            LocalDataHolder.Country_SelectAll()
            .ForEach(country => listBoxCountries.Items.Add($"{country.Id}: {country.Name}"));
            LocalDataHolder.Manufacturers_SelectAll().ForEach(manufacturer =>
                                                              listBoxManufacturers.Items.Add($"{manufacturer.Id}: {manufacturer.Name}"));

            comboBoxPartCountry.Items.Clear();
            comboBoxPartManufacturer.Items.Clear();

            var countries = LocalDataHolder.Country_SelectAll();

            countries.ForEach(country =>
                              comboBoxPartCountry.Items.Add($"{country.Id}: {country.Name}"));

            var manufacturers = LocalDataHolder.Manufacturers_SelectAll();

            manufacturers.ForEach(manufacturer =>
                                  comboBoxPartManufacturer.Items.Add($"{manufacturer.Id}: {manufacturer.Name}"));
        }