private async Task ReadInputData() { using (var stream = await FileSystem.OpenAppPackageFileAsync("Inputs.json")) { using (var reader = new StreamReader(stream)) { var jsonInputs = await reader.ReadToEndAsync(); if (jsonInputs == null) { throw new Exception("Unable to read files"); } else { Subdivision subdivision = JsonConvert.DeserializeObject <Subdivision>(jsonInputs); if (subdivision == null) { throw new Exception("Unable to read files"); } else { CurrentInterruption = new Interruption() { SubDivision = subdivision, ReportedDate = DateTime.Now, }; } } } } }
public void Shutdown(bool exit) { if (shutdownCalled) { return; } Interruption.Reset(); try { if (dispatcher != null) { dispatcher.Shutdown(); } WriteHistoryToFile(); OnShutdown(); } finally { shutdownCalled = true; } GC.Collect(); GC.Collect(); if (exit) { Exit(0); } }
public ActionResult deleteinterruptionTypeDefinition(int ID) { Interruption interruption = virames <Interruption> .Initialize(new Interruption()).Where(x => x.ID.ToString() == ID.ToString()) .Take(); return(View(interruption)); }
private async Task ReadInputData() { using (var stream = await FileSystem.OpenAppPackageFileAsync("Inputs.json")) { using (var reader = new StreamReader(stream)) { var jsonInputs = await reader.ReadToEndAsync(); if (jsonInputs == null) { throw new Exception("Unable to read files"); } else { Subdivision subdivision = JsonConvert.DeserializeObject <Subdivision>(jsonInputs); if (subdivision == null) { throw new Exception("Unable to read files"); } else { var allFeederStation = new Substation() { ID = -1, Name = "All Substations", Feeders = new List <Feeder>(), }; allFeederStation.Feeders.Insert(0, new Feeder() { ID = -1, Name = "All Feeders", }); foreach (var substation in subdivision.SubStations) { foreach (var feeder in substation.Feeders) { allFeederStation.Feeders.Add(feeder); } substation.Feeders.Insert(0, new Feeder() { ID = -1, Name = "All Feeders", }); } subdivision.SubStations.Insert(0, allFeederStation); CurrentInterruption = new Interruption() { SubDivision = subdivision, SubStation = subdivision.SubStations[0], Feeder = subdivision.SubStations[0].Feeders[0], ReportedDate = DateTime.Now, }; } } } } }
public override int getCustomSpeed(int microgame, Interruption interruption) { if (interruption.animation == StageController.AnimationPart.BossStage || interruption.animation == StageController.AnimationPart.NextRound || interruption.animation == StageController.AnimationPart.OneUp) { return(1 + getRoundSpeedOffset()); } Debug.Log("no not here"); return(1); }
public void MapEFToBOList() { var mapper = new DALInterruptionMapper(); Interruption entity = new Interruption(); entity.SetProperties(DateTimeOffset.Parse("1/1/1987 12:00:00 AM"), "A", "A", "A", "A", "A", "A", "A", "A", "A", "A"); List <BOInterruption> response = mapper.MapEFToBO(new List <Interruption>() { entity }); response.Count.Should().Be(1); }
public async void Get() { var mock = new ServiceMockFacade <IInterruptionRepository>(); var record = new Interruption(); mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(record)); var service = new InterruptionService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.InterruptionModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLInterruptionMapperMock, mock.DALMapperMockFactory.DALInterruptionMapperMock); ApiInterruptionResponseModel response = await service.Get(default(string)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>())); }
public virtual BOInterruption MapEFToBO( Interruption ef) { var bo = new BOInterruption(); bo.SetProperties( ef.Id, ef.Created, ef.EnvironmentId, ef.JSON, ef.ProjectId, ef.RelatedDocumentIds, ef.ResponsibleTeamIds, ef.Status, ef.TaskId, ef.TenantId, ef.Title); return(bo); }
public virtual Interruption MapBOToEF( BOInterruption bo) { Interruption efInterruption = new Interruption(); efInterruption.SetProperties( bo.Created, bo.EnvironmentId, bo.Id, bo.JSON, bo.ProjectId, bo.RelatedDocumentIds, bo.ResponsibleTeamIds, bo.Status, bo.TaskId, bo.TenantId, bo.Title); return(efInterruption); }
public void MapEFToBO() { var mapper = new DALInterruptionMapper(); Interruption entity = new Interruption(); entity.SetProperties(DateTimeOffset.Parse("1/1/1987 12:00:00 AM"), "A", "A", "A", "A", "A", "A", "A", "A", "A", "A"); BOInterruption response = mapper.MapEFToBO(entity); response.Created.Should().Be(DateTimeOffset.Parse("1/1/1987 12:00:00 AM")); response.EnvironmentId.Should().Be("A"); response.Id.Should().Be("A"); response.JSON.Should().Be("A"); response.ProjectId.Should().Be("A"); response.RelatedDocumentIds.Should().Be("A"); response.ResponsibleTeamIds.Should().Be("A"); response.Status.Should().Be("A"); response.TaskId.Should().Be("A"); response.TenantId.Should().Be("A"); response.Title.Should().Be("A"); }
public ActionResult editinterruptionTypeDefinition(Interruption interruption) { interruption.Save(); return(RedirectToAction("interruptionTypeDefinition")); }
public ActionResult newinterruptionTypeDefinition() { Interruption interruption = new Interruption(); return(View(interruption)); }
public override int getCustomSpeed(int microgame, Interruption interruption) { return(1 + getRoundSpeedOffset()); }
public void Run() { Initialize(); OnRunning(); running = true; string cmdLine = null; // string displayPrompt = prompt; historyLine = new StringBuilder(); try { while (!terminated) { interrupted = false; // a CTRL-C will not interrupt the current reading // thus it does not make much sense here to interrupt. // WORKAROUND: Write message in the Interrupt() method. // TODO: find out, if we can do something that behaves // like a shell. This requires, that CTRL-C makes // Readline.ReadLine() return. if (IsInterruptable) { Interruption.Push(this as IInterruptable); } try { // cmdLine = (hasTerminal) ? Readline.ReadLine(displayPrompt) : ReadLineFromFile(); cmdLine = Input.ReadLine(); } catch (EndOfStreamException) { // EOF on CTRL-D if (OnTerminated()) { // displayPrompt = prompt; Input.CompleteLine(); continue; } break; } catch (Exception e) { #if DEBUG System.Console.Error.WriteLine(e.Message); System.Console.Error.WriteLine(e.StackTrace); #endif } if (IsInterruptable) { Interruption.Reset(); } // anyone pressed CTRL-C if (interrupted) { if ((cmdLine == null || cmdLine.Trim().Length == 0) && historyLine.Length == 0) { terminated = true; // terminate if we press CTRL on empty line. } historyLine.Length = 0; // displayPrompt = prompt; Input.CompleteLine(); continue; } if (cmdLine == null) { continue; } // if there is already some line in the history, then add // newline. But if the only thing we added was a delimiter (';'), // then this would be annoying. if (historyLine.Length > 0 && !cmdLine.Trim().Equals(dispatcher.CommandSeparator.ToString())) { historyLine.Append(Environment.NewLine); } historyLine.Append(cmdLine); LineExecutionResultCode lineExecState = ExecuteLine(cmdLine); // displayPrompt = lineExecState == LineExecutionResultCode.Incomplete ? emptyPrompt : prompt; if (lineExecState != LineExecutionResultCode.Incomplete) { Input.CompleteLine(); StoreHistoryLine(); historyLine.Length = 0; } } if (IsInterruptable) { Interruption.Reset(); } } catch (Exception e) { #if DEBUG System.Console.Error.WriteLine(e.Message); System.Console.Error.WriteLine(e.StackTrace); #endif Exit(1); } finally { running = false; } }
public ActionResult deleteinterruptionTypeDefinition(Interruption interruption) { interruption.Delete(); return(RedirectToAction("interruptionTypeDefinition")); }
/// <summary> /// Calculates custom speed when Custom is selected for Interruption speed change /// </summary> /// <param name="interruption"></param> /// <returns></returns> public virtual int getCustomSpeed(int microgame, Interruption interruption) { return(1); }
private void Readline_Interrupt(object sender, EventArgs args) { Interruption.Interrupt(); }