コード例 #1
0
        /// <summary>
        /// Výpis čísel na textový displej / úprava formátu
        /// </summary>
        /// <param name="number">Zadané číslo vo formáte string</param>
        /// <returns>True ak sa číslo vypísalo, false ak nie</returns>
        public bool PrintNumber(string number)
        {
            if (number.Contains("NumPad"))              // V prípade zadávania čísel pomocou numerickej klávesnice odstráni NumPad
            {
                number = number.Remove(0, 6);
            }

            if (this.IsLogDisplay)              // pokiaľ sa výsledok zapíše do log displeju, vyčistí ho
            {
                this.ClearLog();
                MathProcessor.ClearResult();
            }
            this.IsLogDisplay = false;

            if (this.text_display.Text.Length > TextMaxLength && !this.IsTextDisplay)               // kontrola počtu znakov
            {
                return(false);
            }

            if (this.text_display.Text == "0" || this.IsTextDisplay)
            {
                this.text_display.Text = number;
            }
            else
            {
                this.text_display.Text += number;
            }

            this.text_display.Text = this.FormatNumericValue(this.text_display.Text);
            this.FixAnsFontSize();
            this.IsTextDisplay             = false;
            MathProcessor.WaitingForNumber = false;

            return(true);
        }
コード例 #2
0
 private void clear_click(object sender, RoutedEventArgs e)
 {
     this.outputProcessor.ClearText();
     this.outputProcessor.ClearLog();
     MathProcessor.ClearResult();
 }
コード例 #3
0
 public MainWindow()
 {
     this.InitializeComponent();
     this.outputProcessor = new OutputProcessor(this.text_display, this.log_display);
     this.mathProcessor   = new MathProcessor(this.outputProcessor);
 }