예제 #1
0
        public void LogAnalogueParameter(string parameterName, double?value)
        {
            _uiNotifier.Notify(() => {
                if (value.HasValue)
                {
                    if (!_logs.ContainsKey(parameterName))
                    {
                        var dataSeries = new XyDataSeries <DateTime, double> {
                            SeriesName = parameterName
                        };
                        var color = _colors.First(c => _usedColors.All(uc => uc != c));
                        _usedColors.Add(color);
                        var renderSeries = new FastLineRenderableSeries {
                            DataSeries = dataSeries, SeriesColor = color
                        };

                        var vm       = new ChartSeriesViewModel(dataSeries, renderSeries);
                        var metadata = new SeriesAdditionalData(vm);

                        AnalogSeries.Add(vm);
                        AnalogSeriesAdditionalData.Add(metadata);
                        _logs.Add(parameterName, new PointsSeriesAndAdditionalData(vm, metadata, dataSeries, renderSeries));
                    }
                    _logs[parameterName].DataSeries.Append(DateTime.Now, value.Value);
                    _updatable?.Update();
                }
            });
        }
예제 #2
0
 protected virtual void Update()
 {
     if (updatableObject != null)
     {
         updatableObject.Update(Time.deltaTime);
     }
 }
예제 #3
0
        // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //
        //! 更新
        protected void Update()
        {
            // 毎フレ更新処理
            IUpdatable updatable  = null;
            int        listLength = _allUpdatable.Count;

            for (int i = 0; i < listLength; ++i)
            {
                updatable = _allUpdatable[i];
                // 状態更新
                updatable.UpdateChangeState();
                // 処理更新
                updatable.Update();
                // viewを変更する
                if (updatable.IsWillChangeView)
                {
                    IEntityLogic obj        = (IEntityLogic)updatable;
                    IEntityView  changeView = (IEntityView)updatable.GetWillChangeView();
                    _lifeCycleView.RemoveEntity(obj);
                    updatable.SetView(changeView);
                    _lifeCycleView.AddEntity(obj, changeView);
                    updatable.EndChangeView();
                }
            }
        }
예제 #4
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            // Updates render manager
            _renderManager.Update(gameTime);

            base.Draw(gameTime);
        }
