Esempio n. 1
0
        private void GetTitleFormCSFunc_Execute(object sender, Chromium.Remote.Event.CfrV8HandlerExecuteEventArgs e)
        {
            var noteList         = noteUtils.GetNotesTitle();
            var jsObjectAccessor = new CfrV8Accessor();
            var jsObject         = CfrV8Value.CreateObject(jsObjectAccessor);
            var noteListArray    = CfrV8Value.CreateArray(noteList.Count);
            int i = 0;

            foreach (var note in noteList)
            {
                //jsObject.SetValue(note.id.ToString(), CfrV8Value.CreateString(note.n_title), CfxV8PropertyAttribute.ReadOnly);
                var jsArray = CfrV8Value.CreateArray(5);
                jsArray.SetValue("id", note.id, CfxV8PropertyAttribute.DontDelete);
                jsArray.SetValue("n_title", note.n_title, CfxV8PropertyAttribute.DontDelete);
                jsArray.SetValue("n_length", note.n_length, CfxV8PropertyAttribute.DontDelete);
                jsArray.SetValue("create_time", note.create_time, CfxV8PropertyAttribute.DontDelete);
                jsArray.SetValue("update_time", note.update_time, CfxV8PropertyAttribute.DontDelete);
                noteListArray.SetValue(i, jsArray);
                i++;
            }
            jsObject.SetValue("noteArray", noteListArray, CfxV8PropertyAttribute.DontDelete);
            e.SetReturnValue(jsObject);
        }