Exemplo n.º 1
0
        //public CommonCommand RefreshToDoListCommand
        //{
        //    get
        //    {
        //        return new CommonCommand((o) =>
        //        {
        //            RefreshToDoList();
        //        });
        //    }
        //}
        public override void LoadInfo()
        {
            EpisodeList.Clear();
            TargetObject.EpisodeList.ForEach(v =>
            {
                EpisodeList.Add(new EpisodeViewModel()
                {
                    TargetObject = v
                });
            });
            SceneList.Clear();
            TargetObject.SceneList.ForEach(v =>
            {
                SceneList.Add(new SceneViewModel()
                {
                    TargetObject = v
                });
            });
            NoteList.Clear();
            TargetObject.NoteList.ForEach(v => NoteList.Add(new NoteViewModel()
            {
                TargetObject = v
            }));

            //RefreshToDoList();

            base.LoadInfo();
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteNoteBook(long noteBookId)
        {
            NoteBook noteBook = await _context.NoteBooks
                                .Include(nb => nb.NoteLists)
                                .FirstOrDefaultAsync(nb => nb.Id == noteBookId);

            if (noteBook == null)
            {
                return(NotFound());
            }

            foreach (NoteList noteList in noteBook.NoteLists)
            {
                // Create new note obj with Notes loaded.
                NoteList noteListObj = await _context.NoteLists
                                       .Include(nl => nl.Notes)
                                       .FirstOrDefaultAsync(nl => nl.Id == noteList.Id);

                if (noteListObj == null)
                {
                    return(NotFound());
                }

                foreach (Note note in noteListObj.Notes)
                {
                    _context.Notes.Remove(note);
                }
                _context.NoteLists.Remove(noteListObj);
            }

            _context.NoteBooks.Remove(noteBook);
            await _context.SaveChangesAsync();

            return(NoContent());
        }
        public void DeleteNotes(IList <string> deletedNoteUUIDs)
        {
            NoteFilter noteFilter = new NoteFilter();

            noteFilter.NotebookGuid = _tomboyNotebook.Guid;
            NoteList evernoteList = _noteStore.findNotes(_authToken, noteFilter, 0,
                                                         Evernote.EDAM.Limits.Constants.EDAM_USER_NOTES_MAX);

            foreach (string guid in deletedNoteUUIDs)
            {
                bool foundNote = false;
                foreach (Evernote.EDAM.Type.Note evernote in evernoteList.Notes)
                {
                    if (GetCorrectGuid(evernote) == guid)
                    {
                        foundNote        = true;
                        evernote.Deleted = (long)DateTime.Now.Subtract(Epoch).TotalMilliseconds;
                        _noteStore.updateNote(_authToken, evernote);
                    }
                }
                if (!foundNote)
                {
                    Logger.Error("[Evernote] Could not find note " + guid + " to delete.");
                }
            }
        }
Exemplo n.º 4
0
        private void Rename(object para)
        {
            Note note = para as Note;

            if (note == null)
            {
                return;
            }
            NewWindow newWindow = new NewWindow(this)
            {
                Owner = mainWindow
            };

            newWindow.ShowDialog();
            if (TitleInput == "")
            {
                return;
            }
            string oldPath = note.FilePath;
            string newName = TitleInput;

            if (dataService.RenameData(oldPath, newName))
            {
                NoteList.Remove(note);
                NoteList.Add(new Note(dataService.GetPath(newName)));
                SelectedIndex = NoteList.Count - 1;
                OnAddedNewNote();
            }
            TitleInput = "";
        }
Exemplo n.º 5
0
        public static ObservableCollection <NoteList> Open()
        {
            ObservableCollection <NoteList> noteLists;

            try
            {
                _fStream = File.Open(filename, FileMode.Open);
                using (StreamReader reader = new StreamReader(_fStream))
                {
                    string json = reader.ReadToEnd();
                    noteLists = JsonConvert.DeserializeObject <ObservableCollection <NoteList> >(json);
                }
            }
            catch (FileNotFoundException ex)
            {
                _fStream = File.Open(filename, FileMode.Create);
                NoteList nl = new NoteList("List1");
                noteLists = new ObservableCollection <NoteList>();
                noteLists.Add(nl);
            }
            finally
            {
                _fStream.Close();
            }
            return(noteLists);
        }
Exemplo n.º 6
0
    public static void Save(NoteList noteList, string NotesFilePath)
    {
        if (noteList == null)
        {
            return;
        }
        XmlSerializer serializer = new XmlSerializer(typeof(NoteList));

        string tmpPath = NotesFilePath + ".tmp";

        using (System.IO.FileStream fs = new FileStream(tmpPath, FileMode.Create, FileAccess.Write))
        {
            serializer.Serialize(fs, noteList);
            fs.Close();
        }
        if (File.Exists(tmpPath))
        {
            if (File.Exists(NotesFilePath))
            {
                string oldFile = NotesFilePath + ".bak";
                if (File.Exists(oldFile))
                {
                    File.Delete(oldFile);
                }
                File.Move(NotesFilePath, oldFile);
            }
            File.Move(tmpPath, NotesFilePath);
        }
    }
Exemplo n.º 7
0
        public async Task <IActionResult> UpdateNoteListTitle(long noteListId, NoteList newNoteList)
        {
            if (noteListId != newNoteList.Id)
            {
                return(BadRequest());
            }

            NoteList noteList = await _context.NoteLists.FirstOrDefaultAsync(nl => nl.Id == noteListId);

            if (noteList == null)
            {
                return(NotFound());
            }

            noteList.Title = newNoteList.Title;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException) when(!(_context.NoteLists.Any(nl => nl.Id == noteListId)))
            {
                return(NotFound());
            }

            return(NoContent());
        }