예제 #5
0
        public bool UpdateJobMetadataValues(
            IDictionary <Expression <Func <SqlCommonDbOddJobMetaData, object> >, object> setters, Guid jobGuid,
            string oldStatusIfRequired)
        {
            using (var conn = _jobQueueConnectionFactory.CreateDataConnection(_mappingSchema.MappingSchema))
            {
                var updatable = QueueTable(conn)
                                .Where(q => q.JobGuid == jobGuid);
                if (String.IsNullOrWhiteSpace(oldStatusIfRequired) == false)
                {
                    updatable = updatable.Where(q => q.Status == oldStatusIfRequired);
                }

                IUpdatable <SqlCommonDbOddJobMetaData> updateCommand = null;
                foreach (var set in setters)
                {
                    updateCommand = (updateCommand == null)
                        ? updatable.Set(set.Key, set.Value)
                        : updateCommand.Set(set.Key, set.Value);
                }
                if (updateCommand != null)
                {
                    return(updateCommand.Update() > 0);
                }

                return(false);
            }
        }
        public void Update()
        {
            for (int i = 0; i < behaviours.Count; i++)
            {
                Behaviour b = behaviours[i];

                if (!b.Enabled)
                {
                    continue;
                }

                if (b is IStartable)
                {
                    IStartable startable = b as IStartable;
                    if (!startable.IsStarted)
                    {
                        startable.Start();
                        startable.IsStarted = true;
                    }
                }

                if (b is IUpdatable)
                {
                    IUpdatable updatable = b as IUpdatable;
                    updatable.Update();
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Обновить поля в записи
        /// </summary>
        /// <param name="model">Запись</param>
        /// <param name="fields">Список полей</param>
        /// <exception cref="ArgumentException">Обновляемое поле не может быть типа enum</exception>
        public virtual void UpdateFields(T model, params Expression <Func <T, object> >[] fields)
        {
            IUpdatable <T> update = _table.Where(IdQuery(model)).AsUpdatable();

            foreach (var field in fields)
            {
                var value = field.Compile()(model);

                // Так как для драйвера npgsql не всё равно передается ли ему Enum или (object)Enum,
                // а так как expression как раз возвращает (object)Enum и не нашлось способа присести его к Enum
                // выбрасываем исключение при попытки обновить поле типа Enum
                if (value is Enum)
                {
                    var message =
                        @"Обновляемое поле не может быть типа enum

Для обновление поля типа enum используйте конструкцию:
Essence.AsQuerible()
.Where(x => x.Id == DbModel.Id)
.Set(x => x.Enum, DbModel.Enum)
...
.Update();";
                    throw new ArgumentException(message, "fields");
                }

                update = update.Set(field, value);
            }

            update.Update();
        }
예제 #8
0
 private void Update()
 {
     for (int i = 0; i < _runnables.Count; i++)
     {
         IUpdatable runnable = _runnables[i];
         runnable.Update();
     }
 }
예제 #9
0
 private void Update()
 {
     _mainThreadActions.Invoke();
     if (_updatable != null)
     {
         _updatable.Update();
     }
 }
예제 #10
0
        /// <summary>
        /// Update Job Metadata and Parameters via a Built command.
        /// </summary>
        /// <param name="commandData">A <see cref="JobUpdateCommand"/> with Criteria for updating.</param>
        /// <returns></returns>
        /// <remarks>This is designed to be a 'safe-ish' update. If done in a <see cref="TransactionScope"/>,
        /// You can roll-back if this returns false. If no <see cref="TransactionScope"/> is active,
        /// you could get dirty writes under some very edgy cases.
        /// </remarks>
        public bool UpdateJobMetadataAndParameters(JobUpdateCommand commandData)
        {
            //TODO: Make this even safer.
            using (var conn = _jobQueueConnectionFactory.CreateDataConnection(_mappingSchema.MappingSchema))
            {
                bool ableToUpdateJob = true;
                var  updatable       = QueueTable(conn)
                                       .Where(q => q.JobGuid == commandData.JobGuid);
                if (String.IsNullOrWhiteSpace(commandData.OldStatusIfRequired) == false)
                {
                    updatable = updatable.Where(q => q.Status == commandData.OldStatusIfRequired);
                }

                IUpdatable <SqlCommonDbOddJobMetaData> updateCommand = null;
                foreach (var set in commandData.SetJobMetadata)
                {
                    updateCommand = (updateCommand == null)
                        ? updatable.Set(set.Key, set.Value)
                        : updateCommand.Set(set.Key, set.Value);
                }
                if (updateCommand != null)
                {
                    ableToUpdateJob = updateCommand.Update() > 0;
                }
                else
                {
                    ableToUpdateJob = updatable.Any();
                }

                if (ableToUpdateJob && commandData.SetJobParameters != null && commandData.SetJobParameters.Count > 0)
                {
                    foreach (var jobParameter in commandData.SetJobParameters)
                    {
                        var updatableParam = ParamTable(conn)
                                             .Where(q => q.JobGuid == commandData.JobGuid && q.ParamOrdinal == jobParameter.Key &&
                                                    ableToUpdateJob);
                        IUpdatable <SqlCommonOddJobParamMetaData> updateParamCommand = null;
                        foreach (var updatePair in jobParameter.Value)
                        {
                            updateParamCommand = (updateParamCommand == null)
                                ? updatableParam.Set(updatePair.Key, updatePair.Value)
                                : updateParamCommand.Set(updatePair.Key, updatePair.Value);
                        }

                        if (updateParamCommand != null)
                        {
                            var updatedRows = updateParamCommand.Update();
                            if (updatedRows == 0)
                            {
                                return(false);
                            }
                        }
                    }
                }

                return(ableToUpdateJob);
            }
        }
예제 #11
0
        public static void Update <TTable>(this IFieldSet me, DataConnection conn)
            where TTable : class
        {
            var tableType     = typeof(TTable);
            var parameterExpr = Expression.Parameter(tableType);

            Expression predicate = null;
            var        setters   = new List <Setter>();

            foreach (var property in me.GetType().GetProperties())
            {
                if (property.CustomAttributes.Any(x => x.AttributeType == typeof(NotMappedAttribute)))
                {
                    continue;
                }

                var propertyExpr  = Expression.Property(parameterExpr, property.Name);
                var propertyValue = property.GetValue(me);

                if (propertyValue is Field field)
                {
                    setters.Add(new Setter(field, Expression.Lambda(propertyExpr, parameterExpr)));
                }
                else
                {
                    var keyExpr = Expression.Equal(propertyExpr, Expression.Constant(propertyValue));

                    predicate = predicate == null ? keyExpr : Expression.And(predicate, keyExpr);
                }
            }

            var queryable = conn.GetTable <TTable>().Where(Expression.Lambda <Func <TTable, bool> >(predicate, parameterExpr));


            IUpdatable <TTable> updatable = null;

            foreach (var setter in setters)
            {
                if (updatable == null)
                {
                    updatable = SetMethods["IQueryable`1"]
                                .MakeGenericMethod(tableType, setter.Field.GetValueType())
                                .Invoke(
                        null,
                        new[] { queryable, setter.Lambda, setter.Field.GetValue() }) as IUpdatable <TTable>;
                }
                else
                {
                    updatable = SetMethods["IUpdatable`1"]
                                .MakeGenericMethod(tableType, setter.Field.GetValueType())
                                .Invoke(
                        null,
                        new[] { updatable, setter.Lambda, setter.Field.GetValue() }) as IUpdatable <TTable>;
                }
            }

            updatable.Update();
        }
        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            if (obj as Employee != null)
            {
                ApplyChangesBy(obj as Employee);
            }
            else
            if (obj as TradePoint != null)
            {
                ApplyChangesBy(obj as TradePoint);
            }
            else
            if (obj as TradePointPayment != null)
            {
                ApplyChangesBy(obj as TradePointPayment);
            }
            else
            if (obj as Order != null)
            {
                ApplyChangesBy(obj as Order);
            }
            else
            if (obj as Product != null)
            {
                ApplyChangesBy(obj as Product);
            }
            else
            if (obj as Supplier != null)
            {
                ApplyChangesBy(obj as Supplier);
            }
            else
            if (obj as TradePointCustomer != null)
            {
                ApplyChangesBy(obj as TradePointCustomer);
            }
            else
            if (obj as TradePointProduct != null)
            {
                ApplyChangesBy(obj as TradePointProduct);
            }
            else
            if (obj as TradePointRequest != null)
            {
                ApplyChangesBy(obj as TradePointRequest);
            }
            else
            if (obj as TradePointSale != null)
            {
                ApplyChangesBy(obj as TradePointSale);
            }

            windowToUpdate.Update();
            this.Close();
        }
예제 #13
0
        private void Simulate()
        {
            //var t = new Thread(new ThreadStart(ui.Update));
            //t.Start();

            ui.Update();
            foreach (var sb in PlaceBuses)
            {
                MoveBuses(sb.Key, sb.Value);
            }
        }
예제 #14
0
파일: Scene.cs 프로젝트: DStow/MonoGameLib
 public virtual void Update(GameTime gameTime)
 {
     foreach (object o in GameObjects)
     {
         IUpdatable updatableObj = o as IUpdatable;
         if (updatableObj != null)
         {
             updatableObj.Update(gameTime);
         }
     }
 }
예제 #15
0
        public void Notify(Dictionary <IVremenskiParametar, double> vrednostiVremenskihParametara, DateTime vremeSlanja)
        {
            foreach (Form form in this.MdiChildren)
            {
                IUpdatable client = form as IUpdatable;
                if (client == null)
                {
                    continue;
                }

                client.Update(vrednostiVremenskihParametara, vremeSlanja);
            }
        }
예제 #16
0
        public static void FeedToReady(this IUpdatable updatable, double start = 1d, double stepSize = 0.1d, long?timeStart = null, long timeStepMilliseconds = 1000)
        {
            if (updatable == null)
            {
                throw new ArgumentNullException(nameof(updatable));
            }
            if (updatable == null)
            {
                throw new ArgumentNullException(nameof(updatable));
            }
            var time = timeStart ?? new DateTime(2000, 1, 1).ToEpochTime();

            for (; !updatable.IsReady; start += stepSize, time += timeStepMilliseconds)
            {
                updatable.Update(time, start);
            }
        }
예제 #17
0
        public static void FeedTradeBar(this IUpdatable updatable, int count, double start, double stepSize, long?timeStart = null, long timeStepMilliseconds = 1000)
        {
            if (updatable == null)
            {
                throw new ArgumentNullException(nameof(updatable));
            }
            if (count <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(count));
            }
            var time = timeStart ?? new DateTime(2000, 1, 1).ToEpochTime();

            for (int i = 0; i < count; i++, start += stepSize, time += timeStepMilliseconds)
            {
                updatable.Update(time, DoubleArray.From(new TradeBarValue(start + 0.03, start + 0.05, start - 0.05, start - 0.03, 1)));
            }
        }
예제 #18
0
        public static void FeedTradeBarToReady(this IUpdatable updatable, IUpdatable[] mustBeReady, double start = 1d, double stepSize = 0.1d, long?timeStart = null, long timeStepMilliseconds = 1000)
        {
            if (updatable == null)
            {
                throw new ArgumentNullException(nameof(updatable));
            }
            if (mustBeReady == null)
            {
                throw new ArgumentNullException(nameof(mustBeReady));
            }
            var time = timeStart ?? new DateTime(2000, 1, 1).ToEpochTime();

            for (; !mustBeReady.All(v => v.IsReady); start += stepSize, time += timeStepMilliseconds)
            {
                updatable.Update(time, DoubleArray.From(new TradeBarValue(start + 0.03, start + 0.05, start - 0.05, start - 0.03, 1)));
            }
        }
예제 #19
0
 public virtual void Update(IUpdatable element)
 {
     if (this.DisableUpdates)
     {
         return;
     }
     if (this._updateNestLevel == 0)
     {
         element.Update();
     }
     else
     {
         if (this._elementsToUpdate.Contains(element) || element.Parent != null && this._elementsToUpdate.Contains(element.Parent))
         {
             return;
         }
         this._elementsToUpdate.Add(element);
     }
 }
        public void Update(GameTime gameTime)
        {
            for (int i = 0; i < TotalComponents; ++i)
            {
                if (Components[i] is IUpdatable)
                {
                    IUpdatable CurrentUpdatable = Components[i] as IUpdatable;

                    CurrentUpdatable.Update(gameTime);

                    if (Components[i].IsComponentManager())
                    {
                        EngineComponentManager Submanager = Components[i] as EngineComponentManager;

                        Submanager.Update(gameTime);
                    }
                }
            }
        }
예제 #21
0
 public virtual void EndUpdates()
 {
     if (this._updateNestLevel == 1)
     {
         int count1 = this._elementsToUpdate.Count;
         int count2 = this._actionsToExecuteBeforeUpdating.Count;
         KeyValuePair <object, Action> keyValuePair1;
         do
         {
             keyValuePair1 = Enumerable.FirstOrDefault <KeyValuePair <object, Action> >((IEnumerable <KeyValuePair <object, Action> >) this._actionsToExecuteBeforeUpdating);
             if (keyValuePair1.Value != null)
             {
                 keyValuePair1.Value();
                 this._actionsToExecuteBeforeUpdating.Remove(keyValuePair1.Key);
             }
         }while (keyValuePair1.Value != null);
         this._isUpdatingStarted = true;
         while (this._elementsToUpdate.Count > 0)
         {
             IUpdatable updatable = this._elementsToUpdate[0];
             if (updatable.Parent == null || !this._elementsToUpdate.Contains(updatable.Parent))
             {
                 updatable.Update();
             }
             this._elementsToUpdate.RemoveAt(0);
         }
         this._actionsExecutedWhileUpdating.Clear();
         this._isExecutingAfterUpdatingStarted = true;
         EnumerableFunctions.ForEachWithIndex <KeyValuePair <object, Action> >((IEnumerable <KeyValuePair <object, Action> >) this._actionsToExecuteAfterUpdating, (Action <KeyValuePair <object, Action>, int>)((item, index) => item.Value()));
         this._actionsToExecuteAfterUpdating.Clear();
         this._isUpdatingStarted = false;
         this._isExecutingAfterUpdatingStarted = false;
         foreach (KeyValuePair <string, UpdateSession.CounterInfo> keyValuePair2 in this._counters)
         {
             int num = keyValuePair2.Value.Duration != TimeSpan.Zero ? 1 : 0;
         }
         this._counters.Clear();
     }
     --this._updateNestLevel;
 }
예제 #22
0
        private void Update()
        {
            for (int i = 0, ilen = _actions.Count; i < ilen; ++i)
            {
                RegistrationAction action = _actions[i];
                if (action.Type == RegistrationActionType.Add)
                {
                    _items.Add(action.Updatable);
                }
                else
                {
                    _items.Remove(action.Updatable);
                }
            }
            _actions.Clear();

            for (int i = 0, ilen = _items.Count; i < ilen; ++i)
            {
                IUpdatable item = _items[i];
                item.Update(Time.deltaTime);
            }
        }
예제 #23
0
        /// <summary>
        /// Updates this object.
        /// All the <see cref="IUpdatable"/> and <see cref="ILateUpdatable"/> added to this object will be updated as well.
        /// </summary>
        public void Update()
        {
            TimeSpan timeSinceLastUpdate = DateTime.Now - lastUpdateTime;

            lastUpdateTime = DateTime.Now;

            for (int i = 0; i < updatables.Count; i++)
            {
                IUpdatable updatable = updatables[i].Target;
                if (updatable != null)
                {
                    updatable.Update(timeSinceLastUpdate);
                }
                else
                {
                    updatables.RemoveAt(i--);
                }
            }

            TimeSpan timeSinceLastLateUpdate = DateTime.Now - lastLateUpdateTime;

            lastLateUpdateTime = DateTime.Now;

            for (int i = 0; i < lateUpdatables.Count; i++)
            {
                ILateUpdatable lateUpdatable = lateUpdatables[i].Target;
                if (lateUpdatable != null)
                {
                    lateUpdatable.LateUpdate(timeSinceLastLateUpdate);
                }
                else
                {
                    lateUpdatables.RemoveAt(i--);
                }
            }
        }
예제 #24
0
 public virtual void Update(IUpdatable element)
 {
     if (this.DisableUpdates)
         return;
     if (this._updateNestLevel == 0)
     {
         element.Update();
     }
     else
     {
         if (this._elementsToUpdate.Contains(element) || element.Parent != null && this._elementsToUpdate.Contains(element.Parent))
             return;
         this._elementsToUpdate.Add(element);
     }
 }
예제 #25
0
 private void Update()
 {
     playerLoopProcessor.Update(Time.deltaTime);
 }
예제 #26
0
 protected override void Iteration()
 {
     _updatable.Update();
 }
예제 #27
0
 public static int Update <T>(this IUpdatable <T> collection, T instance, Expression <Func <T, bool> > updateCheck)
 {
     return(collection.Update <T, int>(instance, updateCheck, null));
 }
예제 #28
0
 public static int Update <T>(this IUpdatable <T> collection, T instance)
 {
     return(collection.Update <T, int>(instance, null, null));
 }
예제 #29
0
 public void Update()
 {
     _updatable?.Update();
 }
예제 #30
0
 public ActionResult EditProducts(int Id, Product product)
 {
     updatable.Update(Id, product);
     return(RedirectToAction("Index"));
 }
예제 #31
0
            public static void Update(this WindowConsole windowconsole)
            {
                IUpdatable updater = windowconsole;

                updater.Update();
            }