Beispiel #1
0
        public Tuple <bool, List <TaskResult>, string> GetTaskList(TaskParam param)
        {
            var body = Newtonsoft.Json.JsonConvert.SerializeObject(param);
            var url  = this.GetPostUrl(Method_GetTaskList, body);

            return(this.Post <List <TaskResult> >(url, body));
        }
Beispiel #2
0
        }//функция считает значение CP

        public Model(BaseLayer baseLayer, Preferences preferences)
        {   //конструктор класса, создает задачу и константу (только одна, Ставка)
            _baseLayer   = baseLayer;
            _preferences = preferences;
            stake        = new TaskParamName()
            {
                Name = "Ставка"
            };
            stakeValue = new TaskParam {
                Task = _baseLayer.Task
            };
            bonus = new EventParamName()
            {
                Name = "Бонус"
            };
            soeg = new CombinParamName()
            {
                Name = "SoEG"
            };

            InitialEvents = preferences.evenoddGame
                                ? InitialEvents = preferences.evenoddNames
                                : InitialEvents = preferences.numericNames;
            game = new Dice(InitialEvents.Length, preferences.numberofthrowings); //, preferences.numberofoutcomesperstake);
            GenerateEvents();
        }//конструктор класса*/
Beispiel #3
0
        public TaskParam CreateTaskParam(TaskContent contentinfo)
        {
            var param = new TaskParam();

            param.taskID   = contentinfo.TaskId;
            param.taskName = contentinfo.TaskName;
            param.tmBeg    = DateTimeFormat.DateTimeFromString(contentinfo.Begin);
            return(param);
        }
Beispiel #4
0
 public void AddTaskParam(Task task, TaskParam param, TaskParamName name, decimal value)
 {
     if (param == null || task == null || name == null)
     {
         return;
     }
     param.Task          = task;
     param.TaskParamName = name;
     param.Value         = value;
     dssDbContext.TaskParams.Add(param);
 }
Beispiel #5
0
    public void    AddCB(ResLoadDelegate cb, ResLoadParams param)
    {
        if (cb == null)
        {
            return;
        }
        TaskParam tp = new TaskParam();

        tp._cb    = cb;
        tp._param = param;
        lstTask.Add(tp);
    }
Beispiel #6
0
 public void ChangePriorityTop(string name)
 {
     lock (lockObject)
     {
         TaskParam taskParam = tasks.Find((TaskParam o) => o.name == name);
         if (taskParam != null)
         {
             tasks.Remove(taskParam);
             tasks.Insert(0, taskParam);
         }
     }
 }
Beispiel #7
0
 public void Add(string name, Action act)
 {
     if (threads != null)
     {
         TaskParam taskParam = new TaskParam();
         taskParam.name = name;
         taskParam.act  = act;
         lock (lockObject)
         {
             tasks.Add(taskParam);
         }
     }
 }
Beispiel #8
0
 /// <summary>
 /// 新增待处理事件
 /// </summary>
 /// <param name="callerName"></param>
 protected void CLPush(string callerName, TaskParam arg = TaskParam._Default)
 {
     lock (CommandLock)
     {
         if (arg != TaskParam._Default)
         {
             CommandList.Add(callerName + arg);
         }
         else
         {
             CommandList.Add(callerName);
         }
     }
 }
Beispiel #9
0
 public Model(BaseLayer _baseLayer, Preferences _preferences)
 {
     baseLayer     = _baseLayer;
     preferences   = _preferences;
     numberOfHeads = new EventParamName()
     {
         Name = "Кол-во Г"
     };
     numberOfTails = new EventParamName()
     {
         Name = "Кол-во Р"
     };
     numberOfDoubleHeads = new EventParamName()
     {
         Name = "Кол-во ГГ"
     };
     headBonus = new TaskParamName()
     {
         Name = "Бонус за Г"
     };
     tailCost = new TaskParamName()
     {
         Name = "Бонус за Р"
     };
     doubleHeadBonus = new TaskParamName()
     {
         Name = "Бонус за ГГ"
     };
     headBonusValue = new TaskParam()
     {
         Task = baseLayer.Task, Value = preferences.HeadBonus
     };
     tailCostValue = new TaskParam()
     {
         Task = baseLayer.Task, Value = preferences.TailCost
     };
     doubleHeadBonusValue = new TaskParam()
     {
         Task = baseLayer.Task, Value = preferences.DoubleHeadBonus
     };
     InitialEvents                 = new char[] { 'Г', 'Р' };
     game                          = new Coin(InitialEvents.Length, preferences.NumberOfThrowings);
     numberOfHeadsInOutcomes       = game.CountSequences(0);
     numberOfTailsInOutcomes       = game.CountSequences(1);
     numberOfDoubleHeadsInOutcomes = game.CountSequences(0, 3);
 }
Beispiel #10
0
 private void Worker()
 {
     try
     {
         TaskParam taskParam = null;
         while (!stopAllThreads)
         {
             if (tasks.Count > 0 || taskParam != null)
             {
                 lock (lockObject)
                 {
                     if (taskParam != null)
                     {
                         workingCount--;
                         taskParam = null;
                     }
                     if (tasks.Count > 0)
                     {
                         taskParam = tasks[0];
                         tasks.RemoveAt(0);
                         workingCount++;
                     }
                 }
                 if (taskParam != null && taskParam.act != null)
                 {
                     taskParam.act();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         if (!(ex is ThreadAbortException))
         {
             Debug.LogError((object)("MultiThreadTaskRunner : " + ex.ToString()));
         }
     }
 }
Beispiel #11
0
 public TaskParams()
 {
     Shtraf = new TaskParam();
     Premia = new TaskParam();
 }
Beispiel #12
0
 public TaskParam(TaskParam obj) : this(obj.i, obj.mSec)
 {
 }