Exemplo n.º 8
0
        public List <NoteData>[] GetNotePriorityStack(bool excludeEquity)
        {
            int                     current     = 0;
            List <NoteData>         currentList = new List <NoteData>();
            List <List <NoteData> > rt          = new List <List <NoteData> >();

            foreach (var n in NoteList.OrderBy(x => x.PaymentOrdinal))
            {
                if (excludeEquity && n.IsEquity)
                {
                    continue;
                }
                int floor = (int)Math.Floor(n.PaymentOrdinal);
                if (floor > current)
                {
                    if (currentList.Count > 0)
                    {
                        rt.Add(currentList);
                    }
                    currentList = new List <NoteData>();
                    current     = floor;
                }
                currentList.Add(n);
            }
            if (currentList.Count > 0)
            {
                rt.Add(currentList);
            }
            return(rt.ToArray());
        }
Exemplo n.º 9
0
        internal List <Entity.Notebook> ReadEvernoteNotebooks(String edamBaseUrl, AuthenticationResult authResult)
        {
            string authToken = authResult.AuthenticationToken;

            NoteStore.Client noteStore = EvernoteHelper.GetNoteStoreClient(edamBaseUrl, authResult.User);
            List <Notebook>  notebooks = noteStore.listNotebooks(authToken);

            UpdateProgress("Retrieving Notebook List");

            foreach (Notebook notebook in notebooks)
            {
                Entity.Notebook enNotebook = new Entity.Notebook();
                enNotebook.Name = (notebook.Stack + " " + notebook.Name).Trim();
                enNotebook.Guid = notebook.Guid;

                int intProgress = Helper.GetNotebookProgress(enNotebooks.Count, notebooks.Count, 1, 20);
                UpdateProgress(intProgress);

                NoteFilter nf = new NoteFilter();
                nf.NotebookGuid = enNotebook.Guid;

                NoteList nl = noteStore.findNotes(authToken, nf, 0, 1);
                if (nl.Notes.Count > 0)
                {
                    enNotebooks.Add(enNotebook);
                }
            }
            enNotebooks.Sort(delegate(Entity.Notebook p1, Entity.Notebook p2) { return(p1.Name.CompareTo(p2.Name)); });
            return(enNotebooks);
        }
Exemplo n.º 10
0
        public void MoveDown(NodeViewModel node)
        {
            int index = NoteList.IndexOf(node);

            NoteList.Remove(node);
            NoteList.Insert(++index, node);
            PageNoteFieldSet.MoveAnnotationField(node.NoteName, 1);
        }
Exemplo n.º 11
0
 public void LoadNoteFields()
 {
     NoteList.Clear();
     foreach (IAnnotationField item in PageNoteFieldSet.AnnotationFields)
     {
         NoteList.Add(new NodeViewModel(item, false));
     }
 }
