Example #1
0
        private void PositionBlank_Click(object sender, MouseButtonEventArgs e)
        {
            if (sender is PositionBlank)
            {
                if (SelectedBuff != null)
                {
                    SelectedBuff.ChangeBackground(Brushes.LightGray);
                }

                if (SelectedBuff == sender as PositionBlank)
                {
                    ChangeRow.Height = new GridLength(0);
                    SelectedBuff     = null;
                }
                else
                {
                    //SelectedBuff.ChangeBackground(Brushes.LightGray);
                    SelectedBuff  = sender as PositionBlank;
                    ProdName.Text = SelectedBuff.GetNames();
                    if (SelectedBuff.GetPosition() == 1)
                    {
                        InsertAmount.Text = Convert.ToString(SelectedBuff.GetAmount());
                        ChangeRow.Height  = new GridLength(0);
                    }
                    else
                    {
                        InsertAmount.Text = "0";
                        ChangeRow.Height  = new GridLength(50);
                    }
                }
            }
        }
Example #2
0
        private async void ReadStorage()
        {
            int i;

            ProductInfo[] ReadInfo;
            ReadInfo = StructWorkClass.ReadBasicStorage(SectionId);
            Storage  = new PositionBlank[ReadInfo.Length];
            for (i = 0; i < ReadInfo.Length; i++)
            {
                Storage[i]            = new PositionBlank(i, ReadInfo[i].Name, ReadInfo[i].Amount, ReadInfo[i].Id, ReadInfo[i].Price, 0);
                Storage[i].MouseDown += PositionBlank_Click;
                StorageViewer.Children.Add(Storage[i]);
            }
        }
Example #3
0
        private void AddCart()
        {
            int CurId     = SelectedBuff.GetId();
            int CurAmount = Convert.ToInt32(InsertAmount.Text);
            int a         = Court.Length;

            Array.Resize(ref Court, Court.Length + 1);

            Court[a]            = new PositionBlank(CurId, Storage[CurId].GetNames(), CurAmount, Storage[CurId].GetProductId(), Storage[CurId].GetAmount(), 1);
            Court[a].MouseDown += PositionBlank_Click;

            Storage[CurId].ChangeAmount(Storage[CurId].GetAmount() - CurAmount);

            CourtViewer.Children.Add(Court[a]);
        }
Example #4
0
        private void ClearBtm_MouseDown(object sender, MouseButtonEventArgs e)
        {
            int buff;
            int i;
            int id;

            SelectedBuff = null;
            for (i = 0; i < Court.Length; i++)
            {
                id   = Court[i].GetId();
                buff = Storage[id].GetAmount() + Court[i].GetAmount();
                Storage[id].ChangeAmount(buff);
            }
            CourtViewer.Children.Clear();
            Court = new PositionBlank[0];
        }
Example #5
0
 private void DeleteCourtElement()
 {
     if (SelectedBuff != null)
     {
         int             id;
         int             buff;
         int             i;
         int             j        = 0;
         PositionBlank[] NewCourt = new PositionBlank[Court.Length - 1];
         id   = SelectedBuff.GetId();
         buff = Storage[id].GetAmount() + SelectedBuff.GetAmount();
         Storage[id].ChangeAmount(buff);
         CourtViewer.Children.Remove(SelectedBuff);
         for (i = 0; i < Court.Length; i++)
         {
             if (Court[i] != SelectedBuff)
             {
                 NewCourt[j] = Court[i];
                 j++;
             }
         }
         Court = NewCourt;
     }
 }