Пример #1
0
        public void GoToNextTransactionEntry()
        {
            try
            {
                if (SalesVM.Instance.TransactionData == null)
                {
                    return;
                }

                SalesVM.Instance.SaveTransaction();

                if (SalesLst.SelectedIndex == SalesLst.Items.Count - 1)
                {
                    padPos = PadPosition.Below;
                    SalesVM.Instance.TransactionData.CurrentTransactionEntry = null;
                    SalesLst.SelectedItem = null;
                    Canvas.SetTop(SalesLst, 0);
                    SalesLst.UpdateLayout();
                    Canvas.SetTop(SalesPad, 0);
                    SalesPad.Margin = SalesPadMargin;
                    Canvas.SetTop(SalesPad, SalesLst.ActualHeight + 8);
                    SetSalesPadtoSelectedItem();
                }
                else
                {
                    SalesLst.SelectedIndex += 1; // selected index don't change when more than list
                }
            }
            catch (Exception ex)
            {
                Logger.Log(LoggingLevel.Error, ex.Message + ex.StackTrace);
                throw ex;
            }
        }
Пример #2
0
        public void MoveSalesPadDown()
        {
            try
            {
                SalesLst.UpdateLayout();
                SalesPad.Margin = SalesPadMargin;


                if (padPos == PadPosition.Above && SalesLst.SelectedIndex != -1)
                {
                    Canvas.SetTop(SalesLst, 0);
                    SetSalesPadtoSelectedItem();
                    padPos = PadPosition.Middle;
                }

                if (padPos == PadPosition.Middle)
                {
                    if (SalesLst.SelectedIndex == -1)
                    {
                        Canvas.SetTop(SalesLst, 0);
                        // SalesPad.Margin = SalesPadMargin;
                        Canvas.SetTop(SalesPad, SalesLst.ActualHeight + 8);
                        SetSalesPadtoSelectedItem();
                        if (SalesLst.SelectedIndex == -1)
                        {
                            padPos = PadPosition.Below;
                        }
                    }
                    else
                    {
                        Canvas.SetTop(SalesLst, 0);
                        SetSalesPadtoSelectedItem();
                    }
                }

                if (SalesLst.SelectedIndex != -1 && padPos == PadPosition.Below)
                {
                    Canvas.SetTop(SalesLst, 0);
                    Canvas.SetTop(SalesPad, 0);
                    SalesPad.Margin = SalesPadMargin;
                    SetSalesPadtoSelectedItem();
                    if (SalesLst.SelectedIndex == 0)
                    {
                        padPos = PadPosition.Middle;
                    }
                    // padPos = PadPosition.Below;
                }
            }
            catch (Exception ex)
            {
                Logger.Log(LoggingLevel.Error,
                           GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace);
                throw ex;
            }
        }
        public void MoveSalesPadDown()
        {
            SalesLst.UpdateLayout();
            SalesPad.Margin = SalesPadMargin;


            if (padPos == PadPosition.Above && SalesLst.SelectedIndex != -1)
            {
                Canvas.SetTop(SalesLst, 0);
                SetSalesPadtoSelectedItem();
                padPos = PadPosition.Middle;
            }

            if (padPos == PadPosition.Middle)
            {
                if (SalesLst.SelectedIndex == -1)
                {
                    Canvas.SetTop(SalesLst, 0);
                    // SalesPad.Margin = SalesPadMargin;
                    Canvas.SetTop(SalesPad, SalesLst.ActualHeight + 8);
                    SetSalesPadtoSelectedItem();
                    if (SalesLst.SelectedIndex == -1)
                    {
                        padPos = PadPosition.Below;
                    }
                }
                else
                {
                    Canvas.SetTop(SalesLst, 0);
                    SetSalesPadtoSelectedItem();
                }
            }

            if (SalesLst.SelectedIndex != -1 && padPos == PadPosition.Below)
            {
                Canvas.SetTop(SalesLst, 0);
                Canvas.SetTop(SalesPad, 0);
                SalesPad.Margin = SalesPadMargin;
                SetSalesPadtoSelectedItem();
                if (SalesLst.SelectedIndex == 0)
                {
                    padPos = PadPosition.Middle;
                }
                // padPos = PadPosition.Below;
            }
        }
 public void GoToNextTransactionEntry()
 {
     if (SalesLst.SelectedIndex == SalesLst.Items.Count - 1)
     {
         padPos = PadPosition.Below;
         salesvm.CurrentTransactionEntry = null;
         SalesLst.SelectedItem           = null;
         Canvas.SetTop(SalesLst, 0);
         SalesLst.UpdateLayout();
         Canvas.SetTop(SalesPad, 0);
         SalesPad.Margin = SalesPadMargin;
         Canvas.SetTop(SalesPad, SalesLst.ActualHeight + 8);
         SetSalesPadtoSelectedItem();
     }
     else
     {
         SalesLst.SelectedIndex += 1; // selected index don't change when more than list
     }
 }
Пример #5
0
        void SalesPad_LayoutUpdated(object sender, EventArgs e)
        {
            if (pkey != Key.Down && pkey != Key.Up)
            {
                if (SalesLst.SelectedIndex != -1)
                {
                    Canvas.SetTop(SalesLst, 0);
                    Canvas.SetTop(SalesPad, 0);
                    SetSalesPadtoSelectedItem();
                    return;
                }
            }
            if (pkey == Key.Up)
            {
                SalesPad.Margin = SalesPadMargin;
                SalesLst.UpdateLayout();

                if (padPos == PadPosition.Middle && SalesLst.SelectedIndex == -1)
                {
                    Canvas.SetTop(SalesPad, 0);
                    Canvas.SetTop(SalesLst, SalesPad.ActualHeight + 8);
                    //SetSalesPadtoSelectedItem();
                    if (SalesLst.SelectedIndex == -1)
                    {
                        padPos = PadPosition.Above;
                    }
                    //return;
                }
                if (padPos == PadPosition.Middle && SalesLst.SelectedIndex != -1)
                {
                    Canvas.SetTop(SalesLst, 0);
                    Canvas.SetTop(SalesPad, 0);
                    SetSalesPadtoSelectedItem();
                }

                if (SalesLst.SelectedIndex != -1 && padPos == PadPosition.Above)
                {
                    // set the index to the last one and goto that one
                    Canvas.SetTop(SalesLst, 0);
                    //SalesLst.SelectedIndex = SalesLst.Items.Count - 1;
                    SetSalesPadtoSelectedItem();
                    padPos = PadPosition.Middle;
                }

                if (padPos == PadPosition.Below)
                {
                    // set the index to the last one and goto that one

                    Canvas.SetTop(SalesLst, 0);
                    Canvas.SetTop(SalesPad, 0);
                    SetSalesPadtoSelectedItem();
                    padPos = PadPosition.Middle;
                    SalesLst.SelectedIndex = SalesLst.Items.Count - 1;
                }
                pkey = Key.None;
            }
            if (pkey == Key.Down)
            {
                MoveSalesPadDown();
                pkey = Key.None;
            }


            // pkey = Key.None;
            //}
        }