private void OnChoose(object sender, RoutedEventArgs e)
        {
            var memos = memoList.Children.ToList();

            foreach (var one in memos)
            {
                MemoView memoBlock = one as MemoView;

                memoBlock.Selected     = false;
                memoBlock.Tapped      -= memoBlock.ClickToModify;
                memoBlock.Tapped      += memoBlock.ClickToSelect;
                memoBlock.Holding     -= OnChoose;
                memoBlock.RightTapped -= OnChoose;
            }

            // change the state of the first selected one
            var firstMemo = sender as MemoView;

            firstMemo.ClickToSelect(firstMemo, e);

            // change view of cancel Button
            var cancelBtn = MainPage.Instance.CancelButton;

            cancelBtn.Visibility = Visibility.Visible;
            cancelBtn.Click     += OnCancelChoose;

            // hide add and camera, show delete
            MainPage.Instance.PlusButton.Visibility   = Visibility.Collapsed;
            MainPage.Instance.CameraButton.Visibility = Visibility.Collapsed;
            MainPage.Instance.DeleteButton.Visibility = Visibility.Visible;
        }
        private void OnCancelChoose(object sender, RoutedEventArgs e)
        {
            // change states of memoBlocks
            var memos = memoList.Children.ToList();

            foreach (var one in memos)
            {
                MemoView memoBlock = one as MemoView;

                memoBlock.Selected     = false;
                memoBlock.Tapped      += memoBlock.ClickToModify;
                memoBlock.Tapped      -= memoBlock.ClickToSelect;
                memoBlock.Holding     += OnChoose;
                memoBlock.RightTapped += OnChoose;
            }

            // hide cancel Button
            var cancelBtn = MainPage.Instance.CancelButton;

            cancelBtn.Visibility = Visibility.Collapsed;
            cancelBtn.Click     -= OnCancelChoose;

            // show add and camera, hide delete
            MainPage.Instance.PlusButton.Visibility   = Visibility.Visible;
            MainPage.Instance.CameraButton.Visibility = Visibility.Visible;
            MainPage.Instance.DeleteButton.Visibility = Visibility.Collapsed;
        }
        private async void LoadMemos()
        {
            IList <Memo> memos = new List <Memo>();

            try
            {
                // from server-end
                var temp = await NetHelper.GetAllMemos(Preference.GetUserID());

                memos = MemoSort.SortByTime(temp);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                // from local DB
                var temp = DBHelper.GetAllMemo();
                memos = MemoSort.SortByTime(temp);
            }

            foreach (var memo in memos)
            {
                var memoBlock = new MemoView(memo);
                memoBlock.Holding     += OnChoose;
                memoBlock.RightTapped += OnChoose;
                memoList.Children.Add(memoBlock);
            }
        }
        private async void OnDelete(object sender, RoutedEventArgs e)
        {
            var memos = memoList.Children.ToList();

            memoList.Children.Clear();
            foreach (var one in memos)
            {
                MemoView memoBlock = one as MemoView;
                if (!memoBlock.Selected)
                {
                    memoList.Children.Add(memoBlock);
                }
                else
                {
                    UnsyncQueue.Instance.Enqueue(new DeleteMemoOperation(memoBlock.Memo.MemoID));
                    DBHelper.DeleteMemo(memoBlock.Memo);
                    NotificationHelper.RemoveToastFromSchedule(memoBlock.Memo);
                }
            }

            OnCancelChoose(null, e);
        }