Esempio n. 1
0
        public void Repeat(string hasThread, string number, string threadNumber)
        {
            try {
                var data = bool.Parse(hasThread) ? Int32.Parse(threadNumber) : Int32.Parse(number);

                var record_last = RecordQueries.GetRecords().Last();
                RecordQueries.GetRecords().Remove(record_last.Key);
                var last_id           = record_last.Key;
                var _id               = RecordQueries.GetRecords().OrderBy(r => r.Key).Last().Key;
                var listOfRecordModel = RecordQueries.GetRecords().Where(r => r.Key <= _id)
                                        .Select(rec => new RecordModel {
                    Id = rec.Key,
                    ModelInstanceName = rec.Value.modelInstance.ToString(),
                    MethodName        = rec.Value.method.Name,
                    args         = rec.Value.args,
                    ReturnedName = rec.Value.method.Name + '-' + rec.Key,
                    Once         = false
                });
                var records_json  = JsonConvert.SerializeObject(listOfRecordModel);
                var modelInstance = Type.GetType("BCL.Repeater._Config");
                var method        = modelInstance.GetMethod("_Repeat");
                var args          = new object[] { hasThread, data.ToString(), records_json };
                RecordQueries.AddNewRecord(last_id, (modelInstance, method, args));
            } catch (System.Exception e) {
                CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// paste records in records list
 /// </summary>
 /// <param name="name">name of variable</param>
 public void PasteRecords(string name)
 {
     try {
         var records = VariablesStorageQueries.GetVariableValue(name) as IEnumerable <object>;
         foreach (dynamic item in records)
         {
             RecordQueries.AddNewRecord(item.Name, item.Value);
         }
     } catch (Exception e) {
         CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// import records to records storage
 /// </summary>
 /// <param name="name">file name</param>
 public void ImportRecords(string fileName)
 {
     try {
         using (StreamReader reader = new StreamReader(fileName)) {
             var json    = reader.ReadToEnd();
             var records = JsonConvert.DeserializeObject <List <RecordModel> > (json) as List <RecordModel>;
             //add to record storage
             foreach (var record in records)
             {
                 RecordQueries.AddNewRecord(record.Id, (Type.GetType(record.ModelInstanceName),
                                                        Type.GetType(record.ModelInstanceName).GetMethod(record.MethodName), record.args));
             }
         }
     } catch (Exception e) {
         CMD.ShowApplicationMessageToUser($"message : {e.Message}\nroute : {this.ToString()}", showType: ShowType.DANGER);
     }
 }