コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetTheme(PreferenceManager.GetDefaultSharedPreferences(ApplicationContext).GetInt("ThemeStyle", Resource.Style.Theme_Sherlock));

            dbHelper = new NotesDbAdapter(this);
            dbHelper.Open();

            SetContentView(Resource.Layout.NoteEdit);

            scriptureTitle = (TextView)FindViewById(Resource.Id.scriptureTitle);
            scriptureText = (TextView)FindViewById(Resource.Id.scriptureTextContent);
            titleText = (EditText)FindViewById(Resource.Id.title);
            bodyText = (EditText)FindViewById(Resource.Id.body);

            var confirmButton = (Button)FindViewById(Resource.Id.confirm);

            rowId = ((savedInstanceState == null) ? null : savedInstanceState.GetSerializable(NotesDbAdapter.KeyRowId)) as Long;

            if (this.rowId == null)
            {
                var extras = Intent.Extras;
                this.rowId = extras != null ? new Long(extras.GetLong(NotesDbAdapter.KeyRowId)) : null;
            }

            PopulateFields();
            confirmButton.Click += delegate
            {
                SaveState();
                SetResult(Result.Ok);
                Finish();
            };
        }
コード例 #2
0
ファイル: NoteEdit.cs プロジェクト: 89sos98/monodroid-samples
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            this.dbHelper = new NotesDbAdapter(this);
            this.dbHelper.Open();

            SetContentView(Resource.Layout.note_edit);
            SetTitle(Resource.String.edit_note);

            this.titleText = (EditText)FindViewById(Resource.Id.title);
            this.bodyText = (EditText)FindViewById(Resource.Id.body);

            var confirmButton = (Button)FindViewById(Resource.Id.confirm);

            this.rowId = ((savedInstanceState == null) ? null : savedInstanceState.GetSerializable(NotesDbAdapter.KeyRowId)) as Long;

            if (this.rowId == null)
            {
                var extras = Intent.Extras;
                this.rowId = extras != null ? new Long(extras.GetLong(NotesDbAdapter.KeyRowId))
                                        : null;
            }

            this.PopulateFields();
            confirmButton.Click += delegate
                {
                    SetResult(Result.Ok);
                    this.Finish();
                };
        }
コード例 #3
0
        private void SaveState()
        {
            string title = titleText.Text;
            string body = bodyText.Text;

            if (rowId == null)
            {
                long id = dbHelper.CreateNote(title, body, scripture.Title, scripture.Scripture, scriptureForHighlight);
                if (id > 0)
                {
                    rowId = new Long(id);
                }

                // TESTING PURPOSES
                //ThisApp.SaveNoteToParse(id, title, body, scripture.Title, scripture.Scripture, scriptureForHighlight);
            }
            else
            {
                dbHelper.UpdateNote(rowId.LongValue(), title, body);

                // TESTING PURPOSES
                //ThisApp.UpdateNoteToParse(rowId.LongValue(), title, body);
            }
        }
コード例 #4
0
ファイル: NoteEdit.cs プロジェクト: 89sos98/monodroid-samples
        private void SaveState()
        {
            string title = this.titleText.Text;
            string body = this.bodyText.Text;

            if (this.rowId == null)
            {
                long id = this.dbHelper.CreateNote(title, body);
                if (id > 0)
                {
                    this.rowId = new Long(id);
                }
            }
            else
            {
                this.dbHelper.UpdateNote(this.rowId.LongValue(), title, body);
            }
        }