private void InitLib() { configLib = new Config(); aConfig = configLib.getConfigObj(); atsLib = new ATSSend(aConfig.switchBetweenChineseAndEnglis); atsLib.initATSLib(aConfig.sendIP, aConfig.sendPort, 30, aConfig.pisServerIP1, aConfig.pisServerPort1); logicLib = new Logic(aConfig.confgStationList.Count); communicationLib = new communication(); if (!communicationLib.StarSevice(aConfig.atsServerPort1, aConfig.atsServerIP1, 4096 * 2, 0)) { // 如果备也连接失败开户定时器每隔2秒重连 // 实例化Timer类,设置间隔时间为10000毫秒; if (connectTimer == null) { connectTimer = new System.Timers.Timer(5000); // 到达时间的时候执行事件 获取中央ATS-列车状态; connectTimer.Elapsed += new System.Timers.ElapsedEventHandler(reConnectServer); // 设置是执行一次(false)还是一直执行(true); connectTimer.AutoReset = true; // 是否执行System.Timers.Timer.Elapsed事件; connectTimer.Enabled = true; } } communicationLib.recvCommChanged += CommunicationLib_recvCommChanged; communicationLib.disConnectChanged += CommunicationLib_disConnectChanged; // 处理数据线程 Thread dataThread = new Thread(new ParameterizedThreadStart(logicDataThread)); dataThread.Start((Object)this); }
public void setUp( Vector2 position, int width, int height, ILogic brain = null, BodyBase body = null, IRenderable renderer = null, IMovable mover = null ) { // Start setUp. if (!_setUp) { // Start not setup if. _position = position; _width = width; _height = height; _setUp = true; if (brain != null) _brain = brain; if (body != null) _body = body; if (renderer != null) _renderer = renderer; if ( mover != null) _mover = mover; } // End not setup if. }
public ObservingLogicDecoration(ILogic decorated, LogicOf<ILogic> preObservation, LogicOf<ILogic> postObservation) : base(decorated) { this.PostObservation = postObservation; this.PreObservation = preObservation; }
internal CDialogTrade(ILogic iLogic, CDialogMain dialogMain) { InitializeComponent( ); _iLogicSearch = iLogic.LogicSearch; _iLogicTrade = iLogic.LogicTrade; _dialogMain = dialogMain; }
//Erstellt eine neue der Factory eintsprechende Klasse public static void Create(ILogic logic, IDataLoan dataLoan) { if (logic is CLogic) { (logic as CLogic).Loan = new CLogicLoan(dataLoan); } }
static void Main(string[] args) { var argsParser = new Parser(args); string src = argsParser["src"]; string dest = argsParser["dest"]; dest = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dest, DateTime.Now.ToString("HH-mm-ss")); if (!Directory.Exists(dest)) { Directory.CreateDirectory(dest); } var paths = Directory.GetFiles(src); var container = Register(); ILogic logic = container.Resolve <ILogic>(); var sw = Stopwatch.StartNew(); logic.ImagePath(paths); sw.Stop(); Console.WriteLine($"Done: {sw.Elapsed}"); Console.ReadKey(); }
public static void Create(ILogic logic, IDataAdd dataAdd) { if (logic is CLogic) { (logic as CLogic).Add = new CLogicAdd(dataAdd); } }
public MainForm(ILogic logic) { InitializeComponent(); this.logic = logic; ctlUserGrid.AutoGenerateColumns = false; ctlSubscriptionGrid.AutoGenerateColumns = false; }
public void UpdateGroupLogic(Type newLogic) { if (newLogic == null) { LogManager.GetCurrentClassLogger().Info($"Scene template {_worldLocationId} logic is empty!"); Clear(); return; } _myItems = GameStateData.GetWrapperCollection(); var logic = Activator.CreateInstance(newLogic) as ILogic; if (logic == null) { LogManager.GetCurrentClassLogger().Error($"Initialize location logic error! SceneId = {_worldLocationId}. Message: Logic is null!"); VRErrorManager.Instance.Show(ErrorHelper.GetErrorDescByCode(Errors.ErrorCode.LogicInitError)); return; } Logic = logic; try { LogManager.GetCurrentClassLogger().Info($"Scene template {_worldLocationId} logic initialize started..."); InitializeLogic(); LogManager.GetCurrentClassLogger().Info($"Scene template {_worldLocationId} logic initialize successful"); } catch (Exception e) { ShowLogicExceptionError(Errors.ErrorCode.LogicInitError, "Initialize scene template logic error!", e); Logic = null; } }
/// <summary> /// 将一个ILogic从当前LogicNode的时序控制下剔除 /// logic会在下一逻辑帧开始时摘除 /// </summary> /// <param name="logic"></param> public void DetachLogic(ILogic logic) { if (threadSafe) { lock (logicsToUpdate) { if (isInProcessing) { logicsToUpdate.Enqueue(new LogicPack(logic, false)); } else { DetachLogicNow(logic); } } } else { if (isInProcessing) { logicsToUpdate.Enqueue(new LogicPack(logic, false)); } else { DetachLogicNow(logic); } } }
void Run() { // Pfad zur Datenbank string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\VideoDatabase.accdb"; string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";"; // Objekterstellung passend zu den gewählten Factories IFactoryIData factoryData = new CFactoryCDataAccess(); _data = factoryData.Create(connectionString); IFactoryILogic factoryLogic = new CFactoryCLogic(); _logic = factoryLogic.Create(_data); AFactoryLogicSearch.Create(_logic, _data.Search); AFactoryLogicBorrow.Create(_logic, _data.Loan); IFactoryIDialog factoryDialog = new CFactoryCDialog(); _dialogMain = factoryDialog.Create(_logic); AFactoryDialogSearch.SearchCreate(_logic.Search, _dialogMain); AFactoryDialogSearch.SearchResultCreate(_dialogMain); AFactoryDialogLoan.LoanInsertCreate(_logic, _dialogMain); AFactoryDialogLoan.LoanUpdateCreate(_logic, _dialogMain); AFactoryDialogLoan.LoanDeleteCreate(_logic, _dialogMain); _data.Init(); // CDialogMain starten if (_dialogMain is Form) { Application.Run(_dialogMain as Form); } }
public static void Create(ILogic logic, IDataModify dataModify) { if (logic is CLogic) { (logic as CLogic).Modify = new CLogicModify(dataModify); } }
/// <summary> /// decorates with polyfacingness if it's not already there /// </summary> /// <typeparam name="T"></typeparam> /// <param name="logic"></param> /// <param name="rootFace"></param> /// <returns></returns> public static PolyfacingLogicDecoration <Tface> Polyfacing <Tface>(this ILogic decorated, Polyface rootFace = null) where Tface : ILogic { Condition.Requires(decorated).IsNotNull(); PolyfacingLogicDecoration <Tface> rv = null; /*Summary: * if we spec a root we are setting a face on that root, else we are using a new * if the condition is already polyfacing we use that otherwise build new one * if no root is spec'd we create new polyface */ //if we have polyface in our chain, we return that if (decorated.HasDecoration <PolyfacingLogicDecoration <Tface> >()) { rv = decorated.As <PolyfacingLogicDecoration <Tface> >(); } else { rv = new PolyfacingLogicDecoration <Tface>(decorated, rootFace); } return(rv); }
public static Polyface IsStrategizedTouchable(this Polyface root, ILogic logic) { Condition.Requires(root).IsNotNull(); var composited = new StrategizedTouchable(logic); root.IsHasTouchable(composited); return root; }
public ProductForm(ILogic logic) { InitializeComponent(); this.logic = logic; dProducts.AutoGenerateColumns = false; dProducts.DataSource = logic.GetProducts(); }
public MainForm(ILogic logic) { InitializeComponent(); this.logic = logic; UpdateUsersGrid(); UpdateRewardGrid(); }
/// <summary> /// 恢复测试逻辑的环境 /// </summary> /// <param name="iLogic"></param> /// <param name="lstCaseNo"></param> /// <param name="clusterName"></param> /// <returns></returns> private bool RestoreLogicScripts(ILogic iLogic, List <string> lstCaseNo, string clusterName) { bool RestoreLogicScriptsRes = true; var TestClusterNmae = clusterName; var LogicName = iLogic.GetType().FullName; Dictionary <string, string>[] TestCaseData = iLogic.Data().Where(data => { return(lstCaseNo.IndexOf(this.GetDictValue(data, "测试用例")) != -1); }).ToArray(); Console.WriteLine("恢复本次测试逻辑预置条件:{0}", iLogic.GetType()); try { if (!iLogic.RestoreScripts()) { RestoreLogicScriptsRes = false; throw new Exception("恢复预置条件返回值为FALSE"); } } catch { Console.WriteLine("测试逻辑恢复脚本失败"); } finally { } return(RestoreLogicScriptsRes); }
private IEnumerator _Shuffle(ILogic logic, int level) { btn_Start.enabled = false; btn_Restart.enabled = false; Random rnd = new Random(); int lastValShuffled = -1; for (int i = 0; i < level; i++) { yield return(new WaitForSeconds(SpeedShuffle)); List <IChip> adjCellsCoords = new List <IChip>(); foreach (var cell in logic.EmptyCell.GetAdjacentCells(AdjacementCount.Cells4)) { if (_CheckPosition(cell) && _logicGame.Field[cell.PosY, cell.PosX].Value != lastValShuffled) { adjCellsCoords.Add(cell); } } IChip rndCoord = adjCellsCoords[rnd.Next(0, adjCellsCoords.Count)]; IChip tempCh = _logicGame.Field[rndCoord.PosY, rndCoord.PosX]; lastValShuffled = tempCh.Value; _logicGame.MoveChip(tempCh); _SwapPos(_chipsInScene[tempCh.Value - 1].transform, _emptyCellPos.transform); SoundManager.ShufflePlay(); } btn_Start.enabled = true; btn_Restart.enabled = true; _isGameReady = true; SoundManager.StartingPlay(); }
/// <summary> /// 执行单个测试逻辑 /// </summary> /// <param name="iLogic"></param> /// <param name="lstCaseNo">所有的测试用例编号链表</param> /// <param name="clusterName"></param> /// <returns></returns> private bool SetupLogicScripts(ILogic iLogic, List <string> lstCaseNo, string clusterName) { bool SetupLogicScriptsRes = true; string TestClusterName = clusterName; string LogicName = iLogic.GetType().FullName.ToString(); Dictionary <string, string>[] TestCaseData = iLogic.Data().Where(data => { return(lstCaseNo.IndexOf(this.GetDictValue(data, "用例编号")) != -1); }).ToArray(); try { //这儿是预处理测试逻辑里面的预处理 if (!iLogic.SetupScripts()) { SetupLogicScriptsRes = false; throw new Exception("测试逻辑预置条件失败"); } } catch { } finally { } return(SetupLogicScriptsRes); }
public Response UpdateGroup(ILogic logic) { this.RequiresClaims(c => c.Type == PermissionsType && c.Value.Contains(EditPermission)); try { var existingGroup = this.Bind <DtoRecepientGroup> (new BindingConfig { BodyOnly = true }); if (int.Parse(Context.Parameters.id) != existingGroup.Id) { return(HttpStatusCode.BadRequest); } logic.UpdateRecepientGroup(existingGroup); return(HttpStatusCode.OK); } catch { return(HttpStatusCode.InternalServerError); } }
// Erstellen CDialogLoanInsert fürs Insert public static void LoanInsertCreate(ILogic logic, IDialog dialogMain) { if (dialogMain is CDialogMain) { (dialogMain as CDialogMain).DialogLoanInsert = new CDialogLoanInsert(logic, dialogMain); } }
public AddProductForm(ILogic logic, int id) : this(logic) { this.id = id; txtTitle.Text = logic.GetProducts().Where(u => u.Id == id).Select(u => u.Title).ToArray()[0].ToString(); txtPrice.Text = logic.GetProducts().Where(u => u.Id == id).Select(u => u.Price).ToArray()[0].ToString(); txtLeadTime.Text = logic.GetProducts().Where(u => u.Id == id).Select(u => u.LeadTime).ToArray()[0].ToString(); }
// Erstellen CDialogLoanDelete fürs Delete public static void LoanDeleteCreate(ILogic logic, IDialog dialogMain) { if (dialogMain is CDialogMain) { (dialogMain as CDialogMain).DialogLoanDelete = new CDialogLoanDelete(logic, dialogMain); } }
private StrategizedTask(string id, ILogic performLogic, ILogic cancelLogic = null) : base(id) { Condition.Requires(performLogic).IsNotNull(); this.PerformLogic = performLogic; this.CancelLogic = cancelLogic; }
public App(IOutput output, IDispatcher dispatcher, ILogic logic, ILoop loop) { this.output = output; this.dispatcher = dispatcher; this.logic = logic; this.loop = loop; }
public void SetInst(List <Type> types, ILogic logicInst) { if (!(logicInst is IClientServerLogic logic)) { return; } _serializator = new TestSerializator(); Storage = new TestCommandStorage(_serializator); var path = logic.ConfigPath; var clientCreator = types.Find(x => x.Namespace == logic.NamespaceCreator && x.Name == "ClientLogicCreator"); var serverCreator = types.Find(x => x.Namespace == logic.NamespaceCreator && x.Name == "ServerLogicCreator"); var data = new ClientServerData { client = clientCreator.GetMethod("Create").Invoke(null, new [] { _serializator, Storage, logic.ClientExternalApi }), server = serverCreator.GetMethod("Create").Invoke(null, new[] { _serializator, logic.ServerExternalApi }), }; var commands = data.client.GetType().GetProperty("Commands").GetValue(data.client); var state = data.client.GetType().GetProperty("State").GetValue(data.client); var config = ConfigUtility.GetData(path); _server.Init(data, _serializator, config); _client.Init(data, Storage, _serializator, config); logic.SetDependencies(commands, state); }
//Erstellt eine neue der Factory eintsprechende Klasse public static void Create(ILogic logic, IDataSearch dataSearch) { if (logic is CLogic) { (logic as CLogic).Search = new CLogicSearch(dataSearch); } }
private void TRControl_Loaded(object sender, RoutedEventArgs e) { model = new TRModel(); model.InitalizeTraffic(); repository = new TRRepository(model); logic = new TRLogic(model, repository, Dispatcher); renderer = new TRRenderer(model); Window win = Window.GetWindow(this); if (win != null) { tickTimer = new DispatcherTimer(); tickTimer.Interval = TimeSpan.FromMilliseconds(30); tickTimer.Tick += TickTimer_Tick; tickTimer.Start(); logic.SpawnTraffic(); win.KeyDown += Win_KeyDown; } logic.RefreshScreen += (obj, args) => InvalidateVisual(); logic.GameEnded += (obj, args) => GameEnd(obj, args); InvalidateVisual(); }
public void Subscribe(string eventId, IStateObject component, ILogic logic, string methodName) { var type = logic.GetType(); var method = type.Method(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | Flags.ExcludeBackingMembers); RegisterMethodForEvent(logic, method, component.ToString(), eventId, component); }
public ReportTask(ILogic logic, ILifetimeScope autofac, IRepository repository, IMonik monik, int id, string name, string parameters, string dependsOn, DtoSchedule schedule, List <DtoOperation> opers) { this.monik = monik; this.repository = repository; Id = id; Name = name; Schedule = schedule; Operations = new List <IOperation>(); Parameters = new Dictionary <string, object>(); if (!string.IsNullOrEmpty(parameters)) { Parameters = JsonConvert .DeserializeObject <Dictionary <string, object> >(parameters); } DependsOn = new List <TaskDependency>(); if (!string.IsNullOrEmpty(dependsOn)) { DependsOn = JsonConvert .DeserializeObject <List <TaskDependency> >(dependsOn); } this.autofac = autofac; ParseDtoOperations(logic, opers); } //ctor
public ObservingLogicDecoration(ILogic decorated, LogicOf <ILogic> preObservation, LogicOf <ILogic> postObservation) : base(decorated) { this.PostObservation = postObservation; this.PreObservation = preObservation; }
public Presenter(ILogic logic, IMainForm view) { this.logic = logic; this.view = view; view.SelectFileClick += View_SelectFileClick; view.Check += View_Check; }
public BackgroundHost(bool isEnabled, double backgroundIntervalMSecs, ILogic backgroundAction) { this._backgroundIntervalMSecs = backgroundIntervalMSecs; this.BackgroundAction = backgroundAction; //do this last this.IsEnabled = isEnabled; }
public PrestigeModifier(string identifier, string label, string description, ILogic requirements, int dailyChange) { Identifier = identifier; Label = label; Description = description; this.requirements = requirements; DailyChange = dailyChange; }
public StrategizedService(ILogic initStrategy, ILogic startStrategy, ILogic stopStrategy) : base() { this.InitStrategy = initStrategy; this.StartStrategy = startStrategy; this.StopStrategy = stopStrategy; }
public Event(string id, string desc, ILogic requirements, IExecute dirExec, EventOption[] options, Parameter[] parameters) { Identifier = id; Description = desc; ActionRequirements = requirements; DirectExecute = dirExec; Options = options; Parameters = parameters; }
public Job(string id, string label, string description, Bitmap image, bool unique, bool permanent, ILogic requirements, string onHire, string onFire) { Identifier = id; Label = label; Description = description; Image = image; Unique = unique; Permanent = permanent; Requirements = requirements; OnHire = onHire; OnFire = onFire; }
public Room(string id, string name, bool common, int priority, string[] actions, ILogic requirements) { Identifier = id; Name = name; Common = common; Priority = priority; Actions = actions; Requirements = requirements; if (Actions == null || Actions.Length == 0) { throw new ArgumentNullException("Rooms must have at least one action"); } }
private static bool? TryEval(ILogic element) { if (element == null) return false; Pin pin = element as Pin; if (pin == null) throw new System.Exception("Connected with unknown element!"); if (pin.Direction == PortDirection.Out) return pin.Eval(); return null; }
public TaskingLogicDecoration(ILogic decorated, string taskId, ILogic cancelLogic = null) : base(decorated) { Condition.Requires(taskId).IsNotNullOrEmpty(); this.Id = taskId; //define the graph _stateMachine = new StateMachineGraph<DecoratidTaskStatusEnum, DecoratidTaskTransitionEnum>(DecoratidTaskStatusEnum.Pending); _stateMachine.AllowTransition(DecoratidTaskStatusEnum.Pending, DecoratidTaskStatusEnum.InProcess, DecoratidTaskTransitionEnum.Perform); _stateMachine.AllowTransition(DecoratidTaskStatusEnum.Pending, DecoratidTaskStatusEnum.Cancelled, DecoratidTaskTransitionEnum.Cancel); _stateMachine.AllowTransition(DecoratidTaskStatusEnum.InProcess, DecoratidTaskStatusEnum.Complete, DecoratidTaskTransitionEnum.MarkComplete); _stateMachine.AllowTransition(DecoratidTaskStatusEnum.InProcess, DecoratidTaskStatusEnum.Errored, DecoratidTaskTransitionEnum.MarkErrored); _stateMachine.AllowTransition(DecoratidTaskStatusEnum.InProcess, DecoratidTaskStatusEnum.Cancelled, DecoratidTaskTransitionEnum.Cancel); this.CancelLogic = cancelLogic; }
private void öffnenToolStripMenuItem_Click(object sender, EventArgs e) { DataSourceSelector selector = new DataSourceSelector(); selector.ShowDialog(); if (selector.IsTextDatabaseSelected) { _logic = new VideoManagement(new TextDatabase(selector.SelectedFilePath)); } else { _logic = new VideoManagement(new MsDatabase(selector.MsDbConnectionString)); dataGridView1.DataSource = _logic.Videos; PopulateListViewTreeView(); } }
public override IDecorationOf<ILogic> ApplyThisDecorationTo(ILogic thing) { this.Logger.LogVerbose("ApplyThisDecorationTo started", thing); IDecorationOf<ILogic> rv = null; try { rv = new LoggingLogicDecoration(thing, this.Logger); } catch (Exception ex) { this.Logger.LogError(ex.Message, null, ex); throw; } finally { this.Logger.LogVerbose("ApplyThisDecorationTo completed", null); } return rv; }
public StrategizedTouchable(ILogic logic) { Condition.Requires(logic).IsNotNull(); this.TouchLogic = logic; }
public AndLogic(ILogic[] subexps) { subexpressions = subexps; }
public SetScopeLogic(string scopeName, ILogic logic) { this.scopeName = scopeName; this.logic = logic; }
public NotLogic(ILogic logic) { this.logic = logic; }
public AllChildLogic(ILogic requirements) { this.requirements = requirements; }
public static StrategizedTask New(string id, ILogic performLogic, ILogic cancelLogic = null) { return new StrategizedTask(id, performLogic, cancelLogic); }
public static StrategizedTouchable New(ILogic logic) { return new StrategizedTouchable(logic); }
public AnyChildExecute(IExecute operation, ILogic requirements) { this.operation = operation; this.requirements = requirements; }
/// <summary> /// fluently sets the cancel logic /// </summary> /// <param name="logic"></param> /// <returns></returns> public StrategizedTask Cancels(ILogic logic) { Condition.Requires(logic).IsNotNull(); this.PerformLogic = logic; return this; }
public IfExecute(ILogic requirements, IExecute thenExecute, IExecute elseExecute) { this.requirements = requirements; this.thenExecute = thenExecute; this.elseExecute = elseExecute; }
public EveryoneInRoomExecute(IExecute operation, ILogic requirements) { this.operation = operation; this.requirements = requirements; }
public ChooseCharacterExecute(string scopeName, IExecute operation, ILogic requirements) { this.scopeName = scopeName; this.operation = operation; this.requirements = requirements; }
public ErrorCatchingLogicDecoration(ILogic decorated) : base(decorated) { }
public override IDecorationOf<ILogic> ApplyThisDecorationTo(ILogic thing) { return new ErrorCatchingLogicDecoration(thing); }
public override IDecorationOf<ILogic> ApplyThisDecorationTo(ILogic thing) { return new ExpiringLogicDecoration(thing, this.Expirable); }
public PortraitRule(Bitmap bitmap, ILogic requirements, int index) { Bitmap = bitmap; Requirements = requirements; Index = index; }