internal HistoryValue(HistoryValue entry) { key = entry.key; startTime = entry.startTime; value = entry.value; next = entry.next; }
/// <summary> /// Adds the association that 'id' has the value 'value' from 'startTime100ns' ONWARD until /// it is supersede by the same id being added with a time that is after this. Thus if /// I did Add(58, 1000, MyValue1), and add(58, 500, MyValue2) 'TryGetValue(58, 750, out val) will return /// MyValue2 (since that value is 'in force' between time 500 and 1000. /// </summary> public void Add(Address id, long startTime, T value, bool isEndRundown = false) { HistoryValue entry; if (!entries.TryGetValue((long)id, out entry)) { // rundown events are 'last chance' events that we only add if we don't already have an entry for it. if (isEndRundown) { startTime = 0; } entries.Add((long)id, new HistoryValue(startTime, id, value)); } else { Debug.Assert(entry != null); var firstEntry = entry; // See if we can jump ahead. Currently we only do this of the first entry, // But you could imagine using some of the other nodes's skipAhead entries. if (firstEntry.skipAhead != null && firstEntry.skipAhead.startTime <= startTime) { entry = firstEntry.skipAhead; } for (; ;) { // We found exact match if (startTime == entry.StartTime) { // Just update the value and exit immediately as there is no need to // update skipAhead or increment count entry.value = value; return; } if (entry.next == null) { entry.next = new HistoryValue(startTime, id, value); break; } // We sort the entries from smallest to largest time. if (startTime < entry.startTime) { // This entry belongs in front of this entry. // Insert it before the current entry by moving the current entry after it. HistoryValue newEntry = new HistoryValue(entry); entry.startTime = startTime; entry.value = value; entry.next = newEntry; Debug.Assert(entry.startTime <= entry.next.startTime); break; } entry = entry.next; } firstEntry.skipAhead = entry.next; } count++; }
partial void Segment3_Change(UISegmentedControl sender) { Segment3.TintColor = UIColor.FromRGB(92, 165, 53); var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(documentsPath, DBConstant.SEPARATOR, DBConstant.LIBRARY);// Library Folder var DbPath = Path.Combine(libraryPath, DBConstant.DB_NAME); var conn = new SQLite.SQLiteConnection(DbPath); conn.CreateTable <HistoryValue>(); string Historyvalue = Segment3.SelectedSegment.ToString(); string HistoryQuestion = "2"; var record = new HistoryValue { HistoyQuestion = HistoryQuestion, HistoryValueid = Historyvalue }; using (var db = new SQLite.SQLiteConnection(DbPath)) { var existingRecord = (db.Table <HistoryValue>().Where(c => c.HistoyQuestion == record.HistoyQuestion)).SingleOrDefault(); if (existingRecord != null) { existingRecord.HistoryValueid = record.HistoryValueid; db.Update(existingRecord); } else { db.Insert(record); } } }
internal HistoryValue(HistoryValue entry) { this.key = entry.key; this.startTime = entry.startTime; this.value = entry.value; this.next = entry.next; }
// TryGetValue will return the value associated with an id that was placed in the stream // at time100ns OR BEFORE. public bool TryGetValue(Address id, long time, out T value) { HistoryValue entry; if (entries.TryGetValue((long)id, out entry)) { // The entries are shorted smallest to largest. // We want the last entry that is smaller (or equal) to the target time) HistoryValue last = null; for (; ;) { if (time < entry.startTime) { break; } last = entry; entry = entry.next; if (entry == null) { break; } } if (last != null) { value = last.value; return(true); } } value = default(T); return(false); }
public ActionResult DeleteConfirmed(int id) { HistoryValue historyValue = db.HistoryValue.Find(id); db.HistoryValue.Remove(historyValue); db.SaveChanges(); return(RedirectToAction("Index")); }
protected override void updateTo(HistoryValue valueT) { HistoryValue_Clips value = (HistoryValue_Clips)valueT; container.form_MA.form_MImgsList.MClipsManager = value.clipsManager; value.setDataToClip(); container.form_MA.form_MImgsList.releaseFocus(); container.form_MA.form_MImgsList.updateAllList(value.imgListIndex); container.form_MA.refreshActionUIs(); }
public ActionResult Edit([Bind(Include = "ID,SN,Value,ReportTime,RSRP,SNR,Battery,ServerTime")] HistoryValue historyValue) { if (ModelState.IsValid) { db.Entry(historyValue).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(historyValue)); }
public ActionResult Create([Bind(Include = "ID,SN,Value,ReportTime,RSRP,SNR,Battery,ServerTime")] HistoryValue historyValue) { if (ModelState.IsValid) { db.HistoryValue.Add(historyValue); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(historyValue)); }
protected override void updateTo(HistoryValue valueT) { HistoryValue_Imgs value = (HistoryValue_Imgs)valueT; container.form_MA.form_MImgsList.mImgsManager = value.imgsManager; value.setDataToImg(container.form_MA.form_MImgsList.mImgsManager); container.form_MA.form_MImgsList.releaseFocus(); container.form_MA.form_MImgsList.updateAllList(value.imgListIndex); container.form_MA.form_MImgsList.mImgsManager.reloadImageElements(); container.form_MA.refreshActionUIs(); }
protected override void updateTo(HistoryValue valueT) { HistoryValue_Actor value = (HistoryValue_Actor)valueT; container.form_MA.form_MActorList.actorsManager = (MActorsManager)value.actorsManager; container.form_MA.form_MActorList.updateTreeView_Animation(); container.form_MA.form_MActorList.setCurrentActorFolder(value.actorFolderID, false, -1); container.form_MA.form_MActorList.setCurrentActor(value.actorID, false, -1); container.form_MA.form_MActorList.setCurrentAction(value.actionID, false, 2); container.form_MA.form_MTimeLine.setTimeLinePos(value.timeLinePos); container.form_MA.refreshActionUIs(); }
protected override void updateTo(HistoryValue valueT) { HistoryValue_ImgRename value = (HistoryValue_ImgRename)valueT; value.imgElement.renameImage(value.destName); MImgsManager imgsManager = (MImgsManager)value.imgElement.GetParent(); if (imgsManager != null && imgsManager.MNodeUI != null) { imgsManager.MNodeUI.UpdateItem(value.imgElement.GetID()); } }
protected override void updateTo(HistoryValue valueT) { HistoryValue_Action value = (HistoryValue_Action)valueT; MActorsManager MAM = container.form_MA.form_MActorList.actorsManager; //这里会引起错误 MAM[value.actorFolderID][value.actorID][value.actionID] = (MAction)value.timeLineHoder; container.form_MA.form_MActorList.setCurrentActorFolder(value.actorFolderID, false, 0); container.form_MA.form_MActorList.setCurrentActor(value.actorID, false, 1); container.form_MA.form_MActorList.setCurrentAction(value.actionID, false, 2); container.form_MA.form_MTimeLine.setTimeLinePos(value.timeLinePos); container.form_MA.refreshActionUIs(); }
// GET: HistoryValues/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } HistoryValue historyValue = db.HistoryValue.Find(id); if (historyValue == null) { return(HttpNotFound()); } return(View(historyValue)); }
partial void Label2_Change(UITextField sender) { const int maxCharacters = 7; label2.Text = Regex.Replace(label2.Text, @"[^0-9]+", ""); label2.ShouldChangeCharacters = (textField, range, replacement) => { var newContent = new NSString(textField.Text).Replace(range, new NSString(replacement)).ToString(); int number; return(newContent.Length <= maxCharacters && (replacement.Length == 0 || int.TryParse(replacement, out number))); }; label1.BackgroundColor = UIColor.White; label2.BackgroundColor = UIColor.White; label3.TextColor = UIColor.Black;//Label 2 highlight with red color var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(documentsPath, DBConstant.SEPARATOR, DBConstant.LIBRARY);// Library Folder var DbPath = Path.Combine(libraryPath, DBConstant.DB_NAME); var conn = new SQLite.SQLiteConnection(DbPath); conn.CreateTable <HistoryValue>(); string Historyvalue = Segment2.SelectedSegment.ToString(); string HistoryQuestion = "3"; string coast = label2.Text.ToString(); var record = new HistoryValue { HistoyQuestion = HistoryQuestion, HistoryValueid = Historyvalue, InsureCoast = coast }; using (var db = new SQLite.SQLiteConnection(DbPath)) { var existingRecord = (db.Table <HistoryValue>().Where(c => c.HistoyQuestion == record.HistoyQuestion)).SingleOrDefault(); if (existingRecord != null) { existingRecord.HistoryValueid = record.HistoryValueid; existingRecord.InsureCoast = record.InsureCoast; db.Update(existingRecord); } else { db.Insert(record); } } }
// TryGetValue will return the value associated with an id that was placed in the stream // at time100ns OR BEFORE. public bool TryGetValue(TKey id, long time, out TValue value) { HistoryValue entry; if (entries.TryGetValue(id, out entry)) { // The entries are sorted smallest to largest. // We want the last entry that is smaller (or equal) to the target time) var firstEntry = entry; // See if we can jump ahead. Currently we only do this of the first entry, // But you could imagine using some of the other nodes's skipAhead entries. if (firstEntry.skipAhead != null && firstEntry.skipAhead.startTime < time) { entry = firstEntry.skipAhead; } HistoryValue last = null; for (; ;) { if (time < entry.startTime) { break; } last = entry; entry = entry.next; if (entry == null) { break; } } if (last != null) { value = last.value; firstEntry.skipAhead = last; return(true); } } value = default(TValue); return(false); }
protected override void updateTo(HistoryValue valueT) { HistoryValue_ImgProp value = (HistoryValue_ImgProp)valueT; foreach (ImgProp imgProp in value.imgProps) { MImgElement imgElement = imgProp.imgElement; imgElement.forbidOptimize = imgProp.forbidOptimize; imgElement.strAlphaImage = imgProp.strAlphaImage; imgElement.strPmt = imgProp.strPmt; imgElement.alpha = imgProp.alpha; imgElement.linkID = imgProp.linkID; MImgsManager imgsManager = (MImgsManager)imgElement.GetParent(); if (imgsManager != null && imgsManager.MNodeUI != null) { imgsManager.MNodeUI.UpdateItem(imgElement.GetID()); } } }
/// <summary> /// Adds the association that 'id' has the value 'value' from 'startTime100ns' ONWARD until /// it is supersede by the same id being added with a time that is after this. Thus if /// I did Add(58, 1000, MyValue1), and add(58, 500, MyValue2) 'TryGetValue(58, 750, out val) will return /// MyValue2 (since that value is 'in force' between time 500 and 1000. /// </summary> public void Add(Address id, long startTime, T value, bool isEndRundown = false) { HistoryValue entry; if (!entries.TryGetValue((long)id, out entry)) { // rundown events are 'last chance' events that we only add if we don't already have an entry for it. if (isEndRundown) { startTime = 0; } entries.Add((long)id, new HistoryValue(startTime, id, value)); } else { Debug.Assert(entry != null); for (; ;) { if (entry.next == null) { entry.next = new HistoryValue(startTime, id, value); break; } // We sort the entries from smallest to largest time. if (startTime < entry.startTime) { // This entry belongs in front of this entry. // Insert it before the current entry by moving the current entry after it. HistoryValue newEntry = new HistoryValue(entry); entry.startTime = startTime; entry.value = value; entry.next = newEntry; Debug.Assert(entry.startTime <= entry.next.startTime); break; } entry = entry.next; } } count++; }
public void Add(Address id, long startTime100ns, T value) { HistoryValue entry; if (!entries.TryGetValue((long)id, out entry)) { entries.Add((long)id, new HistoryValue(0, id, value)); } else { for (; ;) { if (entry.next == null) { entry.next = new HistoryValue(startTime100ns, id, value); break; } // We sort the entries from smallest to largest time. if (startTime100ns < entry.startTime100ns) { Debug.Assert(false); // Note that we don't expect this to happen, we always add entries in time order. // This entry belongs in front of this entry. // Insert it before the current entry by moving the current entry after it. HistoryValue newEntry = new HistoryValue(entry); entry.startTime100ns = startTime100ns; entry.value = value; entry.next = newEntry; Debug.Assert(entry.startTime100ns <= entry.next.startTime100ns); break; } entry = entry.next; } } count++; }
protected virtual void updateTo(HistoryValue value) { }
partial void Segment2_Change(UISegmentedControl sender) { var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var libraryPath = Path.Combine(documentsPath, DBConstant.SEPARATOR, DBConstant.LIBRARY);// Library Folder var DbPath = Path.Combine(libraryPath, DBConstant.DB_NAME); var conn = new SQLite.SQLiteConnection(DbPath); conn.CreateTable <HistoryValue>(); string Historyvalue = Segment2.SelectedSegment.ToString(); string HistoryQuestion = "3"; var record = new HistoryValue { HistoyQuestion = HistoryQuestion, HistoryValueid = Historyvalue }; using (var db = new SQLite.SQLiteConnection(DbPath)) { var existingRecord = (db.Table <HistoryValue>().Where(c => c.HistoyQuestion == record.HistoyQuestion)).SingleOrDefault(); if (existingRecord != null) { existingRecord.HistoryValueid = record.HistoryValueid; db.Update(existingRecord); } else { db.Insert(record); } } var index2 = Segment2.SelectedSegment; Segment2.TintColor = UIColor.FromRGB(92, 165, 53); if (index2 == 1) { label1.Hidden = true; label2.Hidden = true; label3.Hidden = true; label1.BackgroundColor = UIColor.White; label2.BackgroundColor = UIColor.White; label3.TextColor = UIColor.Black; } if (index2 == 0) { label1.Hidden = false; label2.Hidden = false; label3.Hidden = false; label2.Text = ""; using (var db = new SQLite.SQLiteConnection(DbPath)) { var existingRecord = (db.Table <HistoryValue>().Where(c => c.HistoyQuestion == record.HistoyQuestion)).SingleOrDefault(); if (existingRecord != null) { existingRecord.InsureCoast = label2.Text.ToString(); db.Update(existingRecord); } else { db.Insert(record); } } } }
public void setValue(HistoryValue preValueT, HistoryValue nextValueT) { preValue = preValueT; nextValue = nextValueT; }