Exemplo n.º 1
0
        public async void ReadNotes()
        {
            if (SelectedNotebook != null)
            {
                //using (var connection = new SQLite.SQLiteConnection(DatabaseHelper.DatabaseFile))
                //{

                //    var notes = connection.Table<Note>().Where(note => note.NotebookId == SelectedNotebook.Id).ToList();

                //    Notes.Clear();
                //    foreach (var note in notes)
                //    {
                //        Notes.Add(note);
                //    }
                //}

                try
                {
                    var notes = await App.MobileServiceClient.GetTable <Note>().Where(note => note.NotebookId == SelectedNotebook.Id).ToListAsync();

                    Notes.Clear();
                    foreach (var note in notes)
                    {
                        Notes.Add(note);
                    }
                }
                catch (Exception e)
                {
                }
            }
        }
Exemplo n.º 2
0
        public async Task PopulateNotes()
        {
            Notes.Clear();//delete notes
            StorageFolder directory = ApplicationData.Current.LocalFolder;

            //Create folder for notes, or get folder for notes.
            if (NotesFolder == null)
            {
                try
                {
                    NotesFolder = await directory.GetFolderAsync("Notes");

                    Search();
                }
                catch
                {
                    NotesFolder = await directory.CreateFolderAsync("Notes");
                }
            }
            IReadOnlyList <StorageFile> files = await NotesFolder.GetFilesAsync();

            int id = 0;

            foreach (StorageFile currentFile in files)
            {
                LocalNoteModel noteToAdd = new LocalNoteModel(id, currentFile.Name.Substring(0, currentFile.Name.LastIndexOf(".")), await FileIO.ReadTextAsync(currentFile));
                noteToAdd.File = currentFile;
                Notes.Add(noteToAdd);
                id++;
            }
        }
 public void Reset()
 {
     Days.Clear();
     Months.Clear();
     Notes.Clear();
     AfterConstraction();
 }