Exemplo n.º 12
0
    //TODO: Insert any song-specific art assets for song selection

    public static NoteList[] BuildNoteChart(TextAsset midiToRead)
    {
        //skip all this if we don't have the data
        if (!midiToRead)
        {
            return(new NoteList[1]);
        }

        var midiFile            = new MidiFile(midiToRead.bytes);
        int ticksPerQuarterNote = midiFile.TicksPerQuarterNote;

        // Note IDs we know each chart has. This prevents things from breaking if, say, a track has a BPM change but no chord changes.
        // At the time of writing, 42 through 52 are empty, but reserving them anyway will prevent issues from arising if we add more
        // notes, at the cost of a couple dozen bytes of memory.
        int[] hardcodedNoteIDs = new[] { 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 52 };

        List <int> newNoteIDs = new List <int>();

        newNoteIDs.AddRange(hardcodedNoteIDs);

        List <List <int> > newNotes = new List <List <int> >();

        for (int i = 0; i < newNoteIDs.Count; i++)
        {
            newNotes.Add(new List <int>());
        }

        foreach (var track in midiFile.Tracks)
        {
            foreach (var midiEvent in track.MidiEvents)
            {
                if (midiEvent.MidiEventType == MidiEventType.NoteOn)
                {
                    if (newNoteIDs.IndexOf(midiEvent.Note) == -1)
                    {
                        newNoteIDs.Add(midiEvent.Note);
                        newNotes.Add(new List <int>());
                    }
                    newNotes[newNoteIDs.IndexOf(midiEvent.Note)].Add(midiEvent.Time);
                }
            }
        }

        NoteList[] newChart = new NoteList[newNoteIDs.Count];

        foreach (var i in newNoteIDs)
        {
            NoteList currNoteList = new NoteList();
            currNoteList.notesCount          = newNotes[newNoteIDs.IndexOf(i)].Count;
            currNoteList.noteID              = i - 33;
            currNoteList.ticksPerQuarterNote = ticksPerQuarterNote;
            currNoteList.notes = newNotes[newNoteIDs.IndexOf(i)].ToArray();
            // 33 is the note value of A0, our root note, in all my MIDI exports from Ableton.   -- Leo
            newChart[i - 33] = currNoteList;
        }

        return(newChart);
    }
Exemplo n.º 13
0
 void SaveNoteList()
 {
     TargetObject.NoteList.Clear();
     foreach (var note in NoteList)
     {
         TargetObject.NoteList.Add(note.TargetObject);
     }
     CurrentNote = NoteList.FirstOrDefault();
 }
Exemplo n.º 14
0
        public void TestComposite()
        {
            MelodyBase      melody    = new MelodyAtomic(new object[] { 0, 1, 2, 0 });
            MelodyComposite composite = new MelodyComposite("AA+", melody);

            NoteList noteList = new NoteList(new int[] { 0, 1, 2, 0, 1, 2, 3, 1 });

            EqualNotes(noteList, composite);
        }
        public IList <string> GetAllNoteUUIDs()
        {
            NoteFilter filter = new NoteFilter();

            filter.NotebookGuid = _tomboyNotebook.Guid;
            NoteList notes = _noteStore.findNotes(_authToken, filter, 0, Evernote.EDAM.Limits.Constants.EDAM_USER_NOTES_MAX);

            return(notes.Notes.Select(GetCorrectGuid).ToList());
        }
Exemplo n.º 16
0
        public NodeViewModel AddNote()
        {
            IAnnotationField field = PageNoteFieldSet.CreateAnnotationField(GetNoteName(), AnnotationFieldType.Text);

            NodeViewModel node = new NodeViewModel(field);

            NoteList.Add(node);

            return(node);
        }
Exemplo n.º 17
0
        private void WriteFile(NoteList list)
        {
            var path = PlatformServices.Default.Application.ApplicationBasePath + "\\note.json";

            using (StreamWriter file = System.IO.File.CreateText(path))
            {
                JsonSerializer serializer = new JsonSerializer();
                //serialize object directly into file stream
                serializer.Serialize(file, list);
            }
        }
Exemplo n.º 18
0
        private string GetNoteName()
        {
            string noteName = DefaultNoteName;

            if (NoteList.Any(x => x.NoteName == noteName))
            {
                return(GetNoteName());
            }

            return(noteName);
        }
