示例#1
0
        private void SettingTableSize_Loaded(object sender, RoutedEventArgs e)
        {
            txtWidth.Text  = ReadWriteData.readTableSize()[0];
            txtHeight.Text = ReadWriteData.readTableSize()[1];

            string[] result = ReadWriteData.ReadPrinterSetting();
            if (result != null)
            {
                txtReceptionPrinter.Text = result[0];
                txtKitPrinter.Text       = result[1];
                txtBarPrinter.Text       = result[2];

                if (int.Parse(result[3]) == 1)
                {
                    chbShowReviewWin.IsChecked = true;
                }
                else
                {
                    chbShowReviewWin.IsChecked = false;
                }
            }
            else
            {
                txtReceptionPrinter.Text   = "";
                txtKitPrinter.Text         = "";
                txtBarPrinter.Text         = "";
                chbShowReviewWin.IsChecked = true;
            }

            isLoading = false;
        }
示例#2
0
        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            txtWidth.Text  = ReadWriteData.readTableSize()[0];
            txtHeight.Text = ReadWriteData.readTableSize()[1];

            btnApply.Background = Brushes.Orange;
        }
示例#3
0
        //su kien khi chon add new tu popup menu
        private void addNewTable_Click(object sender, RoutedEventArgs e)
        {
            maxTableCurrentNumber++;
            buttonTableCurrentNumber++;

            Rectangle rec = new Rectangle();

            if (maxTableCurrentNumber < 10)
            {
                rec.Name = "table" + "0" + maxTableCurrentNumber.ToString();
            }
            else
            {
                rec.Name = "table" + maxTableCurrentNumber.ToString();
            }

            rec.HorizontalAlignment = HorizontalAlignment.Left;
            rec.VerticalAlignment   = VerticalAlignment.Top;
            Thickness m = rec.Margin;

            m.Left     = Convert.ToInt32(currentPosition.X);
            m.Top      = Convert.ToInt32(currentPosition.Y);
            rec.Margin = m;
            rec.Width  = int.Parse(ReadWriteData.readTableSize()[0]);
            rec.Height = int.Parse(ReadWriteData.readTableSize()[1]);
            //rec.Fill = Brushes.Red;
            rec.Opacity = 0.65;

            rec.Fill = new ImageBrush
            {
                ImageSource = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this),
                                                      "..\\Images\\Number\\icons8_" + int.Parse(rec.Name.Substring(5)).ToString() + "_50px.png"))
            };

            rec.MouseLeftButtonDown  += btnTableAdded_StartDrag;
            rec.MouseMove            += btnTableAdded_MoveDrag;
            rec.MouseLeftButtonDown  += btnTableAdded_Click;
            rec.MouseRightButtonDown += btnTableAdded_ContextMenu;

            rec.MouseMove  += btnTableAdded_MouseMove;
            rec.MouseLeave += btnTableAdded_MouseLeave;

            rec.Cursor = Cursors.SizeAll;

            Panel.SetZIndex(rec, 30);
            grTable.Children.Add(rec);

            imgTable.MouseMove           -= crossCursorToAdd;
            imgTable.MouseLeftButtonDown -= changeToNormalCursor;
            iii = 0;

            ckeckPosition(rec, m);

            ((MainWindow)Window.GetWindow(this)).proTable.Maximum += 1;

            currentTableList.Add(ReadWriteData.writeOnAddNew(_unitofwork, rec, App.Current.Properties["EmpLogin"] as Entities.Employee));

            rec.ToolTip = SetTooltip(rec);
        }
        //su kien chang cursor to normal
        private void changeToNormalCursor(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                maxTableCurrentNumber++;
                buttonTableCurrentNumber++;

                currentPosition = e.GetPosition(grTable);

                Rectangle rec = new Rectangle();
                if (maxTableCurrentNumber < 10)
                {
                    rec.Name = "table" + "0" + maxTableCurrentNumber.ToString();
                }
                else
                {
                    rec.Name = "table" + maxTableCurrentNumber.ToString();
                }

                rec.HorizontalAlignment = HorizontalAlignment.Left;
                rec.VerticalAlignment   = VerticalAlignment.Top;
                Thickness m = rec.Margin;
                m.Left      = Convert.ToInt32(currentPosition.X);
                m.Top       = Convert.ToInt32(currentPosition.Y);
                rec.Margin  = m;
                rec.Width   = int.Parse(ReadWriteData.readTableSize()[0]);
                rec.Height  = int.Parse(ReadWriteData.readTableSize()[1]);
                rec.Fill    = Brushes.Red;
                rec.Opacity = 0.65;

                rec.MouseLeftButtonDown  += btnTableAdded_StartDrag;
                rec.MouseMove            += btnTableAdded_MoveDrag;
                rec.MouseLeftButtonDown  += btnTableAdded_Click;
                rec.MouseRightButtonDown += btnTableAdded_ContextMenu;

                rec.MouseMove  += btnTableAdded_MouseMove;
                rec.MouseLeave += btnTableAdded_MouseLeave;

                Panel.SetZIndex(rec, 30);
                grTable.Children.Add(rec);

                (sender as Image).Cursor = Cursors.Arrow;

                imgTable.MouseMove           -= crossCursorToAdd;
                imgTable.MouseLeftButtonDown -= changeToNormalCursor;
                iii = 0;

                ((MainWindow)Window.GetWindow(this)).proTable.Maximum += 1;

                currentTableList.Add(ReadWriteData.writeOnAddNew(_unitofwork, rec, App.Current.Properties["EmpLogin"] as Entities.Employee));

                ((MainWindow)Window.GetWindow(this)).initProgressTableChair();

                rec.ToolTip = SetTooltip(rec);
            }
        }
        //lay thong tin table image, tat ca table hien co
        private void readTableData() //0: tableImagePath; 1: tableRuntimeHistory
        {
            Rectangle rec;
            Thickness m;

            foreach (Entities.Table t in currentTableList)
            {
                if (maxTableCurrentNumber < t.TableNumber)
                {
                    maxTableCurrentNumber = t.TableNumber;
                }
            }

            foreach (Entities.Table t in currentTableList)
            {
                buttonTableCurrentNumber++;

                rec = new Rectangle();
                if (t.TableNumber < 10)
                {
                    rec.Name = "table" + "0" + t.TableNumber;
                }
                else
                {
                    rec.Name = "table" + t.TableNumber;
                }

                rec.HorizontalAlignment = HorizontalAlignment.Left;
                rec.VerticalAlignment   = VerticalAlignment.Top;
                m           = rec.Margin;
                m.Left      = Convert.ToInt32(t.PosX);
                m.Top       = Convert.ToInt32(t.PosY);
                rec.Margin  = m;
                rec.Width   = int.Parse(ReadWriteData.readTableSize()[0]);
                rec.Height  = int.Parse(ReadWriteData.readTableSize()[1]);
                rec.Fill    = Brushes.Red;
                rec.Opacity = 0.65;

                //ImageBrush backImg = new ImageBrush(new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "D:\\icons8_Pin_32px_9.png")));
                //ImageBrush backImg = new ImageBrush(new BitmapImage(new Uri(@"/Icon/icons8_Pin_32px_9.png", UriKind.RelativeOrAbsolute)));
                //backImg.Stretch = Stretch.Fill;
                //rec.Fill = backImg;

                rec.MouseLeftButtonDown += btnTableAdded_StartDrag;
                rec.MouseMove           += btnTableAdded_MoveDrag;
                rec.MouseLeftButtonDown += btnTableAdded_Click;

                rec.Cursor = Cursors.SizeAll;

                imgTable.MouseMove           -= crossCursorToAdd;
                imgTable.MouseLeftButtonDown -= changeToNormalCursor;
                iii = 0;

                if (t.IsPinned == 1)
                {
                    rec.MouseLeftButtonDown -= btnTableAdded_StartDrag;
                    rec.MouseMove           -= btnTableAdded_MoveDrag;
                    rec.Opacity              = 1;
                    rec.Cursor = Cursors.Arrow;
                    rec.SetValue(BitmapEffectProperty, recShadow);
                }
                else
                {
                    rec.Cursor  = Cursors.SizeAll;
                    rec.Fill    = Brushes.Red;
                    rec.Opacity = 0.65;
                }

                if (t.IsOrdered == 1)
                {
                    rec.Fill = Brushes.DarkCyan;
                    rec.SetValue(BitmapEffectProperty, recShadowOrdered);
                }
                else
                {
                    rec.Fill = Brushes.Red;
                }

                rec.MouseMove            += btnTableAdded_MouseMove;
                rec.MouseRightButtonDown += btnTableAdded_ContextMenu;
                rec.MouseLeave           += btnTableAdded_MouseLeave;

                Panel.SetZIndex(rec, 100);
                grTable.Children.Add(rec);

                rec.ToolTip = SetTooltip(rec);

                t.TableRec = rec;
            }
        }