Esempio n. 1
0
        public void OnClick(View itemView, int position, bool isLongClick)
        {
            try
            {
                if (isLongClick)
                {
                    Toast.MakeText(currentContext, "Notes Options", ToastLength.Short).Show();

                    Android.Widget.PopupMenu menu = new Android.Widget.PopupMenu((Activity)currentContext, itemView);
                    menu.MenuInflater.Inflate(Resource.Menu.notes_Options, menu.Menu);

                    menu.MenuItemClick += (s, arg) =>
                    {
                        if (arg.Item.ItemId.Equals(Resource.Id.editFile))
                        {
                            Toast.MakeText(currentContext, "Edit " + itemView.FindViewById <TextView>(Resource.Id.textView).Text, ToastLength.Short).Show();
                            NoteController controller = new NoteController();
                            TextView       NoteTitle  = itemView.FindViewById <TextView>(Resource.Id.textView);
                            Toast.MakeText(currentContext, NoteTitle.Text.Trim(), ToastLength.Short).Show();

                            List <NoteMini> listOfNoteMini = controller.GetNotePreviews(currentUser.UserName);
                            string          title          = NoteTitle.Text;
                            string          currentNoteId  = null;
                            foreach (NoteMini eachMini in listOfNoteMini)
                            {
                                if (eachMini.Title.Equals(title))
                                {
                                    currentNoteId = eachMini.GUID;
                                    break;
                                }
                            }

                            Note           getStoredNote = controller.GetNote(currentNoteId, currentUser.UserName);
                            CommonActivity activity      = currentContext as CommonActivity;

                            activity.GoToActivity(typeof(NoteEditActivity), false, new KeyValuePair <string, string>("SelectedNote", JsonConvert.SerializeObject(getStoredNote)));

                            //FragmentTransaction transaction = ((Activity)currentContext).FragmentManager.BeginTransaction();


                            //currentDialog = new ShareFileDialog(currentContext);
                            //currentDialog.Show(transaction, "dialog fragment");
                        }
                    };

                    menu.Show();
                }
                else
                {
                    Toast.MakeText(currentContext, "Download Notes", ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(currentContext, e.ToString(), ToastLength.Short).Show();
            }
        }
Esempio n. 2
0
        public async Task Transform_Common()
        {
            var            basePath = Path.Combine(Path.GetTempPath(), _context.DynamicContext.Manifest.Id);
            CommonActivity activity = new CommonActivity("CommonActivity", basePath);
            await activity.Initializing(_context);

            await activity.Writing();

            Assert.NotNull(activity);
        }
        public async Task Transform_ALL()
        {
            var            basePath       = Path.Combine(Path.GetTempPath(), _context.DynamicContext.Manifest.Id);
            CommonActivity commonActivity = new CommonActivity("CommonActivity", basePath);
            await commonActivity.Initializing(_context);

            await commonActivity.Writing();

            Assert.NotNull(commonActivity);

            ApiActivity apiActivity = new ApiActivity("ApiActivity", basePath);
            await apiActivity.Initializing(_context);

            await apiActivity.Writing();

            Assert.NotNull(apiActivity);

            LayoutActivity layoutActivity = new LayoutActivity("LayoutActivity", basePath);
            await layoutActivity.Initializing(_context);

            await layoutActivity.Writing();

            Assert.NotNull(layoutActivity);

            DataModelActivity dataModelActivity = new DataModelActivity("DataModelActivity", basePath);
            await dataModelActivity.Initializing(_context);

            await dataModelActivity.Writing();

            Assert.NotNull(dataModelActivity);

            ViewModelActivity viewModelActivity = new ViewModelActivity("ViewModelActivity", basePath);
            await viewModelActivity.Initializing(_context);

            await viewModelActivity.Writing();

            Assert.NotNull(viewModelActivity);

            LanguageActivity languageActivity = new LanguageActivity("LanguageActivity", basePath);
            await languageActivity.Initializing(_context);

            await languageActivity.Writing();

            Assert.NotNull(languageActivity);

            UnitTestsActivity unitTestsActivity = new UnitTestsActivity("UnitTestsActivity", basePath);
            await unitTestsActivity.Initializing(_context);

            await unitTestsActivity.Writing();

            Assert.NotNull(unitTestsActivity);
        }
Esempio n. 4
0
        public async Task <ActionResult> Add(CommonActivity commonActivity)
        {
            if (commonActivity == null)
            {
                return(BadRequest());
            }

            _logger.LogInformation("ADD request for activity '{Description}' on contact with ID '{ContactId}'",
                                   commonActivity.Description, commonActivity.ContactId);

            await _repository.AddAsync(commonActivity);

            return(RedirectToAction("Details", "Contact", new { id = commonActivity.ContactId }));
        }
Esempio n. 5
0
        public ActionResult Add(int contactId)
        {
            if (contactId <= 0)
            {
                return(NotFound());
            }

            var commonActivity = new CommonActivity
            {
                ContactId = contactId,
                Date      = DateTime.Now
            };

            return(View("Editor", commonActivity));
        }