Example #1
0
        public JoinView(ProducerDto producer, List <ProducerDto> producers)
        {
            _producers = producers;

            Text   = "Объединение производителей";
            Width  = 400;
            Height = 500;
            var accept = ((Button)AcceptButton);

            accept.Text  = "Объединить";
            AcceptButton = null;

            var searcher = new ProducerSearcher(_producers);

            table.Controls.Add(new Label {
                Padding  = new Padding(0, 5, 0, 0),
                AutoSize = true,
                Text     = String.Format("Объединить выбранного производителя с {0}.", producer.Name)
            }, 0, 0);
            table.Controls.Add(new Label {
                Padding  = new Padding(0, 0, 0, 5),
                AutoSize = true,
                Text     = "Выбранный прозводитель будет удален."
            }, 0, 1);
            table.Controls.Add(searcher.ToolStrip, 0, 2);
            table.Controls.Add(searcher.Table.Host, 0, 3);

            Shown += (sender, args) => searcher.SearchText.Focus();

            accept.InputMap().Click(() => Join(searcher.Table.Selected <ProducerDto>(), producer));
            searcher.Table.Host.InputMap().KeyDown(Keys.Enter, () => Join(searcher.Table.Selected <ProducerDto>(), producer));
        }
Example #2
0
        public AddToAssortmentView(ExcludeDto exclude, List <ProducerDto> producers)
        {
            Text   = "Добавление в ассортимент";
            Width  = 400;
            Height = 500;
            var accept = ((Button)AcceptButton);

            accept.Text  = "Добавить";
            AcceptButton = null;

            var createEquivalent = new CheckBox {
                AutoSize = true,
                Text     = "Создать новый эквивалент?",
                Checked  = true
            };

            table.Controls.Add(createEquivalent, 0, 0);
            var equivalent = new TextBox {
                Width = 200,
                Text  = exclude.ProducerSynonym
            };

            table.Controls.Add(equivalent, 1, 0);
            table.Controls.Add(new Label {
                Text     = "Выберете производителя",
                AutoSize = true,
            }, 0, 1);
            var searcher = new ProducerSearcher(producers);

            Shown += (s, a) => searcher.SearchText.Focus();

            table.Controls.Add(searcher.ToolStrip, 0, 2);
            table.Controls.Add(searcher.Table.Host, 0, 3);

            accept.InputMap().Click(() => Add(searcher.Table.Selected <ProducerDto>(), equivalent.Text, createEquivalent.Checked, exclude));
            searcher.Table.Host.InputMap().KeyDown(Keys.Enter, () => Add(searcher.Table.Selected <ProducerDto>(), equivalent.Text, createEquivalent.Checked, exclude));
        }