// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { /* Rest client = Rest.Instanse(services); * CoreState.Rest = client;*/ CoreState.AddContextWithSwagger(services, "http://172.17.9.105:1600/api", "qrpay", "joha", "123456789$j"); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
public override void Die() { coreState = CoreState.Won; endScreen.gameObject.SetActive(true); base.Die(); }
// Use FixedUpdate for simulation void FixedUpdate() { int tempDelta = 0; switch (state) { case CoreState.Running: tempDelta += temperature_step_up; break; case CoreState.Exploded: break; } GridManager.Instance.AddHeat(this, tempDelta); switch (state) { case CoreState.Running: if (GridManager.Instance.GetMaxTemp(this) > maxTemp) { state = CoreState.Exploded; anim.Play("core_explode"); } break; case CoreState.Exploded: break; } }
/// <summary> /// Start up the node process /// </summary> public void Start(int port) { AssertStoresLocation(); InitializeStores(); _nodeComms.Start(port); _state = CoreState.WaitingForMaster; }
private void ChangeState() { if (LockState) { return; } AnimationState = AnimationState.Equals(CoreState.Open) ? CoreState.Close : CoreState.Open; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } CoreState.ContextMiddleware(app); app.UseMvc(); }
public CoreError(CoreState state, TraceBack traceback, CoreErrorType type, string msg = null) { this.state = state; this.traceback = traceback; this.type = type; // Check if the error is fatal by checking the error type this.fatal = ((int)type) > 0; this.msg = msg; }
private void OnSlaveAdded(object sender, SlaveListEventArgs e) { if (_state == CoreState.WaitingForSlaves) { if (_nodeComms.GetActiveSlaveCount() >= _masterConfiguration.WriteQuorum) { _state = CoreState.RunningMaster; } } }
private void OnSlaveAdded(object sender, SlaveListEventArgs e) { if (_state == CoreState.WaitingForSlaves) { if (_nodeComms.GetActiveSlaveCount()>= _masterConfiguration.WriteQuorum) { _state = CoreState.RunningMaster; } } }
void CrystalDestroyed() { crystals--; if (crystals == 0) { healthBar.gameObject.SetActive(true); coreState = CoreState.ShellOff; StartCoroutine(ShellOff()); } }
protected BaseCore(string type, int durability, string name) { this.Type = type; this.Name = name; this.initialDurability = durability; this.Durability = durability; this.fragments = new LStack(); this.state = CoreState.NORMAL; this.pressureOnCore = 0; }
// Constructor public MainMenu(Texture2D mmButtonTexture, SpriteFont mmButtonFont) { SelectedCorePage = CoreState.Menu; // Divide the grid of the screen into rows and columns DesignScreenLayout(); // Create and place the objects needed for this page CreateAndPlaceElements(mmButtonTexture, mmButtonFont); }
private void StartSyncToMaster() { _state = CoreState.SyncToMaster; var lastTxn = new Dictionary <string, string>(); foreach (var store in _stores) { lastTxn.Add(store, GetLastTransactionId(store).ToString()); } _nodeComms.SendSyncToMaster(_masterAddress, lastTxn); }
internal void SetState(CoreState state) { if (_state != state) { _state = state; if (StateChanged != null) { StateChanged(this, EventArgs.Empty); } } }
private static ControlBase CreateMockControl(string name, CoreCompetenceRole coreRole, ReviewCompetenceRole reviewRole, CoreState coreState, ReviewState reviewState ) { return new ControlBase { Name = name, CoreCompetenceRole = coreRole, ReviewCompetenceRole = reviewRole, CoreState = coreState, ReviewState = reviewState }; }
/// <summary> /// Handle a endsync message from a master to a slave /// </summary> /// <param name="syncStatus">Indicates the status of the sync. Should be either OK or FAIL.</param> public void SlaveSyncCompleted(string syncStatus) { if (syncStatus.Equals("OK", StringComparison.OrdinalIgnoreCase)) { _state = CoreState.RunningSlave; } else { // Partial sync failed // TODO: start full sync } }
private void OnJobCompleted(object sender, JobCompletedEventArgs e) { var jobStatus = _serverCore.GetJobStatus(e.StoreId, e.CompletedJob.JobId.ToString()); if (jobStatus != null && jobStatus.JobStatus == JobStatus.TransactionError) { // Because all transactions should be processable, this indicates a hardware problem or persistent software problem _serverCore.Shutdown(true); _state = CoreState.Broken; } _storeInfo[e.StoreId].Commit(e.CompletedJob.JobId); }
private void FinishDisconnect() { CoreState oldState = CoreProxy.State; UnregisterCoreEvents(); CoreProxy.Dispose(); CoreProxy = null; StateChanged?.Invoke(this, new StateChangedEventArgs(oldState, CoreState.Disconnected)); Log.Info("Disconnected from core"); }
// Constructor public ShopPage(Texture2D mmButtonTexture, SpriteFont mmButtonFont, Dictionary <string, ShopItem> images, PlayerManager playerManagerin) { SelectedCorePage = CoreState.Shop; Images = images; MmButtonFont = mmButtonFont; _playerManager = playerManagerin; // Divide the grid of the screen into rows and columns DesignScreenLayout(); // Create and place the objects needed for this page CreateAndPlaceElements(mmButtonTexture); }
private void WaitForState(NodeCore node, CoreState expectedState, int timeToWait) { for (int i = 0; i < 10; i++) { Thread.Sleep(timeToWait / 10); if (node.GetStatus() == expectedState) { return; } } Thread.Sleep(timeToWait / 10); Assert.AreEqual(expectedState, node.GetStatus(), "Node did not enter the expected state after {0} milliseconds", timeToWait); }
// Constructor public StatsPage(Texture2D mmButtonTexture, SpriteFont mmButtonFont, PlayerManager playerManagerin) { SelectedCorePage = CoreState.Stats; _playerManager = playerManagerin; _buttonTexture = mmButtonTexture; _font = mmButtonFont; // Divide the grid of the screen into rows and columns DesignScreenLayout(); // Create and place the objects needed for this page CreateAndPlaceElements(mmButtonTexture, mmButtonFont); }
public bool SetMaster(MasterConfiguration masterConfiguration) { _masterConfiguration = masterConfiguration; if (_masterConfiguration.WriteQuorum == 0) { // Don't need any slaves to enter running state _state = CoreState.RunningMaster; } else { // Need 1 or more slaves to connect before we enter running state _state = CoreState.WaitingForSlaves; } return(true); }
private void CheckPressureAndAlterDurability() { if (IsPressureAboveZero()) { this.state = CoreState.CRITICAL; this.durability = this.initialDurability - this.pressureOnCore; if (this.durability < 0) { this.durability = 0; } } else { //this.durability = this.initialDurability; this.state = CoreState.NORMAL; } }
public void Update() { StartTimer(); CoreState cs = c.State(); if (cs.remainingDives == 0) { MessageBox.Show("Meet is Finished!", "Meet Finished", MessageBoxButton.OK, MessageBoxImage.Information); c.AutoSave(); this.Close(); return; } TotalDiveBlock.Text = "Total Dives: " + cs.totalDives; RemainingDiveBlock.Text = "Remaining Dives: " + cs.remainingDives; CompletedDiveBlock.Text = "Completed Dives: " + cs.completedDives; DiverNameBlock.Text = cs.curDiver.Name; EventNameBlock.Text = cs.curEvent.name + " - " + cs.curEvent.Board; Dive d = cs.curDiver.CurrentDive(); DiveBlock.Text = d.Code + " | " + d.Description; }
public NetResult <ResponseData> AddImage([FromForm] AddImageView model) { try { if (model == null || string.IsNullOrEmpty(model.Id)) { return(null); } var project = _project.Get(model.Id); var file = CoreState.AddwwwRoot("projects", model.File); project.ImageUrl = file; _project.Update(project); return(new ResponseData() { Result = new { url = project.ImageUrl } }); } catch (Exception ext) { return(ext); } }
// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { CoreState.AddContextWithSwagger(services, "http://172.17.9.105:1600/api", "postman", "postman", "postman"); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); ContainerBuilder builder = new ContainerBuilder(); services.AddCors(); Assembly assembly = typeof(IRepositoryCore <,>).Assembly; //builder.RegisterGeneric(typeof(IRepositoryCore<,>), assembly); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); // Assembly[] assemblies = GetYourAssemblies(); builder.RegisterGeneric(typeof(LiteRepository.Repository.LiteRepository <>)) .As(typeof(IRepositoryCore <,>)) .InstancePerLifetimeScope(); var lite = new LiteDbContext(); builder.RegisterInstance(lite).As <ILiteContext>(); Service.Start.Builder(builder); builder.Populate(services); Container = builder.Build(); return(new AutofacServiceProvider(Container)); }
// Start is called before the first frame update void Start() { state = CoreState.Running; }
public WrongHandlerStateException(string methodName, CoreState state) : base($"Cannot run {methodName}, simulation is in {state} state.") { }
protected override void OnPaint(PaintEventArgs e) { this.OnPaintBackground(e); if (_debugger == null) { return; } if (_debugger.DebugHost.CpuHook == null) { return; } e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; int x = 2; int y = 2; Brush labelBrush = (this.Enabled == true) ? _labelFontBrush : _disabledFontBrush; Brush valueBrush = (this.Enabled == true) ? _valueFontBrush : _disabledFontBrush; CoreState state = _debugger.DebugHost.CpuHook.GetCoreState(0); // PC e.Graphics.DrawString("PC", _font, labelBrush, x, y, _stringFormat); e.Graphics.DrawString(state.ProgramCounter.ToString("X8"), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat); y += _lineHeight; RegisterType mode = RegisterType.General; switch (mode) { case RegisterType.General: { RegisterBank bank = RegisterBanks.General; for (int n = 1; n < 32; n++) { Register reg = bank.Registers[n]; // Label e.Graphics.DrawString(reg.Name, _font, labelBrush, x, y, _stringFormat); // Value string value = state.GeneralRegisters[n].ToString("X8"); e.Graphics.DrawString(value, _font, valueBrush, x + _labelWidth + 3, y, _stringFormat); y += _lineHeight; } // LO e.Graphics.DrawString("$lo", _font, labelBrush, x, y, _stringFormat); e.Graphics.DrawString(state.Lo.ToString("X8"), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat); y += _lineHeight; // HI e.Graphics.DrawString("$hi", _font, labelBrush, x, y, _stringFormat); e.Graphics.DrawString(state.Hi.ToString("X8"), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat); y += _lineHeight; } break; case RegisterType.Fpu: { // Control register e.Graphics.DrawString("fcr", _font, labelBrush, x, y, _stringFormat); e.Graphics.DrawString(state.FpuControlRegister.ToString("X8"), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat); y += _lineHeight; // Condition bit e.Graphics.DrawString("fc", _font, labelBrush, x, y, _stringFormat); e.Graphics.DrawString(state.FpuConditionBit.ToString(), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat); y += _lineHeight; // Registers RegisterBank bank = RegisterBanks.Fpu; for (int n = 0; n < 32; n++) { Register reg = bank.Registers[n]; // Label e.Graphics.DrawString(reg.Name, _font, labelBrush, x, y, _stringFormat); // Value string value = state.FpuRegisters[n].ToString(); e.Graphics.DrawString(value, _font, valueBrush, x + _labelWidth + 3, y, _stringFormat); y += _lineHeight; } } break; case RegisterType.Vfpu: break; } }
private void StartSyncToMaster() { _state = CoreState.SyncToMaster; var lastTxn = new Dictionary<string, string>(); foreach (var store in _stores) { lastTxn.Add(store, GetLastTransactionId(store).ToString()); } _nodeComms.SendSyncToMaster(_masterAddress, lastTxn); }
private void BackButton_Click(object sender, EventArgs e) { SelectedCorePage = CoreState.Menu; }
private void StatsButton_Click(object sender, EventArgs e) { SelectedCorePage = CoreState.Stats; }
private void PlayButton_Click(object sender, EventArgs e) { SelectedCorePage = CoreState.Play; }
private void WaitForState(NodeCore node, CoreState expectedState, int timeToWait) { for(int i = 0; i < 10; i++) { Thread.Sleep(timeToWait/10); if (node.GetStatus() == expectedState) return; } Thread.Sleep(timeToWait/10); Assert.AreEqual(expectedState, node.GetStatus(), "Node did not enter the expected state after {0} milliseconds", timeToWait); }
public bool SetMaster(MasterConfiguration masterConfiguration) { _masterConfiguration = masterConfiguration; if (_masterConfiguration.WriteQuorum == 0) { // Don't need any slaves to enter running state _state = CoreState.RunningMaster; } else { // Need 1 or more slaves to connect before we enter running state _state = CoreState.WaitingForSlaves; } return true; }