Exemple #1
0
        /* События */

        /// <summary>
        /// Событие выбора элемента списка знаков
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listSigns_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                int index = ((ListBox)sender).SelectedIndex;

                if (index != -1)
                {
                    ImageWorker IM   = new ImageWorker();
                    road_sign   sign = PE.road_sign.ToArray <road_sign>()[index];

                    pbImage.BackgroundImage = IM.GetImageByRelativePath(sign.img);

                    tbType.Text        = PE.type_road_sign.Where(x => x.code_type_road_sign == sign.code_type_sign).First().name;
                    tbDescription.Text = sign.description;

                    listResolution.Items.Clear();
                    listProhibishin.Items.Clear();

                    foreach (act item in PE.item_list_resolution.Where(x => x.code_road_sign == sign.code_road_sign).Select(x => x.act))
                    {
                        listResolution.Items.Add(item.name);
                    }

                    foreach (act item in PE.item_list_prohibition.Where(x => x.code_road_sign == sign.code_road_sign).Select(x => x.act))
                    {
                        listProhibishin.Items.Add(item.name);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
        }
Exemple #2
0
        /// <summary>
        /// Добавление знака в контейнер выбранных знаков
        /// </summary>
        /// <param name="sign"></param>
        private void AddToFlowSelectedSigns(road_sign sign)
        {
            try
            {
                foreach (PictureBox item in flowListSelectedSign.Controls)
                {
                    if (item.Tag != null && item.Tag.ToString() == sign.pdd_number)
                    {
                        return;
                    }
                }

                ImageWorker IM = new ImageWorker();

                PictureBox pb = new PictureBox();
                pb.BackgroundImage       = IM.GetImageByRelativePath(sign.img);
                pb.Width                 = 64;
                pb.Height                = 64;
                pb.Tag                   = sign.pdd_number;
                pb.BackgroundImageLayout = ImageLayout.Stretch;

                flowListSelectedSign.Controls.Add(pb);
                SelectedSign.Add(sign);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
        }
        public SignPanel(road_sign sign, Bitmap image, MainWindow parent)
        {
            InitializeComponent();

            this.Sign         = sign;
            this.ParentWindow = parent;

            this.lbNumber.Text      = sign.pdd_number;
            this.tnName.Text        = sign.name;
            this.cbSelected.Checked = false;

            ImageWorker IW = new ImageWorker();

            pbImage.BackgroundImage = IW.GetImageByRelativePath(sign.img);
        }
Exemple #4
0
        /// <summary>
        /// Заполнение панели знаками одного типа
        /// </summary>
        /// <param name="newFlow"></param>
        /// <param name="type"></param>
        private void SetSignInFlow(FlowLayoutPanel newFlow, long type)
        {
            try
            {
                List <road_sign> list = CreateGroupPanel(type);
                ImageWorker      IM   = new ImageWorker();

                foreach (road_sign item in list)
                {
                    newFlow.Controls.Add(new SignPanel(item, IM.GetImageByRelativePath(item.img), this));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
        }