Пример #1
0
        private void Delete()
        {
            if (CurrentDisplayLineLength == 0 & TextBoxType != TextBoxType.Multiline)
            {
                return;
            }

            if (CursorLeft != CurrentDisplayLineLength)
            {
                var line = CurrentDisplayLine;

                // remove one character from the list of characters
                CurrentDisplayLine = CurrentDisplayLine.Remove(CursorLeft, 1);
            }
            else
            {
                if (CurrentDisplayLineIndex < DisplayLines.Count)
                {
                    DisplayLines.RemoveAt(CurrentDisplayLineIndex);
                }
            }

            // redraw and repaint
            DrawText();
            Paint();
        }
Пример #2
0
 public void UpdateDisplayedLines()
 {
     DisplayLines.Clear();
     using (var context = new ERPContext())
     {
         var transactionLines = context.Ledger_Transaction_Lines
                                .Include("LedgerAccount")
                                .Include("LedgerTransaction")
                                .Include("LedgerTransaction.LedgerTransactionLines")
                                .Include("LedgerTransaction.LedgerTransactionLines.LedgerAccount")
                                .Where(line => line.LedgerAccount.ID.Equals(_selectedBank.ID) && _fromDate <= line.LedgerTransaction.Date && _toDate >= line.LedgerTransaction.Date)
                                .OrderBy(line => line.LedgerTransaction.Date)
                                .ToList();
         foreach (var oppositeLine in from line in transactionLines
                  from oppositeLine in line.LedgerTransaction.LedgerTransactionLines
                  where oppositeLine.LedgerAccountID != _selectedBank.ID select oppositeLine)
         {
             oppositeLine.Seq = oppositeLine.Seq == "Debit" ? "Credit" : "Debit";
             DisplayLines.Add(new LedgerTransactionLineVM {
                 Model = oppositeLine
             });
         }
     }
 }
Пример #3
0
        public void WriteDisplay(string text, DisplayLines line)
        {
            //Console.WriteLine("I2c.WriteDisplay");
            this.Write((byte)line);

            for (int i = 0; i < text.Length; i++)
            {
                this.Write(Convert.ToByte(text[i]), Rs);
            }
        }
Пример #4
0
 private void RebuildLines()
 {
     Lines = DisplayLines.AssembleChunks(ClientWidth);
 }
Пример #5
0
        private void ProcessKey(ConsoleKeyInfo info)
        {
            if ((CursorLeft < ClientWidth & Text.Length < MaxLength) || (CursorLeft < ClientWidth & MaxLength == 0))
            {
                var keyValue = info.KeyChar.ToString();

                // at the end of the line so add the character
                if (CursorLeft == CurrentDisplayLineLength)
                {
                    if (info.Key == ConsoleKey.Enter)
                    {
                        DisplayLines.Insert(CurrentDisplayLineIndex + 1, string.Empty);
                    }
                    else
                    {
                        CurrentDisplayLine = CurrentDisplayLine + keyValue;
                    }
                }
                else
                {
                    var line = CurrentDisplayLine;

                    if (Insert)
                    {
                        if (info.Key == ConsoleKey.Enter)
                        {
                            CurrentDisplayLine = line.LeftPart(CursorLeft);
                            DisplayLines.Insert(CurrentDisplayLineIndex + 1, line.RightPart(CursorLeft));
                        }
                        else
                        {
                            CurrentDisplayLine = CurrentDisplayLine.Insert(CursorLeft, keyValue);
                        }
                    }
                    else
                    {
                        if (info.Key == ConsoleKey.Enter)
                        {
                            CurrentDisplayLine = line.LeftPart(CursorLeft);
                            DisplayLines.Insert(CurrentDisplayLineIndex + 1, line.RightPart(CursorLeft + 1));
                        }
                        else
                        {
                            CurrentDisplayLine = line.LeftPart(CursorLeft) + keyValue + line.RightPart(CursorLeft + 1);
                        }
                    }
                }

                if (info.Key == ConsoleKey.Enter)
                {
                    IncrementCursorTop();
                    CursorLeft = 0;
                }
                else
                {
                    CursorLeft++;

                    if (CursorLeft >= ClientWidth)
                    {
                        if (TextBoxType == TextBoxType.Multiline)
                        {
                            CursorLeft = 0;

                            if (CursorTop < ClientHeight)
                            {
                                CursorTop++;
                            }
                        }
                        else
                        {
                            CursorLeft = ClientWidth;
                        }
                    }
                }

                SetCursorPosition();

                // redraw and repaint
                DrawText();
                Paint();
            }
        }