コード例 #1
0
        private void ListCustomPhrases() //To list the custom phrases and set the controls
        {
            this.PhrasesListView.ItemsSource = data.GetListPhrases().Where(p => p.IsCustom == true);

            this.DeleteButton.IsVisible = false;
            this._phrase              = null;
            this.PhraseEntry.Text     = "";
            this.SwitchTrue.IsToggled = false;
        }
コード例 #2
0
        private void PhrasesListView_OnItemTapped(object sender, ItemTappedEventArgs e)
        {
            // Old implementation - This delete the phrase from DB on tap the phrase
            //ListView list = (ListView) sender;
            //Phrases phrase = (Phrases)list.SelectedItem;
            //data.Delete(phrase);
            //ListCustomPhrases();

            // New implementation - If phrase tapped, show in the view controls and allow to change ow delete the phrase.
            ListView list = (ListView)sender;

            this._phrase                = (Phrases)list.SelectedItem;
            this.PhraseEntry.Text       = this._phrase.Phrase;
            this.SwitchTrue.IsToggled   = this._phrase.IsTrue;
            this.DeleteButton.IsVisible = true;
        }
コード例 #3
0
        protected void OnSaveButtonClicked(object sender, EventArgs e)
        {
            if (this._phrase == null)
            {
                this._phrase = new Phrases
                {
                    Phrase   = this.PhraseEntry.Text,
                    IsTrue   = this.SwitchTrue.IsToggled,
                    IsCustom = true
                };
                data.Insert(this._phrase);
            }
            else
            {
                this._phrase.Phrase = this.PhraseEntry.Text;
                this._phrase.IsTrue = this.SwitchTrue.IsToggled;
                data.Update(this._phrase);
            }

            ListCustomPhrases();
        }
コード例 #4
0
 public void Update(Phrases phrases)
 {
     _connection.Update(phrases);
 }
コード例 #5
0
 public void Delete(Phrases phrases)
 {
     _connection.Delete(phrases);
 }
コード例 #6
0
 public void Insert(Phrases phrases)
 {
     _connection.Insert(phrases);
 }