Esempio n. 1
0
 protected void OnSingOutActionActivated(object sender, EventArgs e)
 {
     zaposlenik        = null;
     notebookMain.Page = 0;
     LoginWindow l = new LoginWindow(this);
 }
Esempio n. 2
0
        public MainWindow() : base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            DB.OpenConnection();

            LoginWindow login = new LoginWindow(this);

            stavkeChanged += () => RefreshStatusNodeView();

            narudzbeNodeStore = new NarudzbeNodeStore(true);
            current           = new StavkaNarudzbeNodeStore();

            fixedrestoransheme.HideToolbox();
            notebookMain.CurrentPage = 0;

            //NodeView za prikaz narudžbi
            nodeviewNarudzbe.AppendColumn("Broj narudžbe", new CellRendererText(), "text", 0).MinWidth = 200;
            nodeviewNarudzbe.AppendColumn("Datum", new CellRendererText(), "text", 1).MinWidth         = 150;
            nodeviewNarudzbe.AppendColumn("Oznaka stola", new CellRendererText(), "text", 2).MinWidth  = 100;
            nodeviewNarudzbe.AppendColumn("Ukupno", new CellRendererText(), "text", 3).MinWidth        = 100;
            nodeviewNarudzbe.NodeStore = narudzbeNodeStore;

            //NodeView za prikaz statusa stavaka narudzbi
            CellRendererText   statusText   = new CellRendererText();
            CellRendererPixbuf statusPixbuf = new CellRendererPixbuf();

            TreeViewColumn statusColumn = new TreeViewColumn();

            statusColumn.Title    = "Status";
            statusColumn.MinWidth = 100;
            statusColumn.PackStart(statusPixbuf, false);
            statusColumn.PackStart(statusText, true);
            statusColumn.AddAttribute(statusPixbuf, "pixbuf", 5);
            statusColumn.AddAttribute(statusText, "text", 6);

            nodeviewNarudzbeStatus.AppendColumn("Šifra artikla", new CellRendererText(), "text", 0).MinWidth = 150;
            nodeviewNarudzbeStatus.AppendColumn("Naziv artikla", new CellRendererText(), "text", 1).MinWidth = 150;
            nodeviewNarudzbeStatus.AppendColumn("Količina", new CellRendererText(), "text", 3).MinWidth      = 70;
            nodeviewNarudzbeStatus.AppendColumn("Oznaka stola", new CellRendererText(), "text", 7).MinWidth  = 100;
            nodeviewNarudzbeStatus.AppendColumn(statusColumn);

            //Odabir prikaza stavaka prema statusu ili sve
            ListStore dropdownStatusListStore = new ListStore(typeof(Pixbuf), typeof(string));

            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.SveAktivne.png").ScaleSimple(20, 20, InterpType.Bilinear), "Sve aktivne");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.NaCekanju.png").ScaleSimple(20, 20, InterpType.Bilinear), "Na čekanju");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.UObradi.png").ScaleSimple(20, 20, InterpType.Bilinear), "U obradi");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Gotovo.png").ScaleSimple(20, 20, InterpType.Bilinear), "Gotovo");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Dostavljeno.png").ScaleSimple(20, 20, InterpType.Bilinear), "Dostavljeno");
            dropdownStatusListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Sve.png").ScaleSimple(20, 20, InterpType.Bilinear), "Sve");

            comboboxStatus.Model = dropdownStatusListStore;
            comboboxStatus.PackStart(statusPixbuf, false);
            comboboxStatus.PackStart(statusText, true);
            comboboxStatus.AddAttribute(statusPixbuf, "pixbuf", 0);
            comboboxStatus.AddAttribute(statusText, "text", 1);
            comboboxStatus.Active = 0;

            //Odabir prikaza statusa stavaka svih ili trenutne narudzbe
            ListStore dropdownSveTrenutnoListStore = new ListStore(typeof(Pixbuf), typeof(string));

            dropdownSveTrenutnoListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Sve.png").ScaleSimple(20, 20, InterpType.Bilinear), "Sve");
            dropdownSveTrenutnoListStore.AppendValues(Pixbuf.LoadFromResource("NewRestoran.images.Selected.png").ScaleSimple(20, 20, InterpType.Bilinear), "Pojedinačno");

            CellRendererText   sveTrenutnoText   = new CellRendererText();
            CellRendererPixbuf sveTrenutnoPixbuf = new CellRendererPixbuf();

            comboboxSveTrenutna.Model = dropdownSveTrenutnoListStore;
            comboboxSveTrenutna.PackStart(sveTrenutnoPixbuf, false);
            comboboxSveTrenutna.PackStart(sveTrenutnoText, true);
            comboboxSveTrenutna.AddAttribute(sveTrenutnoPixbuf, "pixbuf", 0);
            comboboxSveTrenutna.AddAttribute(sveTrenutnoText, "text", 1);
            comboboxSveTrenutna.Active = 0;

            CellRendererText   stolText   = new CellRendererText();
            CellRendererPixbuf stolPixbuf = new CellRendererPixbuf();

            comboboxOznakaStola.PackStart(stolPixbuf, false);
            comboboxOznakaStola.PackStart(stolText, true);
            comboboxOznakaStola.AddAttribute(stolPixbuf, "pixbuf", 0);
            comboboxOznakaStola.AddAttribute(stolText, "text", 1);
            Pixbuf table2chairs = Pixbuf.LoadFromResource("NewRestoran.images.table2chairs.png").ScaleSimple(20, 20, InterpType.Bilinear);
            Pixbuf table4chairs = Pixbuf.LoadFromResource("NewRestoran.images.table4chairs.png").ScaleSimple(20, 20, InterpType.Bilinear);
            Pixbuf table6chairs = Pixbuf.LoadFromResource("NewRestoran.images.table6chairs.png").ScaleSimple(20, 20, InterpType.Bilinear);
            Pixbuf table8chairs = Pixbuf.LoadFromResource("NewRestoran.images.table8chairs.png").ScaleSimple(20, 20, InterpType.Bilinear);

            nodeviewNarudzbe.HeightRequest = nodeviewNarudzbeStatus.HeightRequest = GtkScrolledWindowNarudzbe.HeightRequest =
                GtkScrolledWindowStatusStavaka.HeightRequest = Gdk.Screen.Default.Height / 3;
            fixed5.HeightRequest = nodeviewNarudzbe.HeightRequest + 100;

            //Prikazivanje ili sakrivanje gumbova ovisno o fokusu
            vboxStatusButtons.Hide();
            nodeviewNarudzbeStatus.FocusInEvent  += (o, args) => { vboxStatusButtons.Show(); vboxNarudzbeButtons.Hide(); };
            nodeviewNarudzbeStatus.FocusOutEvent += (o, args) => { vboxStatusButtons.Hide(); vboxNarudzbeButtons.Show(); };
            nodeviewNarudzbe.Selection.Changed   += NodeSelectionChanged;

            this.Resize(fixedrestoransheme.Width + nodeviewNarudzbe.WidthRequest + 170, fixedrestoransheme.Height + 170);
            Color c = new Color();

            Color.Parse("#00bd00", ref c);
            labelSpremljen.ModifyFg(StateType.Normal, c);
            labelSpremljen.ModifyFont(Pango.FontDescription.FromString("bold 16"));

            ForAll <Label>(l => l.ModifyFont(Pango.FontDescription.FromString("bold 10")), new Container[] { hbox8, hbox9, hbox10, hbox11 });
            notebookMain.ShowTabs = false;

            stolChanged += () => {
                ListStore stolOznaka = new ListStore(typeof(Pixbuf), typeof(string));
                StoloviPresenter.stoloviList.ForEach(s => {
                    switch (s.BrojStolica)
                    {
                    case 2: stolOznaka.AppendValues(table2chairs, s.Oznaka); break;

                    case 4: stolOznaka.AppendValues(table4chairs, s.Oznaka); break;

                    case 6: stolOznaka.AppendValues(table6chairs, s.Oznaka); break;

                    case 8: stolOznaka.AppendValues(table8chairs, s.Oznaka); break;

                    default: stolOznaka.AppendValues(null, s.Oznaka); break;
                    }
                });
                comboboxOznakaStola.Model = stolOznaka;
                narudzbeNodeStore.Refresh();
                RefreshStatusNodeView();
            };

            artiklStavkeChanged += () => { narudzbeNodeStore.Refresh(); RefreshStatusNodeView(); };

            stolChanged();

            RefreshStatusNodeView();
            fixedrestoransheme.TableSelected += FixedRestoranShemeTableSelected;
            nodeviewNarudzbe.GrabFocus();
        }