Beispiel #1
0
        /// <summary>
        /// simply reload data for Note PivotItem
        /// </summary>
        private void NoteCancel()
        {
            // Change the selection mode back to None
            CRMNotes.lvList.SelectionMode = ListViewSelectionMode.None;
            // Then restore item click action
            CRMNotes.lvList.IsItemClickEnabled = true;
            // Render AppBarButton
            commandBar.ClosedDisplayMode = AppBarClosedDisplayMode.Minimal;
            commandBar.IsOpen            = false;
            if (abNoteAdd != null)
            {
                abNoteAdd.Visibility = Visibility.Visible;
            }
            if (abNoteSave != null)
            {
                abNoteSave.Visibility = Visibility.Collapsed;
            }

            abNoteDelete.Visibility = Visibility.Collapsed;
            abNoteSelect.Visibility = Visibility.Visible;
            abNoteCancel.Visibility = Visibility.Collapsed;

            // Swich the view to list
            CRMNotes.Cancel();
        }
Beispiel #2
0
        /// <summary>
        /// This method is called when user clicks Save button in Note PivotItem.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void abNoteSave_Click(object sender, RoutedEventArgs e)
        {
            // Saves note first.
            await CRMNotes.SaveNote();

            // Restore AppBarButtons
            ResetAppBarButtonDisplay();
        }
Beispiel #3
0
        /// <summary>
        /// This method is called when user clicks Delete button in Note PivotItem after Select button clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void abNoteDelete_Click(object sender, RoutedEventArgs e)
        {
            // Delete note
            await CRMNotes.DeleteRecords();

            // Then reset page
            NoteCancel();
            await CRMNotes.LoadData();
        }
Beispiel #4
0
        /// <summary>
        /// This metohd called when user navigate away from the page.
        /// </summary>
        /// <param name="e"></param>
        protected override async void OnNavigatedFrom(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedFrom(e);

            // When nagivate away, delete temporary data for attachment if exists
            if (e.NavigationMode == NavigationMode.Back)
            {
                await CRMNotes.DeleteTemporaryData();
            }
        }
Beispiel #5
0
 /// <summary>
 /// This method is called when user clicks Add button in Note PivotItem
 /// </summary>
 /// <param name="note"></param>
 private void NoteAdd(Annotation note = null)
 {
     // Add note
     CRMNotes.AddNote(note);
     // Then update controls
     abNoteAdd.Visibility  = Visibility.Collapsed;
     abNoteSave.Visibility = Visibility.Visible;
     if (abNoteSelect != null)
     {
         abNoteSelect.Visibility = Visibility.Collapsed;
     }
     if (abNoteCancel != null)
     {
         abNoteCancel.Visibility = Visibility.Visible;
     }
     commandBar.ClosedDisplayMode = AppBarClosedDisplayMode.Compact;
 }
Beispiel #6
0
        // For attachemnt to save and open
        public async void ContinueFileSavePicker(FileSavePickerContinuationEventArgs args)
        {
            if ((args.File != null))
            {
                // open existing file
                StorageFolder localFolder    = ApplicationData.Current.LocalFolder;
                StorageFile   noteAttachment = await localFolder.GetFileAsync(args.File.Name);

                // save to new location
                await FileIO.WriteBufferAsync(args.File, await FileIO.ReadBufferAsync(noteAttachment));

                // delete old one
                await CRMNotes.DeleteTemporaryData();

                // Then open
                await Launcher.LaunchFileAsync(args.File);
            }
        }