public override void OpenRecord(BaseTask task) { task.RecordIndex = RecordList.Count; CollectRecord prevRecord = (RecordList.Count == 0) ? null : RecordList[RecordList.Count - 1] as CollectRecord; RecordList.Add(new CollectRecord(prevRecord, task as CollectTask)); }
//添加新条目,如果没有相同网站和相同账号,添加之,并保存,并显示列表。 public async void AddData() { if (string.IsNullOrEmpty(RecordItemToModify.WebSite)) { RecordItemToModify.WebSite = "错误!网站名称不能为空"; return; } int index = RecordList.FindIndex(r => r.WebSite == RecordItemToModify.WebSite && r.Account == RecordItemToModify.Account); if (index > -1) { RecordItemToModify.WebSite = "错误!已存在当前网站"; RecordItemToModify.Account = "错误!已存在当前账户"; } else { RecordItem r = new RecordItem(); CopyRecordItem(RecordItemToModify, r); RecordList.Add(r); string titleStr = await BackupAsync(SaveType.LocalState); if (titleStr.StartsWith("-")) { Title = titleStr.Substring(1); } else { Title = "收藏列表"; } IsUcItemDetailVisible = false; IsGrdPwdsListVisible = true; IsBackVisible = false; IsListVisible = true; } }
public override void OpenRecord(BaseTask task) { task.RecordIndex = RecordList.Count; SpatialRecord prevRecord = (RecordList.Count == 0) ? null : RecordList[RecordList.Count - 1] as SpatialRecord; RecordList.Add(new SpatialRecord(prevRecord, task as SpatialTask)); }
private void SendMessage(string content) { Console.WriteLine(content); try { PublishResponse response = client.SendMsg(content); Console.WriteLine(response.Result); RecordList.Add("[" + content + " ] send ." + response.Result); } catch { Console.WriteLine("Error"); } }
/// <summary> /// 替换一个角色的信息,如果该角色不存在,则添加该角色信息 /// </summary> /// <param name="CharacterID"></param> /// <param name="Character"></param> /// <returns></returns> public CharacterInfo RefreshCharacterInfo(int CharacterID, RPGCharacter Character) { for (int i = 0; i < RecordList.Count; i++) { if (RecordList[i].ID == CharacterID) { RecordList[i] = new CharacterInfo(Character.Logic); return(RecordList[i]); } } CharacterInfo NewInfo = new CharacterInfo(Character.Logic); RecordList.Add(NewInfo); return(NewInfo); }
// this method is called for each row of data received from the Shimmer public void UpdateFeed(List <double> data) { Shimmer3DModel s; if (data.Count > 0) { // put this data as a model on the shared Queue s = Shimmer3DModel.GetModelFromArray(data.ToArray()); Queue.Enqueue(s); if (IsRecording) { // save to list aswell RecordList.Add(s); } } }
public void ImportRecordSet(Stream instream) { int currentIndex = instream.ReadByte(); byte[] tempContent = new byte[currentIndex - 1]; instream.Read(tempContent, 0, currentIndex - 1); while (currentIndex < instream.Length - 5) { tempContent = new byte[4]; instream.Read(tempContent, 0, 4); int recordLength = tempContent[3]; currentIndex += 4; tempContent = new byte[recordLength]; instream.Read(tempContent, 0, recordLength); int begin = (tempContent[0] == 1) ? 14 : 3; RecordList.Add(new RuRecord(tempContent, begin)); currentIndex += recordLength; } instream.Close(); }
private void AddRecord() { Record record = new Record() { RecordTime = DateTime.Now.ToShortTimeString(), RecordText = OcrResult }; RecordList.Add(record); List <Record> reclist = new List <Record>(); foreach (var item in RecordList) { reclist.Add(item); } reclist.Reverse(); RecordList.Clear(); foreach (var item in reclist) { RecordList.Add(item); } }
public void AddRecord(RecordInfo record) { record.ID = RecordIDNum; RecordIDNum++; RecordList.Add(record); }
public void SaveToDb(string name) { Console.WriteLine ("Saving to db"); Map map = new Map () { Height = this.h, Width = this.w }; GameState game = new GameState () { Name = name, Map = map, }; string[] deleteTables = new string[] { "gamestate", "map", "hex", "hexresource", "map_cities", "map_rivers", "map_hexes", "hex_edges", "hex_effects", "kingdom" }; foreach (string deleteTable in deleteTables) MySqlProvider.Provider.ExecuteNonQuery ("truncate " + deleteTable + ";"); map.Game = game; map.Save (); game.Save (); RecordList<Hex> hexes = new RecordList<Hex> (); for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { Hex hex = new Hex (); hex.EnsureId (); hex.X = x; hex.Y = y; Color c = b.GetPixel (x, y); if (c == blue) hex.Terrain = TerrainType.Sea; else if (c == white) hex.Terrain = TerrainType.Mountains; else if (c == darkGreen) hex.Terrain = TerrainType.Forest; else if (c == town) { hex.Terrain = TerrainType.Plains; } else hex.Terrain = TerrainType.Plains; hexes.Add (hex); hexMap[x,y] = hex; } } //cities have to be done in a separate pass to account for growth. map.Hexes = hexes; map.EnsureMapIsBuilt (true); //check coastals foreach (Hex h in hexes) if (h.Terrain == TerrainType.Sea) CheckCoastal (h); hexes.Save (); foreach (var kvp in riverPaths) { River r = new River(); int z = 0; foreach(Point p in kvp.Value) { r.Path.Add (new Triple<int> () { X = p.X, Y = p.Y, Z = z++ }); } r.Save (); r.Path.Save (); r.SaveRelations("Path"); map.Rivers.Add (r); } map.SaveRelations ("Rivers"); map.SaveRelations ("Hexes"); }
public void Add(Record R) { RecordList.Add(R); }