Beispiel #1
0
 /// <summary>
 /// Adds a Contact to the list.
 /// </summary>
 /// <param name="contact">A contact-object</param>
 public void addContact(Contact contact)
 {
     this.ListOfContacts.Add(contact.Id, contact);
 }
Beispiel #2
0
        internal static void handleKeyboardEvent(KeyboardViewEventArgs keyboardViewEventArgs)
        {
            switch (Input.MenuState)
            {
                case MenuState.None:
                    Dialog dialog;
                    switch (keyboardViewEventArgs.Value)
                    {
                        case KeyboardButtons.MenuMessageNew:
                            Input.setNewMenuState(MenuState.NewMessage);
                            break;
                        case KeyboardButtons.MenuMessageRecv:
                            Input.setNewMenuState(MenuState.ViewMessage);
                            break;
                        case KeyboardButtons.MenuContactNew:
                            Input.setNewMenuState(MenuState.AddNewContact);
                            break;
                        case KeyboardButtons.MenuContactEdit:
                            Input.setNewMenuState(MenuState.EditContact);
                            break;
                        case KeyboardButtons.MenuContactDelete:
                            Input.setNewMenuState(MenuState.DeleteContact);
                            break;
                        case KeyboardButtons.ApplicationClose:
                            dialog = new Dialog("Bestätigung", "Wollen sie KomMee wirklich beenden?", new String[] { "Ja", "Nein" });
                            dialog.ShowDialog();
                            if (dialog.ClickedDialogButton == "Ja")
                                Application.Exit();
                            break;
                        case KeyboardButtons.TextToSpeech:
                            if (textToSpechEnabled)
                            {
                                textToSpechEnabled = false;
                                dialog = new Dialog("Information", "Der Vorlesemodus ist nun deaktiviert", new String[] { "Ok" });
                                dialog.ShowDialog();
                            }
                            else
                            {
                                textToSpechEnabled = true;
                                dialog = new Dialog("Information", "Der Vorlesemodus ist nun eingeschaltet", new String[] { "Ok" });
                                dialog.ShowDialog();
                            }

                            break;
                    }
                    break;
                case MenuState.ViewMessage:
                    break;
                case MenuState.AnswerMessage:
                    break;
                case MenuState.DeleteMessage:
                    break;
                case MenuState.NewMessage:
                    if (keyboardViewEventArgs.Value == KeyboardButtons.TextSend)
                    {
                        object data = Input.currentIViewContaier.getData();
                        Input.message = new SMSMessage(data);
                        ((SMSViewContainer)(Input.currentIViewContaier)).setColor(Color.White);
                        Input.setNewMenuState(MenuState.ChoseReceiver);
                    }
                    else
                        Input.currentIViewContaier.addWriteInput(keyboardViewEventArgs);
                    break;
                case MenuState.ChoseReceiver:
                    break;
                case MenuState.ChoseMessageType:
                    break;
                case MenuState.AddNewContact:
                    if (keyboardViewEventArgs.Value == KeyboardButtons.SpecialCharReturn)
                    {
                        if (((ContactViewContainer)Input.currentIViewContaier).apply())
                        {
                            String[] data = (String[])Input.currentIViewContaier.getData();
                            String firstname, lastname, phonenumber;
                            firstname = data[0];
                            lastname= data[1];
                            phonenumber = data[2];

                            Contact newContact = new Contact(firstname, lastname);
                            SMSAddress newAddress = new SMSAddress(phonenumber);
                            newContact.ContactTypes.Add(phonenumber, newAddress);
                            newContact.DefaultAddress = newAddress;
                            newContact.saveContact();
                            AddressBook addressBook = AddressBook.getInstance();
                            addressBook.addContact(newContact);

                            dialog = new Dialog("Information", "Der Kontakt \"" + lastname + ", " + firstname + "\" wurde erfolgreich gespeichert!", new String[] { "Ok" });
                            dialog.ShowDialog();

                            Input.clearViewContainer();
                            Input.setNewMenuState(MenuState.None);
                        }
                    }
                    else
                        Input.currentIViewContaier.addWriteInput(keyboardViewEventArgs);
                    break;
                case MenuState.EditContact:
                    break;
                case MenuState.DeleteContact:
                    break;
                case MenuState.AddMessageTypeToContact:
                    break;
                default:
                    break;
            }
        }