Пример #1
0
        private void btnPromeniVarijantu_Click(object sender, EventArgs e)
        {
            if (lstVarijante.SelectedItem == null)
            {
                return;
            }

            if (!chbTablicniElement.Checked)
            {
                element.ponistiPolozajUTablici();
            }
            else
            {
                if (Element.isValidBrojPodBroj(txtBroj.Text))
                {
                    setPolozajUTabliciFromUI();
                }
                else
                {
                    MessageBox.Show("Unesite ispravan broj.", "Greska");
                    txtBroj.Focus();
                    return;
                }
            }
            Element     varijanta = (Element)lstVarijante.SelectedItem;
            ElementForm form      = new ElementForm(varijanta);

            if (form.ShowDialog() == DialogResult.OK)
            {
                updateVarijanteUI();
            }
        }
Пример #2
0
        private void btnDodaj_Click(object sender, EventArgs e)
        {
            ElementForm form = new ElementForm(null, elementBrowserControl1.selectedSprava(),
                                               null, true);

            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            elementi.Add(form.Element);
            elementBrowserControl1.setElementi(elementi);
            elementBrowserControl1.selektuj(form.Element);
        }
Пример #3
0
        private void btnDodajVarijantu_Click(object sender, EventArgs e)
        {
            if (!chbTablicniElement.Checked)
            {
                element.ponistiPolozajUTablici();
            }
            else
            {
                if (cmbSprava.SelectedIndex == -1)
                {
                    MessageBox.Show("Izaberite spravu.", "Greska");
                    cmbSprava.Focus();
                    return;
                }
                else if (cmbGrupa.SelectedIndex == -1)
                {
                    MessageBox.Show("Izaberite grupu.", "Greska");
                    cmbGrupa.Focus();
                    return;
                }
                else if (cmbTezina.SelectedIndex == -1)
                {
                    MessageBox.Show("Izaberite tezinu.", "Greska");
                    cmbTezina.Focus();
                    return;
                }
                else if (!Element.isValidBrojPodBroj(txtBroj.Text))
                {
                    MessageBox.Show("Unesite ispravan broj.", "Greska");
                    txtBroj.Focus();
                    return;
                }
                else
                {
                    setPolozajUTabliciFromUI();
                }
            }
            ElementForm form = new ElementForm(null, selectedSprava(),
                                               element, false);

            if (form.ShowDialog() == DialogResult.OK)
            {
                element.dodajVarijantu(form.Element);
                updateVarijanteUI();
            }
        }
Пример #4
0
        private void mnDodajElement_Click(object sender, EventArgs e)
        {
            if (clickedItem == null || clickedItem.Element != null)
            {
                return;
            }

            clearClipboard();
            ElementForm form = new ElementForm(null, selectedSprava(), selectedGrupa(),
                                               clickedItem.Broj, Element.getTezina(clickedItem.Broj));

            if (form.ShowDialog() == DialogResult.OK)
            {
                tabela.addElement(form.Element, false);
                panelTabela.Invalidate();
                panelTabela.Focus();
            }
        }
Пример #5
0
        private void btnNoviElement_Click(object sender, EventArgs e)
        {
            disableTrackBar();
            clearClipboard();
            ElementForm form = new ElementForm(selectedSprava(), selectedGrupa());

            if (form.ShowDialog() == DialogResult.OK)
            {
                Element element = form.Element;
                tabela.addElement(element, false);

                // Addind new element can extend the table, so we need to calculate virtual client area.
                odrediVirtuelnuClientOblast();

                scrollItemToClientCenter(element.Broj);

                panelTabela.Invalidate();
            }
            panelTabela.Focus();
        }
Пример #6
0
        private void mnPromeniElement_Click(object sender, EventArgs e)
        {
            if (clickedItem == null || clickedItem.Element == null)
            {
                return;
            }

            clearClipboard();
            Element     element = clickedItem.Element;
            ElementForm form    = new ElementForm(element.Id, element.Sprava, element.Grupa,
                                                  element.Broj, element.Tezina);

            if (form.ShowDialog() == DialogResult.OK)
            {
                tabela.promeniElement(element, form.Element);
                clickedItem.Element = form.Element;
                panelTabela.Invalidate();
                panelTabela.Focus();
            }
        }
Пример #7
0
        private void btnDodaj_Click(object sender, EventArgs e)
        {
            ElementForm form = new ElementForm(null, elementBrowserControl1.selectedSprava(),
                null, true);
            if (form.ShowDialog() == DialogResult.OK)
            {
                if (form.Element.Sprava == elementBrowserControl1.selectedSprava())
                {
                    // TODO: Razmisli sta bi trebalo raditi kada element nije u skladu sa filterom

                    elementi.Add(form.Element);
                    elementBrowserControl1.setElementi(elementi);
                    elementBrowserControl1.selektuj(form.Element);
                }
                else
                {
                    MessageBox.Show("Mozete da dodate element samo za spravu " +
                        "za koju birate elemente.", "Greska");
                }
            }
        }
Пример #8
0
        private void btnDodajSliku_Click(object sender, EventArgs e)
        {
            string relFileNamePath = ElementForm.getAppRelativeFileNamePathFromUser();

            if (relFileNamePath != null)
            {
                if (findSlika(relFileNamePath) != null)
                {
                    MessageBox.Show(
                        "Slika: " + relFileNamePath + " vec postoji za dati element.", "Greska");
                    return;
                }
                else
                {
                    Slika s = new Slika(relFileNamePath, false, 100);
                    element.dodajSliku(s);
                    refreshLstSlike();
                    selectSlika(s);
                }
            }
        }