Exemplo n.º 19
0
 public NodeViewModel ElementAt(int index)
 {
     if (NoteList.Count > 0)
     {
         return(NoteList.ElementAt(index));
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 20
0
        public override ICopySupportObject Clone()
        {
            var o = new StructureDiagram()
            {
                Memo = Memo, Name = Name, IsTimeSensitive = IsTimeSensitive, CurrentTime = CurrentTime
            };

            NoteList.ForEach(v => o.NoteList.Add(v.Clone() as INote));
            NodeList.ForEach(v => o.NodeList.Add(v.Clone() as INode));
            ConnectionList.ForEach(v => o.ConnectionList.Add(v.Clone() as IConnection));
            return(o);
        }
Exemplo n.º 21
0
        protected virtual void LoadData(IStoryEntityObject target)
        {
            target.Name = Name;
            target.Memo = Memo;

            target.BeginTime = BeginTime;
            target.EndTime   = EndTime;
            ParameterList.ForEach(v => target.ParameterList.Add(v.GetData()));
            NoteList.ForEach(v => target.NoteList.Add(v.Clone() as INote));
            //KeyWordList.ForEach(v => target.KeyWordList.Add(v.ToString()));
            MeasureList.ForEach(v => target.MeasureList.Add(v.Clone() as IMeasure));
        }
Exemplo n.º 22
0
        public static void GetNotes(string request_id)
        {
            var client = new RestClient($"{ConfigurationManager.AppSettings["SDP_SERVER"]}/api/v3/requests/{request_id}/notes")
            {
                Timeout = -1
            };
            var request = new RestRequest(Method.GET);

            request.AddHeader("TECHNICIAN_KEY", ConfigurationManager.AppSettings["TECHNICIAN_KEY"]);
            IRestResponse response = client.Execute(request);

            noteList = JsonConvert.DeserializeObject <NoteList>(response.Content);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 返回换行分组后的附记记录集
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static List <NoteList> GetNoteList(string str)
        {
            List <NoteList> list = new List <NoteList>();

            string[] strs = str.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string text in strs)
            {
                NoteList note = new NoteList();
                note.Content = text;
                list.Add(note);
            }
            return(list);
        }
Exemplo n.º 24
0
        public void ShorOtherDateLog()
        {
            TaskListData.Clear();

            List <EachTask> specificTaskList = GetSpecificDateEachTaskList(LogDate);

            specificTaskList.ForEach(eachTask => TaskListData.Add(eachTask));

            ActivityLog.Clear();
            ModelsHelpers.GetSpecificDateActivityLog(LogDate).ForEach(activity => ActivityLog.Add(activity));

            NoteList.Clear();
            ChangeMemoListToNoteList(MemoModel.GetSpecificDateMemo(LogDate)).ForEach(memo => NoteList.Add(memo));
        }
Exemplo n.º 25
0
        private void ShowNoteList(object sender = null, RoutedEventArgs e = null)
        {
            this.Show();
            var noteList = new NoteList
            {
                DataContext = new NoteListViewModel(_controller)
            };

            noteList.NoteListBox.MouseDoubleClick += ShowNote;
            noteList.AddNote.Click      += AddNote;
            noteList.ShowSettings.Click += ShowSettings;
            noteList.ShowTasks.Click    += ShowTaskList;
            ControlPrincipal.Content     = noteList;
        }
Exemplo n.º 26
0
        private static void EqualNotes(NoteList expectedNotes, MelodyBase melody)
        {
            IEnumerator <NoteWithDuration> enumerator = melody.Notes().GetEnumerator();

            foreach (Note note in expectedNotes.Notes())
            {
                Assert.IsTrue(enumerator.MoveNext());
                Assert.AreEqual(note.note, enumerator.Current.note);
                Assert.AreEqual(note.alter, enumerator.Current.alter);
                Assert.AreEqual(note.IsPause, enumerator.Current.IsPause);
            }

            Assert.IsFalse(enumerator.MoveNext());
        }
Exemplo n.º 27
0
        /// <summary>
        /// This will read a set of annotated notes from the specified notebook. That is, this method will attempt to get the note, its attributes, the content and resolve images in the content.
        /// Using this call you'd likely have stored the version against each notebookid in your local data store.
        /// </summary>
        /// <param name="authToken">Your auth token to authenticate against the api.</param>
        /// <param name="notebookid">The Id of the notebook to filter on.</param>
        /// <param name="version">This is compared with the UpdateCount which is a value Evernote store at the account level to say if ANY of the notebooks have been updated.
        /// You can get this from the UserService.GetVersion() method. The first call will always get the latest.</param>
        /// <param name="version">This is the timestamp of the last note you retrieved. The first call will get the latest notes.</param>
        /// <param name="raw">Html returns the full XML with much of the content resolved. Strip will return pure text. Basic will strip most of the XML but resolve images etc and leave basic HTML elements in there - useful is writing to a webpage.</param>
        /// <param name="timestamp"></param>
        /// <returns></returns>
        public IList <NoteModel> GetNotes(Guid notebookid, long?timestamp, out long newtimestamp, TextResolver resolver = TextResolver.basic)
        {
            // initialize
            newtimestamp = 0;

            if (!timestamp.HasValue)
            {
                timestamp = 0;
            }

            // add in a filter
            int        pageSize   = 10;
            int        pageNumber = 0;
            NoteFilter filter     = new NoteFilter();

            filter.Order        = (int)Evernote.EDAM.Type.NoteSortOrder.UPDATED;
            filter.Ascending    = false;
            filter.NotebookGuid = notebookid.ToString(); // set the notebook to filter on

            // what do we want back from the query?
            //NotesMetadataResultSpec resultSpec = new NotesMetadataResultSpec() { IncludeTitle = true, IncludeUpdated = true };

            // execute the query for the notes
            NoteList newNotes = _Instance.findNotes(_authToken, filter, pageNumber * pageSize, pageSize);//, resultSpec);

            // initialize response collection
            IList <NoteModel> notes = new List <NoteModel>();

            // store the latest timestamp
            if (newNotes.Notes != null && newNotes.Notes.Count > 0)
            {
                newtimestamp = newNotes.Notes.FirstOrDefault().Updated;
            }

            // enumerate and build response
            foreach (Note note in newNotes.Notes)
            {
                // if the db timestamp is the same or later than the note then ignore it
                // is the timestamp which is the last time this project was checked
                if (timestamp >= note.Updated)
                {
                    continue;
                }

                notes.Add(BuildNote(note, resolver));
            }

            return(notes);
        }
Exemplo n.º 28
0
        public async Task <ActionResult <NoteListDTO> > GetNoteList(long noteListId)
        {
            NoteList noteList = await _context.NoteLists
                                .AsNoTracking()
                                .Include(nl => nl.NoteBook)
                                .Include(nl => nl.Notes)
                                .FirstOrDefaultAsync(nl => nl.Id == noteListId);

            if (noteList == null)
            {
                return(NotFound());
            }

            return(NoteListToDTO(noteList));
        }
Exemplo n.º 29
0
 void LoadNoteList()
 {
     if (TargetObject == null)
     {
         return;
     }
     NoteList.Clear();
     foreach (var note in TargetObject.NoteList)
     {
         NoteList.Add(new NoteViewModel()
         {
             TargetObject = note
         });
     }
     CurrentNote = NoteList.FirstOrDefault();
 }
Exemplo n.º 30
0
        /// <summary>
        /// Download data from Azure Blob Storage
        /// </summary>
        /// <returns></returns>
        public async Task <NoteList> Download()
        {
            Debug.Write($"MainData.dat is downloading...");
            CloudBlobContainer container = GetContainer("tsecret");
            await container.CreateIfNotExistsAsync();

            CloudBlockBlob blob = container.GetBlockBlobReference("MainData.dat");
            string         sec  = await blob.DownloadTextAsync();

            string   json = RijndaelDecode(sec);
            NoteList ret  = JsonConvert.DeserializeObject <NoteList>(json);

            Debug.Write($"{DateTime.Now.ToString(TimeUtil.FormatYMDHMS)} MainData.dat have been downloaded succesfully.");

            return(ret);
        }
Exemplo n.º 31
0
        /**
         * Method to serialize an object to a file
         */
        public bool SerializeObject(string filename, NoteList listToSerialize)
        {
            try
            {
                Stream fileStream = File.Open(filename, FileMode.Create);

                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(fileStream, listToSerialize);

                fileStream.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return false;
            }

            return true;
        }
Exemplo n.º 32
0
 /**
  * Subroutine to load notes from file into the program
  */
 private void LoadNotes()
 {
     allNotes = serializer.DeserializeObject(NOTES_FILENAME);
     if (allNotes == null)
         allNotes = new NoteList();
 }