Ejemplo n.º 1
0
        /// <summary>
        /// OnMemoryLoadPressed() - Initially the M+ key ready to receive data from Accumulator.
        ///                       - Stores the data until M- or MC key is hit.
        ///                       - M+ key puts Accumulator data in memory.
        ///                       - M- moves memory to InBound, and clears memory.
        ///
        /// </summary>
        /// <remarks>
        ///   Side effects - MemButton keytop toggles between M+ and M-.
        ///                - if initially M+ Memory is set to Accumulator and toggles to M-.
        ///                - if initially M- InBound is set to Memory, Memory is cleared, and toggles to M+.
        /// </remarks>
        private void OnMemoryLoadPressed(object sender, EventArgs e)
        {
            string keyToggle = this.FindByName <Button>("MemButton").Text;

            if (keyToggle == "M+")
            {
                MemorySave.SetValueTo(Accumulator);
                this.FindByName <Button>("MemButton").Text = "M-";
            }
            else
            {
                InBound.SetValueTo(MemorySave);
                MemorySave.Clear();
                this.FindByName <Button>("MemButton").Text = "M+";
                sbInBound.Clear();
                if (displayToggle == DisplayToggle.floating)
                {
                    sbInBound.Append(InBound.ToDisplayFloat(" "));
                }
                else
                {
                    sbInBound.Append(InBound.ToDisplayFraction(" "));
                }

                this.FindByName <Label>("Input").Text = sbInBound.ToString();
            }
        }
Ejemplo n.º 2
0
 private void OnClearPressed(object sender, EventArgs e)
 {
     sbInBound.Clear();
     sbAccumulator.Clear();
     this.FindByName <Label>("Input").Text  = String.Empty;
     this.FindByName <Label>("Result").Text = String.Empty;
     InBound.Clear();
     Accumulator.Clear();
     lastOperator = '=';
 }