public IEnumerable <IStickyNote> Load() { var json = File.Exists(pathToFile) ? File.ReadAllText(pathToFile) : null; if (string.IsNullOrEmpty(json)) { return new IStickyNote[] { } } ; var jsonNoteCollection = JsonUtility.FromJson <JsonNoteCollection>(json); List <IStickyNote> notes = new List <IStickyNote>(); foreach (var note in jsonNoteCollection.stickyNotes) { var sticky = new StickyNote() { BugText = note.bugText, Position = note.position, Scene = note.scene, Timestamp = Convert.ToDateTime(note.timeStamp) }; notes.Add(sticky); } return(notes); }
public void RemoveSelfFromCanvas(ChemProV.UI.DrawingCanvas owner) { // Start by unsubscribing from events on the parent process unit or stream if (m_commentParent is ProcessUnitControl) { (m_commentParent as ProcessUnitControl).ProcessUnit.PropertyChanged -= this.ProcessUnitParentPropertyChanged; } else if (m_commentParent is StreamControl) { (m_commentParent as StreamControl).Stream.PropertyChanged -= this.StreamParentPropertyChanged; } m_commentParent = null; // Now unsubscribe from events on the sticky note object m_note.PropertyChanged -= this.MemNote_PropertyChanged; m_note = null; // Now do the actual removal of controls from the drawing canvas if (null != m_lineToParent) { owner.RemoveChild(m_lineToParent); m_lineToParent = null; } owner.RemoveChild(this); }
public async Task <IActionResult> Edit(int id, [Bind("Id,BoardId,Content,Color,PositionTop,PositionLeft")] StickyNote stickyNote) { if (id != stickyNote.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(stickyNote); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StickyNoteExists(stickyNote.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(stickyNote)); }
void Update() { if (Input.GetKeyDown(KeyCode.Return)) { StickyNote.Create(); } }
public async Task StickiesGetOkRequest() { // arrange TestClient testClient = new TestClient(); const string endpoint = "stickies/get"; const HttpStatusCode expectedStatusCode = HttpStatusCode.OK; StickyNote expectedSticky = new StickyNote() { Content = "no content", Scale = 0.5f, PatientId = "testpatient" }; testClient.AddHeader("ApiKey", "testpatient"); // act HttpResponseMessage response = await testClient.GetRequest(endpoint); HttpStatusCode actualStatusCode = response.StatusCode; string actualResponseBody = await response.Content.ReadAsStringAsync(); ICollection <StickyNote> actualStickies = JsonConvert.DeserializeObject <ICollection <StickyNote> >(actualResponseBody); // assert Assert.Equal(expectedStatusCode, actualStatusCode); Assert.Equal(expectedSticky.Content, actualStickies.ToList()[0].Content); Assert.Equal(expectedSticky.Scale, actualStickies.ToList()[0].Scale); Assert.Equal(expectedSticky.PatientId, actualStickies.ToList()[0].PatientId); }
private void StickyNoteListBox_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { StickyNote Note = StickyNoteListBox.SelectedItem as StickyNote; StickyNoteForm stickyForm = new StickyNoteForm(); stickyForm.NewStickyNote = Note; if ((bool)stickyForm.ShowDialog()) { if (!Note.Same(stickyForm.NewStickyNote)) { StickyNoteListBox.Items.Remove(Note); using (var Ctx = new Context()) { Note.Update(stickyForm.NewStickyNote); Ctx.Entry(Note).State = System.Data.Entity.EntityState.Modified; Ctx.SaveChanges(); } StickyNoteListBox.Items.Add(Note); } } else { StickyNoteListBox.Items.Remove(Note); //delete data data base using (var Ctx = new Context()) { Ctx.Entry(Note).State = System.Data.Entity.EntityState.Deleted; Ctx.SaveChanges(); } } }
public async Task StickiesPostOkRequest() { // arrange TestClient testClient = new TestClient(); const string endpoint = "stickies/post"; const HttpStatusCode expectedStatusCode = HttpStatusCode.OK; StickyNote sticky = new StickyNote() { Content = "no content", Scale = 0.5f, PatientId = "testpatient" }; const string expectedResponse = "Successfully added sticky note."; string requestBody = JsonConvert.SerializeObject(new Dictionary <string, object>() { { "content", "no content" }, { "scale", 0.5f } }); testClient.AddHeader("ApiKey", "testpatient"); // act HttpResponseMessage response = await testClient.PostRequest(endpoint, body : requestBody); HttpStatusCode actualStatusCode = response.StatusCode; string actualResponse = await response.Content.ReadAsStringAsync(); // assert Assert.Equal(expectedStatusCode, actualStatusCode); Assert.Equal(expectedResponse, actualResponse); }
public ActionResult Put(Guid userId, Guid id, StickyNoteDto stickyNoteDto) { var author = _stickyNotes.Users.FirstOrDefault(p => p.Id == userId); if (author is null) { return(NotFound()); } var stickyNote = _stickyNotes.StickyNotes.FirstOrDefault(p => p.Id == id); if (stickyNote is null) { stickyNote = new StickyNote { Title = stickyNoteDto.Title, Note = stickyNoteDto.Note, UserId = userId, Id = id }; _stickyNotes.StickyNotes.Add(stickyNote); _stickyNotes.SaveChanges(); return(CreatedAtAction("Get", new { id = stickyNote.Id, userId }, stickyNote)); } stickyNote.Title = stickyNoteDto.Title; stickyNote.Note = stickyNoteDto.Note; _stickyNotes.SaveChanges(); return(NoContent()); }
public IUndoRedoAction Execute(Workspace sender) { StickyNote current = m_owner[m_index]; m_owner.RemoveAt(m_index); return(new InsertComment(m_owner, current, m_index)); }
public IActionResult DeleteNote([FromBody] StickyNote note) { try { StickyNote noteToDelete = _context.StickyNote .Where(n => n.Id == note.Id) .First(); ICollection <Models.Task> tasks = _context.Task .Where(t => t.StickyNoteId == note.Id) .ToList(); foreach (var task in tasks) { _context.Remove(task); } _context.Remove(noteToDelete); _context.SaveChanges(); } catch (Exception e) { return(StatusCode(500, e)); } return(Ok("success")); }
/// TODO: MOVE public static async Task <bool> AddStickyNote(DbCtx ctx, string patientApiKey, JObject stickyJson) { try { string stickyContent = (string)stickyJson["content"]; float stickyScale = (float)stickyJson["scale"]; if (!(string.IsNullOrWhiteSpace(stickyContent) || stickyScale == 0)) { Patient patient = (Patient)GetEntityByForeignKey(ctx, patientApiKey, Collection.patients); StickyNote stickyNote = new StickyNote() { PatientId = patient.Id, Scale = stickyScale, Content = stickyContent }; patient.Stickies.Add(stickyNote); await ctx.SaveChangesAsync(); return(true); } } catch (Exception e) { Console.WriteLine(e); } return(false); }
/// <summary> /// Saves a sticky note inside the database. /// </summary> /// <param name="stickyNote"></param> /// <returns></returns> public static void SaveStickyNote(StickyNote stickyNote) { using (var database = new NoteContext()) { database.Notes.Add(stickyNote); database.SaveChanges(); } }
public void ToStringTest() { StickyNote note = new StickyNote(); note.Title = "testTitle"; note.Content = "testContext"; Assert.AreEqual(note.Title, "testTitle"); }
public bool Same(StickyNote note) { if (this.Title == note.Title && this.Content == note.Content) { return(true); } return(false); }
public void RemoveStickyNoteFromData(string stickyNoteId) { StickyNote noteToRemove = notes.Find((note) => note.id == stickyNoteId); if (noteToRemove) { notes.Remove(noteToRemove); Destroy(noteToRemove.gameObject); } }
public ActionResult Post(Guid userId, StickyNoteDto stickyNoteDto) { var stickyNote = new StickyNote { Title = stickyNoteDto.Title, Note = stickyNoteDto.Note, UserId = userId, Id = Guid.NewGuid() }; _stickyNotes.StickyNotes.Add(stickyNote); _stickyNotes.SaveChanges(); return(CreatedAtAction("Get", new { id = stickyNote.Id, userId }, stickyNote)); }
public async Task <IActionResult> Create([Bind("Id,BoardId,Content,Color,PositionTop,PositionLeft")] StickyNote stickyNote) { if (ModelState.IsValid) { _context.Add(stickyNote); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(stickyNote)); }
private void OnTriggerExit(Collider other) { if (other.gameObject.tag == "StickyStack") { touchingStack = null; } else if (other.gameObject.tag == "StickyNote") { touchingStickyNote = null; } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "StickyStack") { touchingStack = other.gameObject.GetComponent <StickyStack>(); } else if (other.gameObject.tag == "StickyNote") { touchingStickyNote = other.gameObject.GetComponent <StickyNote>(); } }
private void HandleStickyNoteTap() { StickyNote focusedStickyNote = FocusedObject.GetComponent <StickyNote>(); if (focusedStickyNote != null) { focusedStickyNote.PerformTagAlong(); focusedStickyNote.Duplicate(); focusedStickyNote.PlaceOnBoard(); _lastPreviewedStickyNote = focusedStickyNote; } }
public async void RemoveStickyNote(StickyNote stickyNote) { if (webSocket.State == WebSocketState.Open) { QuestDebug.Instance.Log("Sending remove message"); await webSocket.SendText("{\"action\" : \"removeStickyNote\", \"deviceId\": \"" + SystemInfo.deviceUniqueIdentifier + "\", \"stickyNoteId\" : \"" + stickyNote.id + "\"}"); } else { QuestDebug.Instance.Log("No Socket Connection"); } }
public ActionResult Edit([Bind(Include = "EntryID,UserID,Entry")] StickyNote stickyNote) { if (ModelState.IsValid) { var userid = User.Identity.GetUserId(); var tempStickyNote = db.Note.FirstOrDefault(n => n.UserID == userid); tempStickyNote.Entry = stickyNote.Entry; db.Entry(tempStickyNote).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Edit")); } return(View(stickyNote)); }
//public ActionResult Index() //{ // //List<tblPerson> obj = new List<tblPerson>(); // //var data = db.spGetPersonByCountry("India").ToList(); // //obj = db.GetPersonByCountry("India").ToList(); // //int Count = 0; // //ObjectParameter returnCount= new ObjectParameter("PersonCount", typeof(Int32)); // //db.spGetPersonCountByCountry(returnCount, "India"); // ////var PersonCountByCountry = db.GetPersonCountByCountry(, "London"); // ////var value = Request.Cookies["UserInformation"].Values; // ////HttpCookie ck = new HttpCookie("UserInformation"); // ////ck.Values.Add("Username", "*****@*****.**"); // ////ck.Values.Add("Password", "12345678"); // ////Response.Cookies.Add(ck); // //return RedirectToAction("Login", "Account"); //} public ActionResult CreateStickyNote(stickyNote stickynote) { StickyNote obj = new StickyNote(); obj.Text = stickynote.text; obj.Left = stickynote.left; obj.Top = stickynote.top; obj.Colour = stickynote.colour; obj.Width = stickynote.width; obj.Height = stickynote.height; db.StickyNotes.Add(obj); db.SaveChanges(); return(Json(obj.Id, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Sets the comment object for this control to the specified BasicComment object. This control /// may subscribe to events for the object, so it is best practice to set this to null when the /// control is no longer being used. /// </summary> public void SetCommentObject(BasicComment comment) { if (null != m_sticky) { // Remove event handler before changing this value m_sticky.PropertyChanged -= this.StickyNote_PropertyChanged; } if (null != m_basic) { m_basic.OnTextChanged -= this.BasicComment_OnTextChanged; } // IMPORTANT: Unsubscribe from parent control property changes (if applicable) if (null != m_parentObject) { if (m_parentObject is AbstractProcessUnit) { (m_parentObject as AbstractProcessUnit).PropertyChanged -= this.ParentPU_PropertyChanged; } else if (m_parentObject is AbstractStream) { (m_parentObject as AbstractStream).PropertyChanged -= this.ParentStream_PropertyChanged; } } m_basic = comment; m_sticky = null; m_parentObject = null; // It is valid to call this method with a null comment, so only update the UI if we // have a non-null comment. if (null != m_basic) { // Update the text in the UI elements CommentTextBox.Text = m_basic.CommentText; UserNameLabel.Content = m_basic.CommentUserName; // Allow deletion and editing XLabel.Visibility = System.Windows.Visibility.Visible; CommentTextBox.IsReadOnly = false; // Make sure the icon is hidden IconImage.Visibility = System.Windows.Visibility.Collapsed; TitleBarGrid.ColumnDefinitions[0].Width = new GridLength(0.0); // Subscribe to property changes m_basic.OnTextChanged += new EventHandler(BasicComment_OnTextChanged); } }
public ActionResult UpdateStickyNote(stickyNote stickynote) { StickyNote obj = new StickyNote(); obj.Text = stickynote.text; obj.Left = stickynote.left; obj.Top = stickynote.top; obj.Colour = stickynote.colour; obj.Width = stickynote.width; obj.Height = stickynote.height; obj.Id = stickynote.id; db.Entry(obj).State = EntityState.Modified; db.SaveChanges(); return(Json(stickynote.id, JsonRequestBehavior.AllowGet)); }
public void Init(StickyNote _Note) { StickyNoteManager manager = FindObjectOfType <StickyNoteManager>(); if (_Note) { DescText.text = _Note.description; PartImage.sprite = _Note.HealingPartImage; StickyNoteImage.color = manager.StickyColor[(int)_Note.Color]; foreach (StickyNoteContent mat in _Note.Combination) { GameObject obj = Instantiate(manager.PrefabStickyNoteContent, ContentHolder); obj.GetComponent <StickyNoteContentUI>().Init(mat); } } }
public async void AddStickyNote(StickyNote stickyNote) { if (webSocket.State == WebSocketState.Open) { StickyNoteData stickyNoteData = new StickyNoteData(stickyNote); string serializedStickyNoteData = JsonUtility.ToJson(stickyNoteData); QuestDebug.Instance.Log("Sending add message"); await webSocket.SendText("{\"action\" : \"addStickyNote\", \"deviceId\": \"" + SystemInfo.deviceUniqueIdentifier + "\", \"stickyNoteData\" : " + serializedStickyNoteData + "}"); } else { QuestDebug.Instance.Log("No Socket Connection"); } }
public void UpdatAndSameTest() { StickyNote note = new StickyNote(); note.Title = "testTitle"; note.Content = "testContext"; StickyNote mainNote = new StickyNote(); mainNote.Title = "mainTitle"; mainNote.Content = "mainContext"; Assert.IsFalse(note.Same(mainNote)); note.Update(mainNote); Assert.IsTrue(note.Same(mainNote)); }
public void AddStickyNoteFromData(StickyNoteData stickyNoteData) { GameObject newStickyNote = Instantiate(stickyNotePrefab, transform); Vector3 stickyPos = new Vector3(stickyNoteData.position.x, stickyNoteData.position.y, stickyNoteData.position.z); newStickyNote.transform.localPosition = stickyPos; newStickyNote.transform.Rotate(0f, 0f, 90f); newStickyNote.transform.Rotate(stickyNoteData.position.rotation, 0f, 0f); StickyNote stickyNote = newStickyNote.GetComponent <StickyNote>(); stickyNote.isOwnSticky = false; stickyNote.color = stickyNoteData.color; stickyNote.id = stickyNoteData.id; AddNote(stickyNote); }
public void AddButton_Click() { // Spawn a prefab ~ 2m forward of our current position; var position = mobile.position + mobile.forward * 2f; var gameObject = Instantiate(bugReportPrefab, position, Quaternion.identity); currentNote = gameObject.GetByInterfaceInChildren <IStickyNoteBugItem>(); notes[currentNote] = new StickyNote() { Position = position, BugText = "Add Text Here", Scene = SceneManager.GetActiveScene().name, Timestamp = DateTime.Now }; SetCurrentNote(notes[currentNote]); }
/// <summary> /// Delete a note from the collection of notes /// </summary> /// <param name="noteToDelete"></param> public void DeleteNote(StickyNote noteToDelete) => StickyNotes.Remove(noteToDelete);
void Start() { _bilboardTextParserService = new BilboardTextFormatterService(); _stickyNote = GetComponent<StickyNote>(); }
public StickyNote CreateNote(string nameTag) { // Create the new note StickyNote newNote = new StickyNote(nameTag); newNote.NoteIsFor = FamilyModel.PersonFromName(nameTag); FamilyModel.StickyNotes.Add(newNote); return newNote; }
public StickyNote CreateNote(Person person) { // Create the new note StickyNote newNote = new StickyNote(person); FamilyModel.StickyNotes.Add(newNote); return newNote; }