Ejemplo n.º 1
0
        partial void actionButton(Foundation.NSObject sender)
        {
            /* This will take the title of the button that was pressed and convert it to a NSString -> String */
            string actionPressed = (NSString)sender.ValueForKey((NSString)"title");

            switch (actionPressed)
            {
            case "*":
                currentAction = actions.multiply;
                break;

            case "/":
                currentAction = actions.divide;
                break;

            case "-":
                currentAction = actions.subtract;
                break;

            case "+":
                currentAction = actions.add;
                break;
            }

            if (!isOnAction)
            {
                isOnAction = true;
            }

            screenText = "";

            /* addToTextField(actionPressed.ToString()); */
        }
Ejemplo n.º 2
0
        partial void numberButton(Foundation.NSObject sender)
        {
            /* This will take the title of the button that was pressed and convert it to a NSString -> String -> Short( JAVA TERM, LOL ) ( 16Bit - INT ) */
            string numberPressed = (NSString)sender.ValueForKey((NSString)"title");

            if (numberPressed.Contains("."))
            {
                var alert = new NSAlert()
                {
                    AlertStyle      = NSAlertStyle.Critical,
                    InformativeText = "F**k, The decimal point kinda kills me...",
                    MessageText     = "OH SSHHIIIIT!",
                };

                alert.RunModal();
                return;
            }

            screenText += numberPressed;

            currentDerivative = long.Parse(screenText);

            if (!isOnAction)
            {
                pastDerivative = long.Parse(screenText);
            }
            else
            {
                Console.WriteLine("past: " + pastDerivative.ToString());
                Console.WriteLine("current: " + currentDerivative.ToString());
            }

            setTextField(screenText);
        }