Пример #9
0
        private void btnDodaj_Click(object sender, EventArgs e)
        {
            ElementForm form = new ElementForm(null, elementBrowserControl1.selectedSprava(),
                                               null, true);

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (form.Element.Sprava == elementBrowserControl1.selectedSprava())
                {
                    // TODO: Razmisli sta bi trebalo raditi kada element nije u skladu sa filterom

                    elementi.Add(form.Element);
                    elementBrowserControl1.setElementi(elementi);
                    elementBrowserControl1.selektuj(form.Element);
                }
                else
                {
                    MessageBox.Show("Mozete da dodate element samo za spravu " +
                                    "za koju birate elemente.", "Greska");
                }
            }
        }
Пример #10
0
        private void btnPromeni_Click(object sender, EventArgs e)
        {
            IList <Element> selItems = elementBrowserControl1.DataGridViewUserControl
                                       .getSelectedItems <Element>();

            if (selItems.Count != 1)
            {
                return;
            }

            Element     element = selItems[0];
            int         index   = elementi.IndexOf(element);
            ElementForm form    = new ElementForm(element.Id, element.Sprava,
                                                  element.Parent, true);

            if (form.ShowDialog() == DialogResult.OK)
            {
                elementi[index] = form.Element;
                elementBrowserControl1.setElementi(elementi);
                elementBrowserControl1.DataGridViewUserControl.refreshItems();
                elementBrowserControl1.selektuj(form.Element);
            }
        }
Пример #11
0
        private void mnPromeniElement_Click(object sender, EventArgs e)
        {
            if (clickedItem == null || clickedItem.Element == null)
                return;

            clearClipboard();
            Element element = clickedItem.Element;
            ElementForm form = new ElementForm(element.Id, element.Sprava, element.Grupa,
                element.Broj, element.Tezina);
            if (form.ShowDialog() == DialogResult.OK)
            {
                tabela.promeniElement(element, form.Element);
                clickedItem.Element = form.Element;
                panelTabela.Invalidate();
                panelTabela.Focus();
            }
        }
Пример #12
0
        private void mnDodajElement_Click(object sender, EventArgs e)
        {
            if (clickedItem == null || clickedItem.Element != null)
                return;

            clearClipboard();
            ElementForm form = new ElementForm(null, selectedSprava(), selectedGrupa(),
                clickedItem.Broj, Element.getTezina(clickedItem.Broj));
            if (form.ShowDialog() == DialogResult.OK)
            {
                tabela.addElement(form.Element, false);
                panelTabela.Invalidate();
                panelTabela.Focus();
            }
        }
Пример #13
0
        private void btnNoviElement_Click(object sender, EventArgs e)
        {
            disableTrackBar();
            clearClipboard();
            ElementForm form = new ElementForm(selectedSprava(), selectedGrupa());
            if (form.ShowDialog() == DialogResult.OK)
            {
                Element element = form.Element;
                tabela.addElement(element, false);

                // Addind new element can extend the table, so we need to calculate virtual client area.
                odrediVirtuelnuClientOblast();

                scrollItemToClientCenter(element.Broj);

                panelTabela.Invalidate();
            }
            panelTabela.Focus();
        }
Пример #14
0
        private void btnPromeniVarijantu_Click(object sender, EventArgs e)
        {
            if (lstVarijante.SelectedItem == null)
                return;

            if (!chbTablicniElement.Checked)
                element.ponistiPolozajUTablici();
            else
            {
                if (Element.isValidBrojPodBroj(txtBroj.Text))
                    setPolozajUTabliciFromUI();
                else
                {
                    MessageBox.Show("Unesite ispravan broj.", "Greska");
                    txtBroj.Focus();
                    return;
                }
            }
            Element varijanta = (Element)lstVarijante.SelectedItem;
            ElementForm form = new ElementForm(varijanta);
            if (form.ShowDialog() == DialogResult.OK)
            {
                updateVarijanteUI();
            }
        }
Пример #15
0
 private void btnDodajVarijantu_Click(object sender, EventArgs e)
 {
     if (!chbTablicniElement.Checked)
         element.ponistiPolozajUTablici();
     else
     {
         if (cmbSprava.SelectedIndex == -1)
         {
             MessageBox.Show("Izaberite spravu.", "Greska");
             cmbSprava.Focus();
             return;
         }
         else if (cmbGrupa.SelectedIndex == -1)
         {
             MessageBox.Show("Izaberite grupu.", "Greska");
             cmbGrupa.Focus();
             return;
         }
         else if (cmbTezina.SelectedIndex == -1)
         {
             MessageBox.Show("Izaberite tezinu.", "Greska");
             cmbTezina.Focus();
             return;
         }
         else if (!Element.isValidBrojPodBroj(txtBroj.Text))
         {
             MessageBox.Show("Unesite ispravan broj.", "Greska");
             txtBroj.Focus();
             return;
         }
         else
         {
             setPolozajUTabliciFromUI();
         }
     }
     ElementForm form = new ElementForm(null, selectedSprava(),
         element, false);
     if (form.ShowDialog() == DialogResult.OK)
     {
         element.dodajVarijantu(form.Element);
         updateVarijanteUI();
     }
 }