private void timer2_Tick(object sender, EventArgs e) { //Playground.CreateGraphics().Clear(Color.FromArgb(60, 0, 0, 0)); //Playground.CreateGraphics().Clear(Color.Transparent); //narazie nie jestem w stanie zmusic go do przezroczytsosci po czyszczeniu //Playground.Invalidate(); //Playground.Controls.Clear(); Playground.CreateGraphics().Clear(Color.ForestGreen); //Playground.BackgroundImage = Properties.Resources.grassSmall; theSnake.move(); theSnake.drawSnake(Playground.CreateGraphics(), Properties.Resources.snakepart); theFood.drawFood(Playground.CreateGraphics(), imageFood); if (theFood.needFood(theSnake.x[0], theSnake.y[0])) { theSnake.grow(); } if (theSnake.isSnakeLife() == false) { is_start = false; Playground.CreateGraphics().Clear(Color.Black); timer1.Enabled = true; timer2.Enabled = false; } }
public async System.Threading.Tasks.Task <OperationResult <Playground> > CreatePlayground(Playground playground) { return(await System.Threading.Tasks.Task.Factory.StartNew <OperationResult <Playground> >(() => { OperationResult <Playground> result = new OperationResult <Playground>(); try { if (IsInCompany()) { playground.CompanyId = CurrentUser.CompanyId.Value; Playground newPlayground = PlaygroundsRepository.CreateOrUpdate(playground); if (newPlayground.Id > 0) { result.SingleResult = newPlayground; result.Result = true; } } } catch (Exception ex) { LoggingService.Log(ex); } return result; })); }
public MainViewModel(Playground playground, double cellSize) { this.playground = playground; CellSize = cellSize; timer = new DispatcherTimer(DispatcherPriority.Send); timer.Tick += (s, x) => UpdateCommand.Execute(null); timer.Interval = new TimeSpan(0, 0, 0, 0, 100); UpdateCommand = new Command(o => Update(), o => !timer.IsEnabled); ClearCommand = new Command(o => Clear(), o => !timer.IsEnabled); RandomCommand = new Command(o => Random(), o => !timer.IsEnabled); StartCommand = new Command(o => timer.Start(), o => !timer.IsEnabled); StopCommand = new Command(o => timer.Stop(), o => timer.IsEnabled); NewCommand = new Command(o => CreateNewPlayground()); OpenCommand = new Command(o => Open()); SaveCommand = new Command(o => Save()); SaveAsCommand = new Command(o => SaveAs()); CloseCommand = new Command(o => System.Windows.Application.Current.Shutdown()); SoftwareName = string.Format("Conway's Game of Life: Neu {0}x{1}", playground.SizeX, playground.SizeY); }
public MainWindow() { InitializeComponent(); playgroundWindow = new Playground(); playgroundWindow.Show(); }
public void MoveRight() { if (Mind.CanMoveRight(Playground)) { Playground.MoveRight(); } }
public MainWindow() { InitializeComponent(); board = new Playground(playCanvas); timer.Interval = TimeSpan.FromMilliseconds(400); timer.Tick += Timer_Tick; }
public void Rotate() { if (Mind.CanRotate(Playground)) { Playground.RotateBlock(); } }
public void Test_Playground() { Playground playgroundA = new Playground(new[] { 5, 6 }); Assert.AreEqual(2, playgroundA.Rows.Count); Assert.AreEqual(5, playgroundA.Rows[0]); Assert.AreEqual(6, playgroundA.Rows[1]); Playground playgroundB = new Playground(playgroundA); Assert.AreEqual(2, playgroundB.Rows.Count); Assert.AreEqual(5, playgroundB.Rows[0]); Assert.AreEqual(6, playgroundB.Rows[1]); Move move = new Move(new[] { 1, 3 }); Playground playgroundC = playgroundA.ApplyMove(move); Assert.AreEqual(2, playgroundA.Rows.Count); Assert.AreEqual(5, playgroundA.Rows[0]); Assert.AreEqual(6, playgroundA.Rows[1]); Assert.AreEqual(2, playgroundB.Rows.Count); Assert.AreEqual(5, playgroundB.Rows[0]); Assert.AreEqual(6, playgroundB.Rows[1]); Assert.AreEqual(2, playgroundC.Rows.Count); Assert.AreEqual(4, playgroundC.Rows[0]); Assert.AreEqual(3, playgroundC.Rows[1]); }
static void Main(string[] args) { // construct the quantum simulator using (var sim = new QuantumSimulator()) { // Try initial values Result[] initials = new Result[] { Result.Zero, Result.One }; foreach (Result initial in initials) { // we pass the simulator, initial count of 1000, and an initial qubit value // Note that the run method is asynchronous. // Each Q# operation has a corresponding C# class, for which a Run method belongs to the class // the Run method performs asynchronous executions of the given operations // note that our results for BellTest are strored in a tuple var results1 = XGate.Run(sim, 1000, initial).Result; // here we perform a Hadamard gate operation, for which our qubit is placed from the ground or exited state into // a superposition state of either |0> or |1> var results2 = HGate.Run(sim, 1000, initial).Result; // Places two bits a Bell State, which is in essence a superposition of two qubits that are entangled var res = BellTest.Run(sim, 1000, initial).Result; // caste results into a tuple, for easy access var(numZeros, numOnes, agree) = res; var play = Playground.Run(sim, 1000, initial).Result; var(nOnes, nZeros, agreement) = play; // System.Console.WriteLine($"Init:{initial,-4} 0s={numZeros,-4} 1s={numOnes,-4} agree={agree, -4}"); System.Console.WriteLine($"Init:{initial,-4} 0s={nZeros,-4} 1s={nOnes,-4} agree={agreement,-4}"); } } System.Console.WriteLine("Press any key to continue..."); System.Console.ReadKey(); }
public void Run() { //This method is used to parse inputs and avoid potential user mistakes or bad inputs. var size = ParseInput(); var width = size[0]; var height = size[1]; //create the grid for the game and validate the inputs var grid = new Playground(width, height); //This method is used to fill the grid with data provided. grid.GenerationZero(); var coordinates = ParseInput(); var x1 = coordinates[0]; var y1 = coordinates[1]; var n = coordinates[2]; //check coordinate inputs if (x1 < 0 || y1 < 0 || n < 0) { throw new ArgumentException("Coordinates cannot be negative numbers!"); } //business logic var result = grid.CountGenerationsInWhichCellIsGreen(x1, y1, n); //output result Console.WriteLine($"Answer: {result}"); }
public void Search_Success() { List <Playground> itemsToDelete = new List <Playground>(); for (int i = 0; i < 5; i++) { Playground item = new Playground() { Name = "PlaygroundTestName" + i, CompanyId = _companyToDelete.Id, Price = 100 }; itemsToDelete.Add(_playgroundRepository.CreateOrUpdate(item)); } var items = _playgroundRepository.Search("Name = @Name", new { PageSize = 10, PageNumber = 1, Name = "PlaygroundTestName1" }); foreach (var item in itemsToDelete) { _playgroundRepository.Delete(item.Id); } Assert.AreEqual(1, items.Count()); Assert.AreEqual("PlaygroundTestName1", items.FirstOrDefault().Name); }
private void Window_Loaded(object sender, RoutedEventArgs e) { currentPoint = new Point(); // Default Werte int SizeX = 50; int SizeY = 50; double cellSize = 10d; NewPlaygroundDialog dialog = new NewPlaygroundDialog(); if (dialog.ShowDialog() == true) { SizeX = dialog.SizeX; SizeY = dialog.SizeY; cellSize = dialog.CellSize; } Playground playground = new Playground(SizeX, SizeY); _viewModel = new MainViewModel(playground, cellSize); _viewModel.PlaygroundChanged += DefinePlaygroundGrid; DefinePlaygroundGrid(playground, _viewModel.CellSize); DataContext = _viewModel; }
public void GetAll_ReturnsResult_Success() { List <Playground> PlaygroundsToDelete = new List <Playground>(); try { for (int i = 0; i < 20; i++) { Playground testPlayground = new Playground() { Name = "PlaygroundTestName", CompanyId = _companyToDelete.Id, Price = 100 }; PlaygroundsToDelete.Add(_playgroundRepository.CreateOrUpdate(testPlayground)); } var Playgrounds = _playgroundRepository.GetAll(15, 1); Assert.AreEqual(15, Playgrounds.Count(), "Items count are not equal 15"); Playgrounds = _playgroundRepository.GetAll(10, 2); // Second Page Assert.AreEqual(10, Playgrounds.Count(), "Items count are not equal 10"); } finally { foreach (var Playground in PlaygroundsToDelete) { _playgroundRepository.Delete(Playground.Id); } } }
public void CreatePlaygrounds() { this.PlaygroundFirstPlayer = new Playground(this.BoardSize, Players.FirstPlayer); this.PlaygroundSecondPlayer = new Playground(this.BoardSize, Players.SecondPlayer); PlaygroundFirstPlayer.CreateBoard(); PlaygroundSecondPlayer.CreateBoard(); }
protected void SetClientBaseServer(GameObject newBaseCore) { baseCore = newBaseCore; playground = baseCore.GetComponent <Playground>(); egg = baseCore.GetComponentInChildren <Egg>().gameObject; RpcSyncBaseOnce(baseCore.transform.rotation, baseCore); }
public void MoveDown() { if (Mind.CanMoveDown(Playground)) { Playground.MoveDown(); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Playground pg = target as Playground; pg.UpdatePlayground(); }
static void Main(string[] args) { var service = new Playground(); service.CheckIfEvent(); //AsyncMethods().Wait(); //Console.WriteLine(CalcService.Factorial(20)); }
public void StartGame(int gameSessionId) { var gameSession = gameSessionService.GetGameSessionById(gameSessionId); Playground playground = new Playground(gameSession); playground.Show(); UserProfile.CurrentForm.CloseForm(); }
static public void Execute(this Playground playground) { playground.isBusy = true; playground.ExecuteAnimationList(delegate { Game.Instance.Generate(); playground.ExecuteAnimationList((sender, args) => playground.isBusy = false); }); }
public void CreateOrUpdate_CompanyId_Only_Throws() { Playground equip = new Playground() { CompanyId = _companyToDelete.Id }; _playgroundRepository.CreateOrUpdate(equip); }
private void StartGame_Click(object sender, RoutedEventArgs e) { list.Clear(); board = new Playground(playCanvas); gameStarted = true; direction = "right"; tickTimer = 0; timer.Start(); }
public void CreateOrUpdate_Name_Only_Throws() { Playground equip = new Playground() { Name = "PlaygroundTestName" }; _playgroundRepository.CreateOrUpdate(equip); }
public static async Task Main(string[] args) { var xamlPreserve = CreatePreserveXaml(); await Post(xamlPreserve, xamlPreserve); return; MockForms.Init(); var componentBuilderOptions = new ComponentBuilderOptions { PreserveSession = true, SuppressAllBackGroundColor = false, EnableRepeater = true, EnableRestorationOfUIAttributes = true, EnableTapGestureRecognizers = true, EnableUIAttributesGeneration = true }; var playground = new Playground(componentBuilderOptions); var preserveUIAttributes = ComponentBuilder.PreserveUIAttributes; XmlSerializer xs = new XmlSerializer(typeof(Preserve)); TextWriter txtWriter = new StreamWriter(xmlFilePath); xs.Serialize(txtWriter, preserveUIAttributes); txtWriter.Close(); string xml, xaml = string.Empty; Console.WriteLine("----------------------------------------------"); using (StreamReader reader = File.OpenText(xamlFilePath)) { Console.WriteLine("Given XAML:"); xaml = reader.ReadToEnd(); Console.WriteLine(xaml); } Console.WriteLine("----------------------------------------------"); using (StreamReader reader = File.OpenText(xmlFilePath)) { Console.WriteLine("Generated XML:"); xml = reader.ReadToEnd(); Console.WriteLine(xml); } Console.WriteLine("----------------------------------------------"); await Post(xml, xaml); Console.WriteLine("XML File Generated!"); }
//updated public void postPlaygrounds(Playground pgrnd) { //pgrnd.PlaygroundID = 0; if (ModelState.IsValid) { dbContext.Playground.Add(pgrnd); dbContext.SaveChanges(); } }
public BotForFoundedShip(string coordinates, Playground enemyPlayGroundFromBot) { this.lastAttackPosstion = coordinates; string[] coordinatesArr = coordinates.Split(' '); this.firstXCoordinate = int.Parse(coordinatesArr[0]); this.secondXCoordinate = int.Parse(coordinatesArr[1]); this.FullTheQueues(this.firstXCoordinate, this.secondXCoordinate); this.sideForAttack = SideForAttack.Left; this.playground = enemyPlayGroundFromBot; }
private void CmdSpawnBase() { baseCore = Instantiate(basePrefab, Vector3.zero, Quaternion.identity); playground = baseCore.GetComponent <Playground>(); NetworkServer.Spawn(baseCore); foreach (ClientConnection clientConnection in clientConnection.clients) { clientConnection.client.SetClientBaseServer(baseCore); } }
public static void Init() { TestBall = new Ball(); TestPlayground = new Playground("Anfield"); InitPlayers(); TestTeamHome = new Team(TeamScheme.Home451, new BalancedStrategy(), playersHome); TestTeamAway = new Team(TeamScheme.Away451, new BalancedStrategy(), playersAway); TestBall.AttachObserver(TestTeamAway); TestBall.AttachObserver(TestTeamHome); TestGame = new Game(TestTeamHome, TestTeamAway, TestBall, TestPlayground); }
private void Start() { this.playground = new Playground(); createUI(); updateUI(); Texture2D texture = this.playground.heatMap.texture; imgHeatMap.sprite = UnityEngine.Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)); Texture2D lineChartTexture = this.playground.lineChart.texture; imgLineChart.sprite = UnityEngine.Sprite.Create(lineChartTexture, new Rect(0, 0, 256, 128), new Vector2(0.5f, 0.5f), 1); }
public void InsertBlock() { var newBlock = Mind.GetRandomBlock(Blocks).SetRandomRotation(); if (Mind.CanInsert(Playground, newBlock, Playground.GetStackCenter().Width)) { Playground.InsertBlock(newBlock); } else { EndGame(); } }
public List <Playground> getPlaygroundsbyprice(decimal price) { List <int> spgs = dbContext.SubPlayground.Where(sp => sp.Price <= price).Select(sp => sp.PlaygroundID).Distinct().ToList(); List <Playground> ply_grnds = new List <Playground>(); foreach (var spg in spgs ?? new List <int>()) { Playground pg = dbContext.Playground.FirstOrDefault(p => p.PlaygroundID == spg); ply_grnds.Add(pg); } return(ply_grnds); }
public ActionResult Results(Playground.BusinessLogic.EmployeeSearchCriteria searchCriteria) { if (searchCriteria.Validate()) { //searchCriteria.PageNumber = searchCriteria.PageNumber ?? 1; //searchCriteria.RecordsPerPage = searchCriteria.RecordsPerPage ?? 20; var model = new Playground.Models.EmployeeSearchResultsModel(); var search = new Playground.BusinessLogic.EmployeeSearch(); model.SearchResults = search.Search(searchCriteria); model.Criteria = searchCriteria; return View(model); } else { return RedirectToAction("Index"); } }
// // GET: /EmployeeSearchApi/ public ActionResult Index(Playground.BusinessLogic.EmployeeSearchCriteria searchCriteria) { var json = new JsonResult(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; if (!searchCriteria.Validate()) { json.Data = searchCriteria.ValidationErrors; } else { var search = new Playground.BusinessLogic.EmployeeSearch(); var results = search.Search(searchCriteria); json.Data = results; } return json; }
/// <summary> /// Install Software in a hive /// </summary> /// <param name="hive"></param> public void DeleteHive(Playground hive) { string sessionId = Session.Current?.SessionId; this.Heading = "Deleting your hive."; ApplicationOperationsPage parent = this.Parent as ApplicationOperationsPage; HiveManager.DeleteHive(hive, () => { // Success Utils.ScheduleTaskHelper(sessionId, (session, id) => { if (session != null) { // TODO: Show close button to Close page if( this.Finnished != null) { this.Finnished(); } session.CalculatePatchAndPushOnWebSocket(); } }); }, (text, progress) => { // Progress Utils.ScheduleTaskHelper(sessionId, (session, id) => { if (session != null) { this.SetProgress(text, progress); session.CalculatePatchAndPushOnWebSocket(); } }); }, (errorResponse) => { // Error Utils.ScheduleTaskHelper(sessionId, (session, id) => { parent.OnError(errorResponse); session.CalculatePatchAndPushOnWebSocket(); }); }); }
public ActionResult Index(Playground.Models.EmployeeSearchModel model) { if (!model.Criteria.Validate()) { return View(model); } else { return RedirectToAction( "Results", new{ FirstName = model.Criteria.FirstName, LastName = model.Criteria.LastName, Organization = model.Criteria.Organization, JobTitle = model.Criteria.JobTitle, Address = model.Criteria.Address, City = model.Criteria.City, State = model.Criteria.State, ZipCode = model.Criteria.ZipCode } ); } }
/// <summary> /// Callback when a software has been installed/assured installation /// </summary> /// <param name="hive"></param> private void OnSoftwareInstalled(Playground hive) { ApplicationOperationsPage parent = this.Parent as ApplicationOperationsPage; this.HiveUrl = this.GetEndPointUrl(hive, parent.SoftwareJson.EntryPoint); this.SoftwareInstalled = true; }
static void Main(string[] args) { var mainPanel = new Panel(); mainPanel.Name = "mainPanle"; mainPanel.Width = Application.STANDARD_ROOT_BOUNDARY.Width - 12; mainPanel.Height = Application.STANDARD_ROOT_BOUNDARY.Height - 6; mainPanel.Top = 3; mainPanel.Left = 6; #region Left Side var leftBox = new Groupbox(); leftBox.Name = "leftBox"; leftBox.Header = "Left Box"; leftBox.Top = leftBox.Left = 0; leftBox.Width = mainPanel.Width / 2; leftBox.Height = mainPanel.Height; var lblLeftStatus = new Label("Status:"); lblLeftStatus.Name = "lblLeftStatus"; lblLeftStatusText = new Label(); lblLeftStatusText.Name = "lblLeftStatusText"; lblLeftStatusText.Left = lblLeftStatus.Text.Length; lblLeftStatusText.Width = leftBox.Width - lblLeftStatus.Width; lblLeftStatusText.Align = ContentAlign.Right; var btnLeftIncrement = new Button("Increment"); btnLeftIncrement.Top = 1; btnLeftIncrement.Name = "btnLeftIncrement"; btnLeftIncrement.Pressed += BtnLeftIncrementOnPressed; var btnLeftClear = new Button("Clear"); btnLeftClear.Top = 2; btnLeftClear.Name = "btnLeftClear"; btnLeftClear.Pressed += (sender, eventArgs) => lblLeftStatusText.Text = ""; var txtLeftText = new Textbox(); txtLeftText.Text = "asd123"; txtLeftText.Top = 3; txtLeftText.Left = 21; txtLeftText.Width = 10; txtLeftText.BackColor = ConsoleColor.Gray; txtLeftText.ForeColor = ConsoleColor.Black; txtLeftText.Name = "txtLeftText"; txtLeftText.EnterPressed += (sender, eventArgs) => lblLeftStatusText.Text = txtLeftText.Text; var btnLeftSetText = new Button("Set this text =>"); btnLeftSetText.Top = 3; btnLeftSetText.Name = "btnLeftSetText"; btnLeftSetText.Pressed += (sender, eventArgs) => lblLeftStatusText.Text = txtLeftText.Text; var chkLeftMoveDir = new Checkbox("Move button up"); chkLeftMoveDir.Top = 5; chkLeftMoveDir.Left = 12; chkLeftMoveDir.Name = "chkLeftMoveDir"; chkLeftMoveDir.Checked = CheckState.Unchecked; var prgLeftMoveButton = new Progressbar(); prgLeftMoveButton.Top = 6; prgLeftMoveButton.Left = 12; prgLeftMoveButton.Name = "prgLeftMoveButton"; prgLeftMoveButton.Width = chkLeftMoveDir.Text.Length + 4; prgLeftMoveButton.Value = 10; var lblLeftPrgDesc = new Label(@"^ Progressbar ^"); lblLeftPrgDesc.Top = 7; lblLeftPrgDesc.Left = 14; lblLeftPrgDesc.Name = "lblLeftPrgDesc"; var myPlayground = new Playground(7, 14); myPlayground.Name = "playground"; myPlayground.Top = 9; myPlayground.Left = 14; myPlayground.BackColor = ConsoleColor.Blue; myPlayground.ForeColor = ConsoleColor.Red; myPlayground[0, 0] = 'x'; myPlayground[2, 2] = 'x'; myPlayground[4, 4] = 'x'; myPlayground[6, 6] = 'o'; myPlayground[4, 8] = 'x'; myPlayground[2, 10] = 'x'; myPlayground[0, 12] = 'x'; var btnLeftMove = new Button("Move"); btnLeftMove.Top = 4; btnLeftMove.Name = "btnLeftMove"; btnLeftMove.Pressed += (sender, eventArgs) => { var mv = chkLeftMoveDir.Checked == CheckState.Checked ? -1 : 1; if(btnLeftMove.Top + mv < btnLeftMove.Container.Height - 3 && btnLeftMove.Top + mv > 3) btnLeftMove.Top += mv; prgLeftMoveButton.Value = (int)(((btnLeftMove.Top - 2) / (float)(btnLeftMove.Container.Height - 6)) * 100); }; leftBox.Add(lblLeftStatus); leftBox.Add(lblLeftStatusText); leftBox.Add(btnLeftIncrement); leftBox.Add(btnLeftClear); leftBox.Add(btnLeftSetText); leftBox.Add(txtLeftText); leftBox.Add(btnLeftMove); leftBox.Add(chkLeftMoveDir); leftBox.Add(prgLeftMoveButton); leftBox.Add(lblLeftPrgDesc); leftBox.Add(myPlayground); #endregion #region Right Side var rightBox = new Groupbox(); rightBox.Name = "rightBox"; rightBox.Header = "Right Box"; rightBox.Top = 0; rightBox.Left = mainPanel.Width / 2; rightBox.Width = mainPanel.Width / 2; rightBox.Height = mainPanel.Height; var rightRightBox = new Groupbox(); rightRightBox.Name = "rightRightBox"; rightRightBox.Header = "Checkbox!"; rightRightBox.Top = 1; rightRightBox.Width = rightBox.Width / 2 - 2; rightRightBox.Height = 8; for (int i = 0; i < 4; i++) rightRightBox.Add(new Checkbox("Foo" + i) { Name = "foo" + i, Top = i }); var rightLeftBox = new Groupbox(); rightLeftBox.Name = "rightLeftBox"; rightLeftBox.Header = "Radiobutton!"; rightLeftBox.Top = 1; rightLeftBox.Left = rightBox.Width / 2 - 2; rightLeftBox.Width = rightBox.Width / 2 + 2; rightLeftBox.Height = 8; for (int i = 0; i < 4; i++) rightLeftBox.Add(new RadioButton("Bar" + i) { Name = "bar" + i, Top = i }); var lblRightRadioDesc = new Label("Radiobuttons can have groups:"); lblRightRadioDesc.Top = rightLeftBox.Height + 2; lblRightRadioDesc.Name = "lblDesc"; for (int i = 0; i < 6; i++) rightBox.Add(new RadioButton("asd" + i) { Text = "Group" + (i / 3), Name = "chk" + i.ToString(), Top = (i % 3) + rightRightBox.Height + 3, Left = (i / 3) * 15 + 2, ComboboxGroup = "grp" + (i / 3) }); rightBox.Add(rightRightBox); rightBox.Add(rightLeftBox); rightBox.Add(lblRightRadioDesc); #endregion mainPanel.Add(leftBox); mainPanel.Add(rightBox); var app = new Application(mainPanel); app.FocusManager = new FocusManager(mainPanel, btnLeftIncrement); app.Name = "FoggyConsole"; app.Run(); }
/// <summary> /// Install Software in a hive /// </summary> /// <param name="hive"></param> public void Install(Playground hive) { string sessionId = Session.Current?.SessionId; this.Heading = "Installing Application"; ApplicationOperationsPage parent = this.Parent as ApplicationOperationsPage; HiveManager.InstallSoftware(parent.DepotKey, parent.AppId, hive, (installedInHive) => { // Success Utils.ScheduleTaskHelper(sessionId, (session, id) => { if (session != null) { this.OnSoftwareInstalled(installedInHive); session.CalculatePatchAndPushOnWebSocket(); } }); }, (text, progress) => { // Progress Utils.ScheduleTaskHelper(sessionId, (session, id) => { if (session != null) { this.SetProgress(text, progress); session.CalculatePatchAndPushOnWebSocket(); } }); }, (errorResponse) => { // Error Utils.ScheduleTaskHelper(sessionId, (session, id) => { parent.OnError(errorResponse); session.CalculatePatchAndPushOnWebSocket(); }); }); }
/// <summary> /// Get Entrypoint url to the hive /// </summary> /// <example> /// www.myhost.com/myapp /// </example> /// <param name="hive"></param> /// <param name="softwareEntryPoint"></param> /// <returns></returns> private string GetEndPointUrl(Playground hive, string softwareEntryPoint) { string entryPoint = string.Empty; if (!string.IsNullOrEmpty(softwareEntryPoint)) { entryPoint = softwareEntryPoint; if (!entryPoint.StartsWith("/")) { entryPoint = "/" + entryPoint; } } return hive.PlaygroundUrl + entryPoint; }
public Bot() { this.isShipFound = false; this.playground = new Playground(); }
/// <summary> /// Install software in hive /// </summary> /// <param name="hive"></param> private void InstallSoftware(Playground hive) { string sessionId = Session.Current?.SessionId; // Install app Utils.ScheduleTaskHelper(sessionId, (session, id) => { if (session != null) { ProgressPage progressPage = new ProgressPage(); this.Partial = progressPage; progressPage.Install(hive); session.CalculatePatchAndPushOnWebSocket(); } }); }
void OnConnectionEstablished(object sender, SocketAsyncEventArgs e) { if (e.SocketError != SocketError.Success) { State = NetworkClientState.Disconnected; return; } NetworkPacketSerializer.WritePacket(new JoinRequestPacket(), Socket); var packet = NetworkPacketSerializer.ReadPacket(Socket); var welcome = packet as WelcomePacket; if (packet == null) { throw new Exception("Expected a welcome packet but received something else!"); } Playground = new Playground(welcome.Map); RaiseMapChanged(welcome.Map); State = NetworkClientState.Ready; }