예제 #1
0
 private void btnClr_Click(object sender, EventArgs e)
 {
     DisplayBox.Clear();
     ShowBox.Text    = String.Empty;
     calcu.Num       = 0;
     DisplayBox.Text = "0";
 }
예제 #2
0
 private void buttonCE_Click(object sender, EventArgs e)
 {
     _digit1             = 0;
     _digit2             = 0;
     _result             = 0;
     _operationChoosed   = false;
     _operationCompleted = false;
     _currentState.Clear();
     DisplayBox.Clear();
     CalcTextBox.Text = _zero;
 }
예제 #3
0
        private void button0_Click(object sender, EventArgs e)
        {
            if (CalcTextBox.Text != _zero)
            {
                if (_operationCompleted)
                {
                    CalcTextBox.Text = _zero;
                    DisplayBox.Clear();
                    _operationCompleted = false;
                }

                CalcTextBox.Text += ((Button)sender).Text;
            }
        }
예제 #4
0
        //Button Click Events
        private void NumClick(object sender, EventArgs e)
        {
            Button btn = (Button)sender;

            if (DisplayBox.Text == "0")
            {
                DisplayBox.Clear();
            }
            if (HasAns == true)
            {
                DisplayBox.Clear();
                HasAns = false;
            }
            DisplayBox.Text = DisplayBox.Text + btn.Text;
        }
예제 #5
0
        /// <summary>
        /// Universal Button Handler. Handles Input for Every Button Aside from Clear and Equals
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonHandler(object sender, EventArgs e)
        {
            Button currentButton = (Button)sender;
            string text          = currentButton.Text;

            if (DisplayBox.Text == "ERROR")
            {
                displayString = "";
                DisplayBox.Clear();
            }

            if (!(displayString.Contains("+") || displayString.Contains("−") || displayString.Contains("/") || displayString.Contains("x")) && displayString.Length >= 1)
            {
                if (Tokens.IsFunction(text)) //Encase whatever is on the display with the function
                {
                    displayString = text + " (" + displayString + ")";
                    infix         = text.Contains(Tokens.LEFT_PAREN_OP) ? (text + " ( " + infix + " ) ") : (text + " ( " + infix + " )");
                    text          = "";
                }
            }

            //This block ensures proper infix formatting for parsing
            if (Tokens.IsOperator(text) && text != Tokens.FACT_OP)
            {
                infix += " " + text + " ";
            }
            else if (text == Tokens.LEFT_PAREN_OP || Tokens.IsFunction(text))
            {
                infix += text + " ";
            }
            else if (text == Tokens.RIGHT_PAREN_OP || text == Tokens.FACT_OP)
            {
                infix += " " + text;
            }
            else
            {
                infix += text;
            }

            displayString   = infix;
            DisplayBox.Text = displayString;

            Debug.WriteLine(infix);
        }
예제 #6
0
        public async Task StartCrawlerAsync()
        {
            DisplayBox.Text = "Loading...";
            var url = "";

            for (int i = 0; i < 6; i++)
            {
                int x = i + 1;
                url = "https://store.steampowered.com/search/?category1=998&specials=1&filter=topsellers&page=" + x;

                var httpClient = new HttpClient();
                var html       = await httpClient.GetStringAsync(url);

                var htmlDocument = new HtmlDocument();
                htmlDocument.LoadHtml(html);

                var divs = htmlDocument.DocumentNode.Descendants("div").Where(node => node.GetAttributeValue("class", "").Equals("responsive_search_name_combined")).ToList();


                Listen.Add($"side {x}");

                foreach (var div in divs)
                {
                    var name    = div.Descendants("span").FirstOrDefault().InnerText;
                    var Percent = div.Descendants("div").Where(node => node.GetAttributeValue("class", "").Equals("col search_discount responsive_secondrow")).FirstOrDefault().Descendants("span").FirstOrDefault().InnerText;

                    var Price = div.Descendants("div").Where(node => node.GetAttributeValue("class", "").Equals("col search_price discounted responsive_secondrow")).FirstOrDefault().InnerText;
                    var kage  = Price.Split(new char[] { '\t', '€' });
                    Price = kage[9];
                    var BeforePrice = kage[8];

                    Listen.Add(name + ":   " + Percent + " Før pris " + BeforePrice + "€ Tilbuds pris " + Price + "€");
                }
            }
            DisplayBox.Clear();
            foreach (var item in Listen)
            {
                DisplayBox.Text += item + "\n \n";
            }
        }
예제 #7
0
 private void ClearBtn_Click(object sender, EventArgs e)
 {
     DisplayBox.Clear();
 }