Esempio n. 1
0
 public BackableForm(Root root, IParentForm parent, string name)
 {
     _Parent = parent;
     _RefRoot = root;
     _RefThis = new MetroForm(_Root, name, 1136, 720, OnBack);
     _This.Tag = this;
     if (_Parent.GetType().BaseType == typeof(MetroForm))
     {
         _Parent.AnimateHideForm((sn, ev) =>
         {
             ((MetroForm)_Parent).Hide(((MetroForm)_Parent));
         });
     }
     else
     {
         IParentForm parentAtTaskBar = _Parent;
         while (((BackableForm)parentAtTaskBar)._Parent.GetType() != typeof(MainForm))
         {
             parentAtTaskBar = ((BackableForm)parentAtTaskBar)._Parent;
         }
         _Parent.AnimateHideForm((sn, ev) =>
         {
             ((BackableForm) parentAtTaskBar)._This.Hide(((BackableForm) parentAtTaskBar)._This);
         });
     }
 }
Esempio n. 2
0
 public StoreFurnituresForm(Root root, MetroForm parent) : base(root, parent, Root.GetMsg("main.menu.store-furnitures"))
 {
     _This.InsertActionButtons(Root.GetMsg("stfu.action.reload"), Properties.Resources.reload, (sender, e) => { ReloadItems(); });
     _This.InsertActionButtons(Root.GetMsg("stfu.action.search"), Properties.Resources.search, ActionSearch);
     _This.InsertActionButtons(Root.GetMsg("stfu.action.order-cart"), Properties.Resources.receipt, ActionOrder);
     _This.InsertActionButtons(Root.GetMsg("stfu.action.shopping-cart"), Properties.Resources.cart, ActionCheckout);
     // add furnitures
     ItemList.Size = _This.ContentPanel.Size;
     _This.ContentPanel.Controls.Add(ItemList);
     ReloadItems();
 }
Esempio n. 3
0
 public GenerateSalesReportForm(Root root, MetroForm parent) : base(root, parent, Root.GetMsg("main.menu.sales-report"))
 {
     WebBrowser Preview = new WebBrowser();
     _This.InsertActionButtons(Root.GetMsg("gsrp.print"), Properties.Resources.print, (sender, e) =>
     {
         Printing.PrintPage(_Root, Preview.DocumentText);
     });
     Preview.Size = new Size(_This.ContentPanel.Width, _This.ContentPanel.Height);
     Preview.DocumentText = GetReportContent();
     _This.ContentPanel.Controls.Add(Preview);
 }
Esempio n. 4
0
 public SendReorderReportForm(Root root, MetroForm parent) : base(root, parent, Root.GetMsg("main.menu.reorder-report"))
 {
     _This.InsertActionButtons(Root.GetMsg("snrp.send"), Properties.Resources.send, (sender, e) =>
     {
         if (!NilRecord)
         {
             XQL.UpdateQuantity(UpdateQtySql);
             MessageBox.Show(Root.GetMsg("snrp.reorder-report-sent"), Root.GetMsg("ui.info"));
             OnBack();
         }
         else MessageBox.Show(Root.GetMsg("snrp.empty-reorder"), Root.GetMsg("ui.warn"));
     });
     WebBrowser Preview = new WebBrowser();
     Preview.Size = new Size(_This.ContentPanel.Width, _This.ContentPanel.Height);
     Preview.DocumentText = GetReportContent();
     _This.ContentPanel.Controls.Add(Preview);
 }
Esempio n. 5
0
        public SendDeliveryReportForm(Root root, MetroForm parent) : base(root, parent, Root.GetMsg("main.menu.delivery-report"))
        {
            _This.InsertActionButtons(Root.GetMsg("snrp.send"), Properties.Resources.send, (sender, e) =>
            {
                if (null != SelectedReport)
                {
                    File.Delete(SelectedReport);
                    Reset();
                }
                else MessageBox.Show(Root.GetMsg("snrp.choose-report"), Root.GetMsg("ui.warn"));
            });
            RecordList.Size = new Size(360, _This.ContentPanel.Height);
            _This.ContentPanel.Controls.Add(RecordList);
            Preview.Size = new Size(_This.ContentPanel.Width - 361, _This.ContentPanel.Height);
            Preview.Left = 361;
            _This.ContentPanel.Controls.Add(Preview);

            Reset();
        }
Esempio n. 6
0
        public MetroForm(Root p, string name, int width, int height, EventHandler onBack = null)
        {
            _RRoot = p;
            _RThis = this;
            Flag_IsSecondary = null != onBack;
            this.SuspendLayout();
            this.DoubleBuffered = true;
            this.FormBorderStyle = FormBorderStyle.None;
            this.Icon = Properties.Resources.logo;
            this.Size = new Size(width, height);
            this.BackColor = Color.FromArgb(34, 34, 34);
            this.ForeColor = Color.White;
            this.CenterToScreen();
            this.Activated += OnFormResumed;
            this.FormClosed += OnFormClosed;
            this.DoubleBuffered = true;
            ContentPanel.Visible = false;
            // title
            Title = new Label();
            Title.Anchor = AnchorStyles.Top | AnchorStyles.Left;
            Title.Font = new Font("Segoe UI Light", 20);
            Title.Text = name;
            this.Text = name;
            Title.AutoSize = true;
            if (Flag_IsSecondary)
            {
                MetroButton back = new MetroButton(border: 0);
                back.Size = new Size(32, 32);
                Title.Location = new Point(back.Width + 16 * 2, 16);
                back.BackgroundImage = Properties.Resources.form_back;
                back.BackgroundImageLayout = ImageLayout.Center;
                DarkToolTip tt = new DarkToolTip();
                tt.SetToolTip(back, Root.GetMsg("ui.back"));
                back.Location = new Point(16, 16 + Title.Top - Title.Height / 2);
                back.Click += onBack;
                this.Controls.Add(back);
            }
            else Title.Location = new Point(16, 16);
            this.Controls.Add(Title);
            // close button
            InsertActionButtons(Root.GetMsg("ui.close"), Properties.Resources.form_close, (sender, e) =>
            {
                AnimateHideForm(CloseFormAction);
            });
            // minimize button
            InsertActionButtons(Root.GetMsg("ui.minimize"), Properties.Resources.form_minimize, (sender, e) =>
            {
                AnimateHideForm(MinimizeFormAction);
            });
            if (Root.CurrentStaff != null)
            {
                InsertCurrentUser(Root.CurrentStaff.Name);
                InsertActionButtons(Root.GetMsg("ui.logout"), Properties.Resources.logout, (sender, e) =>
                {
                    _Root.NotifyLoggedOut();
                });
            }
            // avoid overlap painted border
            ContentPanel.Anchor = AnchorStyles.Top | AnchorStyles.Left;
            ContentPanel.Left = 1;
            ContentPanel.Top = Title.Height + Title.Top * 2;
            ContentPanel.Size = new Size(width - 2, height - ContentPanel.Top - 1);
            this.Controls.Add(ContentPanel);

            // hide immediately prepare for animation
            // form next will call Activated => FormResumed
            this.Opacity = 0;
            this.CenterToScreen();
            this.Top += 80;
            this.ResumeLayout(false);
        }