Exemplo n.º 4
0
        public void ReadNotes()
        {
            using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(DatabaseHelper.dbFile))
            {
                if (SelectedNotebook != null)
                {
                    try
                    {
                        var notes = conn.Table <Note>().Where(n => n.NotebookId == SelectedNotebook.Id).ToList();

                        Notes.Clear();
                        foreach (var note in notes)
                        {
                            Notes.Add(note);
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message.Contains("no such table: Notebook"))
                        {
                            conn.CreateTable <Note>();
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                //Items.Clear();
                Notes.Clear();
                foreach (var item in filteredNoteList)
                {
                    Notes.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 6
0
 //đã check hết
 public void ReadNote()
 {
     try
     {
         try
         {
             using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(DatabaseHelper.dbFile))
             {
                 if (SelectedNotebook != null)
                 {
                     //truy cập vào database tại nơi mà NotebookId giống với Notebook mình đang select và gán notes là 1 list các note
                     var notes = conn.Table <Note>().Where(n => n.NotebookId == SelectedNotebook.Id).ToList();
                     Notes.Clear();
                     //duyệt mảng notes
                     foreach (var note in notes)
                     {
                         Notes.Add(note);
                     }
                 }
             }
         }
         catch
         {
         }
     }
     catch
     {
     }
 }
Exemplo n.º 7
0
        public void ConfirmNewNoteTitle(string newNoteTitle)
        {
            NewNoteClicked = false;

            string cd       = Environment.CurrentDirectory;
            string filePath = cd + $@"\data\{User.Id}" + $@"\{SelectedNotebook.Id}" + $@"\{newNoteTitle}.rtf";

            NoteModel note = Notes.ToList <NoteModel>().Find(n => n.Title == newNoteTitle);

            if (note == null)
            {
                try
                {
                    DBDataAccessInsert.InsertNote(new NoteModel()
                    {
                        NotebookId   = SelectedNotebook.Id,
                        Title        = newNoteTitle,
                        CreatedTime  = DateTime.Now,
                        UpdatedTime  = DateTime.Now,
                        FileLocation = filePath
                    });

                    Notes.Clear();
                    Notes = new BindableCollection <NoteModel>(DBDataAccessLoad.LoadNotebookNotes(SelectedNotebook.Id));
                }
                catch (SQLiteException)
                {
                    MessageBox.Show("Invalid Title");
                }
            }
            else
            {
                MessageBox.Show("Note with this title already exists");
            }
        }
Exemplo n.º 8
0
        async Task ExecuteLoadNotesCommand()
        {
            IsBusy = true;

            var shell = AppShell.Current as zakajo.Mobile.AppShell;

            NoteTypeId = shell.SelectedNoteType;
            Title      = shell.SelectedNoteTypeTitle;


            try
            {
                Notes.Clear();
                var notes = await DataStore.GetItemsAsync(true);

                notes.Where(note => note.NoteType == NoteTypeId).ForEach <Note>(n => Notes.Add(n));

/*
 *              foreach (var Note in notes)
 *              {
 *                  Notes.Add(Note);
 *              }
 */
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 9
0
        public async void ReadNotes()
        {
            //using (SQLiteConnection conn = new SQLiteConnection(DatabaseHelper.dbFile))
            //{
            //    if (selectedNotebook != null)
            //    {
            //        conn.CreateTable<Note>();
            //        var notes = conn.Table<Note>().Where(n => n.NotbookId == selectedNotebook.Id).ToList();
            //        Notes.Clear();
            //        if (notes != null)
            //        {
            //            foreach (var note in notes)
            //            {
            //                Notes.Add(note);
            //            }
            //        }
            //    }

            //}

            if (SelectedNotebook != null)
            {
                var notes = await App.mobileServiceClient.GetTable <Note>().Where(n => n.NotbookId == selectedNotebook.Id).OrderBy(n => n.Title).ToListAsync();

                Notes.Clear();
                if (notes != null)
                {
                    foreach (var note in notes)
                    {
                        Notes.Add(note);
                    }
                }
            }
        }
Exemplo n.º 10
0
        public async void ReadNotes()
        {
            //using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(DatabaseHelper.dbFile))
            //{
            //    if (SelectedNotebook != null)
            //    {
            //        conn.CreateTable<NoteModel>(); //Make sure the table exist
            //        //Que sólo muestre las notas del notebook seleccionado
            //        var notes = conn.Table<NoteModel>().Where(n => n.NotebookId == SelectedNotebook.Id).ToList();

            //        Notes.Clear();
            //        foreach (var note in notes)
            //        {
            //            Notes.Add(note);
            //        }
            //    }
            //}



            try
            {
                var notes = await App.MobileServiceClient.GetTable <NoteModel>().Where(n => n.NotebookId == SelectedNotebook.Id).ToListAsync();

                Notes.Clear();
                foreach (var note in notes)
                {
                    Notes.Add(note);
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 11
0
        /// <summary>
        ///     Clears this workspace of nodes, notes, and connectors.
        /// </summary>
        public virtual void Clear()
        {
            Log("Clearing workspace...");

            foreach (NodeModel el in Nodes)
            {
                el.Dispose();

                foreach (PortModel p in el.InPorts)
                {
                    for (int i = p.Connectors.Count - 1; i >= 0; i--)
                    {
                        p.Connectors[i].Delete();
                    }
                }
                foreach (PortModel port in el.OutPorts)
                {
                    for (int i = port.Connectors.Count - 1; i >= 0; i--)
                    {
                        port.Connectors[i].Delete();
                    }
                }
            }

            Nodes.Clear();
            Notes.Clear();

            ClearUndoRecorder();
            ResetWorkspace();
        }
Exemplo n.º 12
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Notes.Clear();
                // this gets complicated
                // PluralSightDataStore is a (member ...property? )
                // created in BaseViewModel via DependencyService
                // it is of type IPluralSightDataStore
                var notes = await PluralsightDataStore.GetNotesAsync();

                foreach (var note in notes)
                {
                    Notes.Add(note);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 13
0
        async Task ExecuteLoadItemsCommand()
        {
            // standard pattern to protect asynchronous functions
            if (IsBusy)
            {
                return;
            }

            // if the work has started - no further attempts of the work can occur
            IsBusy = true;

            try
            {
                // look up necessary data and populate
                Notes.Clear();
                var notes = await PluralSightDataStore.GetNotesAsync();

                foreach (var note in notes)
                {
                    Notes.Add(note);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 14
0
        void ExecuteLoadNotesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Notes.Clear();
                //var notes = _dataservice.Get<Note>(false);
                //foreach (var item in notes)
                //{
                //    Notes.Add(item);
                //}
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 15
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Notes.Clear();
                var notes = await NoteDataStore.GetNotesAsync();

                foreach (var note in notes)
                {
                    Notes.Add(note);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 16
0
        public async void ReadNotes()
        {
#if USEAZURE
            try
            {
                Notes.Clear();

                var notes = await App.MobileServiceClient.GetTable <Note>().Where(n => n.NotebookId == SelectedNotebook.Id).ToListAsync();

                foreach (var note in notes)
                {
                    Notes.Add(note);
                }
            }
            catch (Exception ex)
            {
            }
#else
            using (SQLiteConnection conn = new SQLiteConnection(DatabaseHelper.dbFile)) {
                if (SelectedNotebook != null)
                {
                    var notes = conn.Table <Note>().Where(n => n.NotebookId == SelectedNotebook.Id);

                    Notes.Clear();
                    foreach (var note in notes)
                    {
                        Notes.Add(note);
                    }
                }
            }
#endif
        }
Exemplo n.º 17
0
        public async void ReadNotes()
        {
            //using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(DatabaseHelper.dbFile))
            //{
            //    conn.CreateTable<Note>();
            //    if (SelectedNotebook != null)
            //    {
            //        var notes = conn.Table<Note>().Where(n => n.NotebookId == SelectedNotebook.Id).ToList();

            //        Notes.Clear();
            //        foreach(var note in notes)
            //        {
            //            Notes.Add(note);
            //        }
            //    }
            //}

            var notes = await DatabaseHelper.Read <Note>();

            Notes.Clear();
            foreach (var note in notes)
            {
                Notes.Add(note);
            }
        }
Exemplo n.º 18
0
 public override void OnDeactivated()
 {
     Notes.DisposeAll();
     Notes.Clear();
     Notes        = null;
     SelectedNote = null;
 }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Notes.Clear();
                var items = await Datastores.Notes.GetItemsAsync(true);

                foreach (var item in items)
                {
                    Notes.Add(item);
                }
                OnPropertyChanged("NoItems");
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 20
0
        public override void Dispose()
        {
            Model.NodeAdded    -= Model_NodeAdded;
            Model.NodeRemoved  -= Model_NodeRemoved;
            Model.NodesCleared -= Model_NodesCleared;

            Model.NoteAdded    -= Model_NoteAdded;
            Model.NoteRemoved  -= Model_NoteRemoved;
            Model.NotesCleared -= Model_NotesCleared;

            Model.AnnotationAdded    -= Model_AnnotationAdded;
            Model.AnnotationRemoved  -= Model_AnnotationRemoved;
            Model.AnnotationsCleared -= Model_AnnotationsCleared;

            Model.ConnectorAdded   -= Connectors_ConnectorAdded;
            Model.ConnectorDeleted -= Connectors_ConnectorDeleted;
            Model.PropertyChanged  -= ModelPropertyChanged;

            DynamoSelection.Instance.Selection.CollectionChanged -= RefreshViewOnSelectionChange;

            DynamoViewModel.CopyCommand.CanExecuteChanged  -= CopyPasteChanged;
            DynamoViewModel.PasteCommand.CanExecuteChanged -= CopyPasteChanged;

            var nodeViewModels = Nodes.ToList();

            nodeViewModels.ForEach(nodeViewModel => nodeViewModel.Dispose());
            nodeViewModels.ForEach(nodeViewModel => this.unsubscribeNodeEvents(nodeViewModel));

            Notes.ToList().ForEach(noteViewModel => noteViewModel.Dispose());
            Connectors.ToList().ForEach(connectorViewmModel => connectorViewmModel.Dispose());
            Nodes.Clear();
            Notes.Clear();
            Connectors.Clear();
        }
Exemplo n.º 21
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }
            //IsBusy ensures no further loads are done
            IsBusy = true;

            try
            {
                Notes.Clear();
                var notes = await PluralsightDataStore.GetNotesAsync();

                foreach (var note in notes)
                {
                    Notes.Add(note);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 22
0
 private void Model_NotesCleared()
 {
     foreach (var noteViewModel in Notes)
     {
         noteViewModel.Dispose();
     }
     Notes.Clear();
 }
Exemplo n.º 23
0
 private void PopulateNotes(IEnumerable <INote> notes)
 {
     Notes.Clear();
     foreach (var note in notes)
     {
         Notes.Add(new NoteViewModel(note));
     }
 }
Exemplo n.º 24
0
 public void RefreshNotes(Dictionary <string, Project> collection)
 {
     Notes.Clear();
     foreach (var note in collection)
     {
         AddItem(note.Value);
     }
     MainProjectList.Items.Refresh();
 }
Exemplo n.º 25
0
 public void ReadNotes()
 {
     using (SQLiteConnection connection = new SQLiteConnection(DataBaseHelper.dbFile))
     {
         var notes = connection.Table <Note>().Where(n => n.NotebookId == SelectedNotebook.Id).ToList();
         Notes.Clear();
         notes.ForEach(x => Notes.Add(x));
     }
 }
Exemplo n.º 26
0
        public override void Reset()
        {
            base.Reset();

            if (!isStatic)
            {
                Point = null;
                Notes.Clear();
            }
        }
Exemplo n.º 27
0
        public virtual void Dispose()
        {
            Logo?.Dispose();
            Logo = null;

            Notes.ForEach(n => n.Dispose());
            Notes.Clear();

            Parent = null;
        }
Exemplo n.º 28
0
        public async void LoadNoteAsync()
        {
            var notes = await _noteDataService.GetAllNotesAsync(Globals.LoggedInUser.Id);

            Notes.Clear();
            foreach (var note in notes)
            {
                Notes.Add(note);
            }
        }
Exemplo n.º 29
0
 public void Handle(string message)
 {
     if (message == "Sign out")
     {
         User       = null;
         IsLoggedIn = false;
         Notes.Clear();
         SelectedNotebook = null;
         Notebooks.Clear();
     }
 }
Exemplo n.º 30
0
 public void InitBlank()
 {
     LastModified.Reset();
     Locations.Clear();
     Notes.Clear();
     Tags.Clear();
     TagMaps.Clear();
     BlockRanges.Clear();
     Bookmarks.Clear();
     UserMarks.Clear();
 }