public void RemoveNumber()
    {
        try {
            bool numFound = false;

            int remNum = int.Parse(remNumInputField.text);

            for (int i = 0; i < dHandlerScript.currList.nameNumList.Count; i++)
            {
                if (remNum == dHandlerScript.currList.nameNumList[i].trunkNumber)
                {
                    numFound = true;

                    KillNumber(i);
                }
            }

            if (numFound)
            {
                dInPutScript.FlashIndicator("BYE " + remNum + "...");
            }
            else
            {
                dInPutScript.FlashIndicator("Don't have leh...");
            }

            dHandlerScript.CommitCurrSaveDataToFile();
        } catch {
            dInPutScript.FlashIndicator("Proper number please...");

            remNumInputField.text = "";
        }
    }
예제 #2
0
    public void SubmitData()
    {
        bool duplicateFound = false;

        try {
            if (newNumInput.text.Length > digits || newNumInput.text.Length < digits)
            {
                FlashIndicator(digits + " digits please...");
            }
            else
            {
                int inputNumber = int.Parse(newNumInput.text);

                for (int i = 0; i < dHandlerScript.currList.nameNumList.Count; i++)
                {
                    if (inputNumber == dHandlerScript.currList.nameNumList[i].trunkNumber)
                    {
                        duplicateFound = true;
                    }
                }

                if (!duplicateFound)
                {
                    AddNumberToList(inputNumber);

                    dHandlerScript.CommitCurrSaveDataToFile();

                    newNumInput.text = "";

                    FlashIndicator("SAVED!");
                }
                else
                {
                    FlashIndicator("Duplicate detected!");
                }
            }

            newNumInput.ActivateInputField();
        } catch {
            FlashIndicator("Proper number please...");

            newNumInput.text = "";

            newNumInput.ActivateInputField();
        }
    }