Exemplo n.º 1
0
        private void Solve()
        {
            var input = InputBox.Text;

            Error = true;
            try {
                ResultBox.ToolTip = null;
                ResultBox.Text    = "";
                var t   = ToTokens(input);
                var exp = Parse(t);
                exp.Origin        = input;
                ResultBox.Text    = exp.Value.ToString();
                ResultBox.ToolTip = exp.Value is FloatPoint
                    ? null
                    : exp.Value.Value.ToString(CultureInfo.InvariantCulture);
                Error = false;
                HistoryInput.Add(exp);
            } catch (FuntionOutOfRangeException) {
                ResultBox.Text = "并没有搞懂你说的是哪个函数的计算器(´・_・`)";
            } catch (OperatorOutOfRangeException) {
                ResultBox.Text = "并没有搞懂你说的是哪个运算符的计算器(●´ω`●)";
            } catch (DivideByZeroException) {
                ResultBox.Text = "并不知道怎么用ʕ ᵒ̌ ‸ ᵒ̌ ʔ零除的计算器";
            } catch (UnexpectedTokenException) {
                ResultBox.Text = "并不(ー ー;)会断句的计算器";
            } catch (UnexpectedExpressionException) {
                ResultBox.Text = "并不知道怎么算的计算>_<#器";
            } catch (ArgumentOutOfRangeException) {
                ResultBox.Text = "并无法理解函数参(╯-╰)/ 数的计算器";
            } catch (OverflowException) {
                ResultBox.Text = "并不会算这么TAT大数的计算器";
            }
        }
Exemplo n.º 2
0
        public ActionResult ViewHistory(HistoryInput historyInput, int?page)
        {
            if (ModelState.IsValid)
            {
                TimeSpan timeSpan = (historyInput.EndDate - historyInput.StartDate);
                if (timeSpan.Days >= 0)
                {
                    HistoryDAO     History_DAO = new HistoryDAO();
                    List <History> HistoryList = History_DAO.ShowHisroty(historyInput.StartDate, historyInput.EndDate).ToList();

                    GridView gridView = new GridView();
                    gridView.DataSource = HistoryList;
                    gridView.DataBind();
                    Session["History"] = gridView;

                    return(View(HistoryList.ToPagedList(page ?? 1, 10)));
                }
                else
                {
                    ModelState.AddModelError("", "Please Select a valid range with correct dates");
                    return(View("ShowHistory"));
                }
            }
            else
            {
                ModelState.AddModelError("", "History is not available");
                return(View("ShowHistory"));
            }
        }
Exemplo n.º 3
0
        public void Push(Mobile_GridButton button)
        {
            var          go           = Instantiate(prefab, transform);
            HistoryInput historyInput = go.GetComponent <HistoryInput>();

            historyInput.SetHistoryInput(button);

            if (this.buttons.Count >= 4)
            {
                var d = this.buttons.Dequeue();
                Destroy(d);
            }

            this.buttons.Enqueue(go);
        }
Exemplo n.º 4
0
 private void ClearHistory()
 {
     HistoryInput.Clear();
 }