public static string AsDegreesMinutesSeconds(Heading heading) { if (double.IsNaN(heading.Value)) { return Unknown; } return AsDegreesMinutesSeconds(heading.Value, ' '); }
public void AddRoversToPlateauAndTestForCollissions() { Plateau.SetPlateauBounds(10, 10); var positionA = new Position(5, 5); var headingA = new Heading('N'); var pathA = new List<char> {'M', 'M'}; var roverA = new Rover(positionA, headingA, new Guid(), pathA); var positionB = new Position(4, 4); var headingB = new Heading('N'); var pathB = new List<char> {'M', 'M'}; var roverB = new Rover(positionB, headingB, new Guid(), pathB); var positionC = new Position(3, 3); var headingC = new Heading('N'); var pathC = new List<char> {'M', 'M'}; var roverC = new Rover(positionC, headingC, new Guid(), pathC); var positionD = new Position(2, 2); Plateau.AddRoverToPosition(positionA, roverA); Plateau.AddRoverToPosition(positionB, roverB); Plateau.AddRoverToPosition(positionC, roverC); Plateau.RoverAtPosition(positionA).Should().BeTrue(); Plateau.RoverAtPosition(positionB).Should().BeTrue(); Plateau.RoverAtPosition(positionC).Should().BeTrue(); Plateau.RoverAtPosition(positionD).Should().BeFalse(); }
public static void Title(string titleText, Heading heading, bool centered, string secondaryText) { var style = FlatFonts.LatoBlackStyle((int) heading, centered); var content = new GUIContent(titleText); var titleRect = GUILayoutUtility.GetRect(content, style); GUI.Label(titleRect, TypographyUtilities.ColoredText(FlatEditor.TextColor, titleText), style); if (secondaryText != null) { var subStyle = new GUIStyle(style) { font = FlatFonts.Lato, fontSize = Mathf.RoundToInt(style.fontSize*0.85f), alignment = TextAnchor.LowerLeft, }; var contentSize = subStyle.CalcSize(new GUIContent(secondaryText)); var offset = new Vector2(style.CalcSize(content).x, ((int) heading / 10) + 1); var subRect = new Rect(titleRect.position + offset, contentSize); var lightened = new Color32(125, 125, 125,255); GUI.Label(subRect, TypographyUtilities.ColoredText(lightened, secondaryText), subStyle); } }
public static IEnumerable<RoverPath> Parse(List<string> instructions) { var bounds = instructions[0].Split(' '); int boundsX; int boundsY; int.TryParse(bounds[0], out boundsX); int.TryParse(bounds[1], out boundsY); Plateau.SetPlateauBounds(boundsX, boundsY); for (var i = 1; i < instructions.Count; i += 2) { var currentInstruction = instructions[i].Split(' '); var x = int.Parse(currentInstruction[0]); var y = int.Parse(currentInstruction[1]); var heading = char.Parse(currentInstruction[2]); var startPosition = new Position(x, y); var startHeading = new Heading(heading); var path = instructions[i + 1]; var roverPath = new RoverPath(startPosition, startHeading, path); RoverPathList.Add(roverPath); } return RoverPathList; }
private static string CheckForId(Heading parent, System.Xml.XmlElement element) { string id = element.GetAttribute("id"); if (id == null || id.Length == 0) { StringBuilder builder = new StringBuilder(); foreach (char c in element.InnerText) { if (char.IsLetterOrDigit(c)) builder.Append(c); else if (char.IsWhiteSpace(c)) { //don't consider whitespace } else builder.Append('_'); if (builder.Length >= 100) break; } id = builder.ToString(); //Add the parent id if (parent.IsRoot() == false) id = parent.Id + "_" + id; element.SetAttribute("id", id); } return id; }
private static void GenerateHeadings(System.Xml.XmlNodeList headings, Heading parent, ref int index) { while (index < headings.Count) { int headingLevel = GetHeadingLevel(headings[index].Name); if (headingLevel == 0) { //not an heading index++; // Skip } else if (headingLevel <= parent.Level) { return; } else if (headingLevel > parent.Level) { //Generate the header only for heading with ID attribute string id = CheckForId(parent, (System.Xml.XmlElement)headings[index]); Heading subHead = new Heading(headings[index].InnerText, id, headingLevel); parent.AddChild(subHead); index++; // Read next GenerateHeadings(headings, subHead, ref index); } else throw new ArgumentOutOfRangeException("index"); } }
void SendHeading() { Heading current = new Heading(); Vector3 currPos = transform.position; float currAngle = Convert.ToSingle(2*Math.Atan2(transform.rotation.y, transform.rotation.w)); ThirdPersonController playerController = GetComponent<ThirdPersonController>(); float currSpeed = playerController.GetSpeed(); long currTime = ServerClock.Instance.GetTime(); if (playerController.IsAccelerating()) { float currEndSpeed = playerController.GetEndSpeed(); long currAccelerationTime = playerController.GetAccelerationTime(); current.InitFromValues(currPos, currAngle, currTime, currSpeed, currEndSpeed, currAccelerationTime); } else { current.InitFromValues(currPos, currAngle, currTime, currSpeed); } bool headingChanged = !current.IsFutureOf(lastState); if(headingChanged) { //Debug.Log("last: "+lastState); //Debug.Log("curr: "+current); lastState = current; lastState.Send(); } }
public void Move_ValidMoveOneSpace_MowerMovesOneSpace(Heading heading, string expected) { var mower = new Mower(new Point(3,3), heading, new Point(5,5)); var result = mower.Move("M"); Assert.AreEqual(expected, result); }
public void Move_InvalidMoveOneSpaceValidTurn_MowerDoesnNotMoveButDoesTurn(int spx, int spy, Heading heading, int gbx, int gby, string instructions, string expected) { var mower = new Mower(new Point(spx,spy), heading, new Point(gbx,gby)); var result = mower.Move(instructions); Assert.AreEqual(expected, result); }
// path shouldn't be part of the constructor, the rover can exist without it // convert _path to an enum to reduce the possible valid ideas // extension methods public Rover(Position position, Heading heading, Guid id, List<char> path) { // generate id within this class _id = id; Position = position; _heading = heading; _path = path; }
public ParagraphModel EndParagraph() { _buffer.EndOfLine(); var retval = new ParagraphModel(_buffer.ToArray(), _heading); _buffer.Clear(); _buffer = null; _heading = null; return retval; }
public RoverPath(Position startPosition, Heading startHeading, string movementInstructions) { _startHeading = startHeading; _startPosition = startPosition; foreach (var move in movementInstructions) { _movementInstructions.Add(move); } }
public void CreateRoversAndGetPositionsAndHeadings() { var positionA = new Position(5, 5); var headingA = new Heading('N'); var pathA = new List<char> { 'M', 'M' }; var roverA = new Rover(positionA, headingA, new Guid(), pathA); var positionB = new Position(4, 4); var headingB = new Heading('S'); var pathB = new List<char> { 'M', 'M' }; var roverB = new Rover(positionB, headingB, new Guid(), pathB); roverA.GetHeading().Should().Be('N'); roverB.Position.ShouldBeEquivalentTo(new Position(4, 4)); }
public void CreateHeadingAndDoSomeTurns() { var heading = new Heading('N'); heading.TurnRight(); heading.GetHeading().Should().Be('E'); heading.TurnLeft(); heading.TurnRight(); heading.TurnRight(); heading.GetHeading().Should().Be('S'); heading.TurnLeft(); heading.TurnLeft(); heading.TurnLeft(); heading.GetHeading().Should().Be('W'); }
/// <summary>Determine what a heading would be after performing a rotation</summary> /// <param name="currentDirection">the current (Heading) of the object</param> /// <param name="desiredRotation">The (Rotation) that should be applied</param> /// <returns>The resulting (Heading)</returns> protected Heading Rotate(Heading currentDirection, Rotation desiredRotation) { int degreeHeading = (int)currentDirection + (int)desiredRotation; // Check if we rotated left of North; if so, set West if (degreeHeading < 0) { return Heading.West; } // Check if we rotated right of West; if so, set North if (degreeHeading > 270) { return Heading.North; } return (Heading)degreeHeading; }
public void CreateRoverPaths() { var positionA = new Position(5, 5); var headingA = new Heading('N'); var pathA = "MMRLMM"; var roverPathA = new RoverPath(positionA, headingA, pathA); var positionB = new Position(4, 4); var headingB = new Heading('S'); var pathB = "MMMMMMM"; var roverPathB = new RoverPath(positionB, headingB, pathB); roverPathA.GetStartHeading().GetHeading().ShouldBeEquivalentTo('N'); roverPathA.GetStartPosition().ShouldBeEquivalentTo(new Position(5, 5)); roverPathB.GetStartHeading().GetHeading().ShouldBeEquivalentTo('S'); roverPathB.GetStartPosition().ShouldBeEquivalentTo(new Position(4, 4)); }
/// <summary> /// Automatically create the table of contents for the specified document. /// Insert an ID in the document if the heading doesn't have it. /// Returns the XHTML for the TOC /// </summary> public static string GenerateTOC(System.Xml.XmlDocument doc) { System.Xml.XmlNodeList headings = doc.SelectNodes("//*"); Heading root = new Heading("ROOT", null, 0); int index = 0; GenerateHeadings(headings, root, ref index); using (System.IO.MemoryStream stream = new System.IO.MemoryStream()) { System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(stream, System.Text.Encoding.UTF8); writer.WriteStartElement("div"); root.WriteChildrenToXml(writer); writer.WriteEndElement(); writer.Flush(); stream.Seek(0, System.IO.SeekOrigin.Begin); System.IO.StreamReader reader = new System.IO.StreamReader(stream, System.Text.Encoding.UTF8); return reader.ReadToEnd(); } }
public void MoveRover() { Plateau.SetPlateauBounds(10, 10); var positionA = new Position(5, 5); var headingA = new Heading('N'); var pathA = new List<char> { 'M', 'M', 'L' }; var roverA = new Rover(positionA, headingA, new Guid(), pathA); var successA = roverA.FollowPath(); successA.Should().BeTrue(); roverA.GetHeading().Should().Be('W'); roverA.Position.ShouldBeEquivalentTo(new Position(5, 7)); var positionB = new Position(4, 4); var headingB = new Heading('S'); var pathB = new List<char> { 'M', 'M', 'M', 'M', 'M' }; var roverB = new Rover(positionB, headingB, new Guid(), pathB); var successB = roverB.FollowPath(); successB.Should().BeFalse(); roverB.GetHeading().Should().Be('S'); roverB.Position.ShouldBeEquivalentTo(new Position(4, -1)); }
public void SendHeading(Heading heading) { Hashtable data = new Hashtable(); data.Add("x", heading.GetPosition().x); data.Add("y", heading.GetPosition().y); data.Add("z", heading.GetPosition().z); data.Add("a", heading.GetAngle()); data.Add("t", Convert.ToDouble(heading.GetTime())); data.Add("s", heading.GetSpeed().magnitude); if (heading.IsAccelerating()) { data.Add("at", Convert.ToDouble(heading.GetAccelerationTime())); data.Add("es", heading.GetEndSpeed().magnitude); } else { data.Add("at", -1); } //send heading to server SmartFoxClient client = NetworkController.GetClient(); string extensionName = NetworkController.GetExtensionName(); client.SendXtMessage(extensionName, "h", data); }
protected void AssertRobotPosition(int expectedX, int expectedY, Heading expectedHeading, Robot actualRobot) { Assert.AreEqual(expectedX, actualRobot.XCoordinate); Assert.AreEqual(expectedY, actualRobot.YCoordinate); Assert.AreEqual(expectedHeading, actualRobot.Direction); }
public void PurchaseRocket() { App.NavigationService.Navigate("http://demos.bellatrix.solutions/"); // 2. Create methods accept a generic parameter the type of the web control. Then only the methods for this specific control are accessible. // Here we tell BELLATRIX to find your element by name attribute ending with 'orderby'. Select sortDropDown = App.ElementCreateService.CreateByNameEndingWith <Select>("orderby"); // 3. You can select from select inputs by text (SelectByText) or index (SelectByIndex)). // Also, you can get the selected option through GetSelected method. // <select name="orderby" class="orderby"> // <option value="popularity" selected="selected">Sort by popularity</option> // <option value="rating">Sort by average rating</option> // <option value="date">Sort by newness</option> // <option value="price">Sort by price: low to high</option> // <option value="price-desc">Sort by price: high to low</option> // </select> sortDropDown.SelectByText("Sort by price: low to high"); // 4. Here BELLATRIX finds the first anchor element which has inner text containing the 'Read more' text. // <a href='http://demos.bellatrix.solutions/product/proton-m/'>Read more</a> Anchor protonMReadMoreButton = App.ElementCreateService.CreateByInnerTextContaining <Anchor>("Read more"); // 5. You can Hover and Focus on most web elements. Also, can invoke Click on anchors. protonMReadMoreButton.Hover(); // 6. Locate elements by custom attribute. Also, bellow BELLATRIX waits till the anchor is clickable before doing any actions. // <a href="/?add-to-cart=28" data-product_id="28">Add to cart</a> Anchor addToCartFalcon9 = App.ElementCreateService.CreateByAttributesContaining <Anchor>("data-product_id", "28").ToBeClickable(); addToCartFalcon9.Focus(); addToCartFalcon9.Click(); // 7. Find the anchor by class 'added_to_cart wc-forward' and wait for the element again to be clickable. // <a href="http://demos.bellatrix.solutions/cart/" class="added_to_cart wc-forward" title="View cart">View cart</a> Anchor viewCartButton = App.ElementCreateService.CreateByClassContaining <Anchor>("added_to_cart wc-forward").ToBeClickable(); viewCartButton.Click(); // 8. Find a regular input text element by id = 'coupon_code'. TextField couponCodeTextField = App.ElementCreateService.CreateById <TextField>("coupon_code"); // 9. Instead of using vanilla WebDriver SendKeys to set the text, use the SetText method. couponCodeTextField.SetText("happybirthday"); // 10. Create a button control by value attribute containing the text 'Apply coupon'. // <input type="submit" class="button" name="apply_coupon" value="Apply coupon"> // Button can be any of the following web elements- input button, input submit or button. Button applyCouponButton = App.ElementCreateService.CreateByValueContaining <Button>("Apply coupon"); applyCouponButton.Click(); Div messageAlert = App.ElementCreateService.CreateByClassContaining <Div>("woocommerce-message"); // 11. Wait for the message DIV to show up and have some content. // <div class="woocommerce-message" role="alert">Coupon code applied successfully.</div> messageAlert.ToHasContent().ToBeVisible().WaitToBe(); // 12. Sometimes you need to verify the content of some element. However, since the asynchronous nature of websites, // the text or event may not happen immediately. This makes the simple Assert methods + vanilla WebDriver useless. // The commented code fails 1 from 5 times. ////Assert.AreEqual("Coupon code applied successfully.", messageAlert.InnerText); // To handle these situations, BELLATRIX has hundreds of Validate methods that wait for some condition to happen before asserting. // Bellow the statement waits for the specific text to appear and assert it. // Note: There are much more details about these methods in the next chapters. messageAlert.ValidateInnerTextIs("Coupon code applied successfully."); // 13. Find the number element by class 'input-text qty text'. // <input type="number" id="quantity_5ad35e76b34a2" step="1" min="0" max="" value="1" size="4" pattern="[0-9]*" inputmode="numeric"> Number quantityBox = App.ElementCreateService.CreateByClassContaining <Number>("input-text qty text"); // 14. For numbers elements, you can set the number and get most of the properties of these elements. App.BrowserService.WaitForAjax(); Span totalSpan = App.ElementCreateService.CreateByXpath <Span>("//*[@class='order-total']//span"); // 15. The same as the case with the DIV here we wait/assert for the total price SPAN to get updated. ////Assert.AreEqual("114.00€", totalSpan.InnerText); totalSpan.ValidateInnerTextIs("54.00€", 15000); Anchor proceedToCheckout = App.ElementCreateService.CreateByClassContaining <Anchor>("checkout-button button alt wc-forward"); proceedToCheckout.Click(); // 16. As mentioned before, BELLATRIX has special synchronisation mechanism for locating elements, so usually, there is no need to wait for specific // elements to appear on the page. However, there may be some rare cases when you need to do it. // Bellow the statement finds the heading by its inner text containing the text 'Billing details'. Heading billingDetailsHeading = App.ElementCreateService.CreateByInnerTextContaining <Heading>("Billing details"); // Wait for the heading with the above text to be visible. This means that the correct page is loaded. billingDetailsHeading.ToBeVisible().WaitToBe(); Anchor showLogin = App.ElementCreateService.CreateByInnerTextContaining <Anchor>("Click here to login"); // 17. All web controls have multiple properties for their most important attributes and Validate methods for their verification. ////Assert.AreEqual("http://demos.bellatrix.solutions/checkout/#", showLogin.Href); showLogin.ValidateHrefIs("http://demos.bellatrix.solutions/checkout/#"); ////Assert.AreEqual("showlogin", showLogin.CssClass); showLogin.ValidateCssClassIs("showlogin"); TextArea orderCommentsTextArea = App.ElementCreateService.CreateById <TextArea>("order_comments"); // 18. Here we find the order comments text area and since it is below the visible area we scroll down // so that it gets visible on the video recordings. Then the text is set. orderCommentsTextArea.ScrollToVisible(); orderCommentsTextArea.SetText("Please send the rocket to my door step! And don't use the elevator, they don't like when it is not clean..."); TextField billingFirstName = App.ElementCreateService.CreateById <TextField>("billing_first_name"); billingFirstName.SetText("In"); TextField billingLastName = App.ElementCreateService.CreateById <TextField>("billing_last_name"); billingLastName.SetText("Deepthought"); TextField billingCompany = App.ElementCreateService.CreateById <TextField>("billing_company"); billingCompany.SetText("Automate The Planet Ltd."); Select billingCountry = App.ElementCreateService.CreateById <Select>("billing_country"); billingCountry.SelectByText("Bulgaria"); TextField billingAddress1 = App.ElementCreateService.CreateById <TextField>("billing_address_1"); // 19. Through the Placeholder, you can get the default text of the control. Assert.AreEqual("House number and street name", billingAddress1.Placeholder); billingAddress1.SetText("bul. Yerusalim 5"); TextField billingAddress2 = App.ElementCreateService.CreateById <TextField>("billing_address_2"); billingAddress2.SetText("bul. Yerusalim 6"); TextField billingCity = App.ElementCreateService.CreateById <TextField>("billing_city"); billingCity.SetText("Sofia"); Select billingState = App.ElementCreateService.CreateById <Select>("billing_state").ToBeVisible().ToBeClickable(); billingState.SelectByText("Sofia-Grad"); TextField billingZip = App.ElementCreateService.CreateById <TextField>("billing_postcode"); billingZip.SetText("1000"); Phone billingPhone = App.ElementCreateService.CreateById <Phone>("billing_phone"); // 20. Create the special text field control Phone it contains some additional properties unique for this web element. billingPhone.SetPhone("+00359894646464"); Email billingEmail = App.ElementCreateService.CreateById <Email>("billing_email"); // 21. Here we create the special text field control Email it contains some additional properties unique for this web element. billingEmail.SetEmail("*****@*****.**"); CheckBox createAccountCheckBox = App.ElementCreateService.CreateById <CheckBox>("createaccount"); // 22. You can check and uncheck checkboxes. createAccountCheckBox.Check(); // 23. Bellow BELLATRIX finds the first RadioButton with attribute 'for' containing the value 'payment_method_cheque'. RadioButton checkPaymentsRadioButton = App.ElementCreateService.CreateByAttributesContaining <RadioButton>("for", "payment_method_cheque"); // The radio buttons compared to checkboxes cannot be unchecked/unselected. checkPaymentsRadioButton.Click(); }
public Rover(int x, int y, Heading heading) // construct a new rover by knowing its intial location { this.currentLocation = new RoverPosition(x, y, heading); }
public Mower(Point startingPosition, Heading heading, Point gardenBound) { Position = startingPosition; Heading = heading; _gardenBound = gardenBound; }
public ActionResult AddHeading(Heading p) { p.HeadingDate = DateTime.Parse(DateTime.Now.ToShortDateString()); hm.HeadingAdd(p); return(RedirectToAction("Index")); }
public ActionResult EditHeading(Heading heading) { hm.HeadingUpdate(heading); return(RedirectToAction("Index")); }
public void Insert(Heading p) { _object.Add(p); c.SaveChanges(); }
private string FormatHeading() { return(Heading.ToString("0", CultureInfo.InvariantCulture.NumberFormat)); }
public IElementRenderer CreateHeadingRender(Heading element) { return(new HtmlHeading((Heading)element)); }
public void Delete(Heading p) { _object.Remove(p); c.SaveChanges(); }
/// <summary>Sets the heading.</summary> /// <param name="heading">The heading.</param> public override void SetHeading(Heading heading) { }
public ActionResult EditHeading(Heading h) { hm.HeadingUpdate(h); return(RedirectToAction("MyHeading")); }
public TextHeadingRenderer(Heading heading) { this.headingElement = heading; }
public Robot() { _cmds = Enumerable.Empty <Command>(); CurrentLocation = new Position(0, 0); CurrentHeading = Heading.IGNORE; }
public string ToPoseDegString() { return(string.Format("X: {0:n3}, Y: {1:n3}, Heading: {2:n2} (deg)", X, Y, Heading.RadToDeg())); }
public DisplayAlert(AlertArguments arguments) { Element = new Div { AddClassName = "modal-dialog" }; var content = new Div { AddClassName = "modal-content" }; var header = new Div { AddClassName = "modal-header" }; _closeButton = new Button { AddClassName = "close" }; _closeButton.AppendChild(new Span("×")); var h4 = new Heading(4) { Text = arguments.Title }; header.AppendChild(_closeButton); header.AppendChild(h4); content.AppendChild(header); content.AppendChild(new Div() { AddClassName = "modal-body", Text = arguments.Message }); if (!string.IsNullOrEmpty(arguments.Cancel)) { var footer = new Div() { AddClassName = "modal-footer" }; _cancelButton = new Button(arguments.Cancel) { AddClassName = "btn btn-default" }; _cancelButton.Click += (s, e) => SetResult(false); footer.AppendChild(_cancelButton); if (!string.IsNullOrEmpty(arguments.Accept)) { _acceptButton = new Button(arguments.Accept) { AddClassName = "btn btn-default" }; _acceptButton.Click += (s, e) => SetResult(true); footer.AppendChild(_acceptButton); } content.AppendChild(footer); } Element.AppendChild(content); void SetResult(bool result) { arguments.SetResult(result); } }
private void print(Heading type, string text) { print(type, text, null); }
public ManualChannelPage(ChannelData channel, ManualPage parent) : base("div") { const int labelSize = 229; _channel = channel; SetBorder(BorderKind.Rounded, StylingColor.Secondary); #region ExecuteAction #region Initialize Grid Grid grid = new Grid(this); grid.AddStyling(StylingOption.MarginRight, 2); grid.AddStyling(StylingOption.MarginLeft, 2); grid.AddStyling(StylingOption.MarginTop, 4); grid.AddStyling(StylingOption.MarginBottom, 2); #endregion Initialize Grid #region Init Container Container firstContainer = new Container(); firstContainer.SetBorder(BorderKind.Rounded, StylingColor.Info); firstContainer.AddStyling(StylingOption.MarginTop, 3); firstContainer.AddStyling(StylingOption.MarginBottom, 1); firstContainer.AddStyling(StylingOption.PaddingTop, 3); firstContainer.AddStyling(StylingOption.PaddingBottom, 2); grid.AddRow().AppendCollum(firstContainer, autoSize: true); #endregion Init Container #region create Heading Heading firstHeading = new Heading(5, "Kanal aktivieren ..."); firstContainer.AppendChild(firstHeading); #endregion create Heading #region duration Input MultiInputGroup durationMultiInputGroup = new MultiInputGroup(); durationMultiInputGroup.AppendLabel("Dauer", labelSize); StylableTextInput durationTextInput = durationMultiInputGroup.AppendTextInput("hh:mm:ss"); durationTextInput.Value = "00:00:00"; firstContainer.AppendChild(durationMultiInputGroup); durationMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2); durationMultiInputGroup.AppendValidation("", "Das Format der Dauer muss hh:mm:ss sein!", true); #endregion duration Input #region Master ButtonGroup MultiInputGroup masterEnabledMultiInputGroup = new MultiInputGroup(); masterEnabledMultiInputGroup.AppendLabel("Master Aktivieren", labelSize); TwoStateButtonGroup masterEnabledTwoStateButtonGroup = masterEnabledMultiInputGroup.AppendCustomElement(new TwoStateButtonGroup("Ja", "Nein", true, false), false); firstContainer.AppendChild(masterEnabledMultiInputGroup); masterEnabledMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2); #endregion Master ButtonGroup #region StartButton Button startButton = new Button(StylingColor.Success, true, text: "Einreihen!", fontAwesomeIcon: "plus-circle", asBlock: true); firstContainer.AppendChild(startButton); startButton.Click += (o, args) => { if (durationTextInput.Value.Split(':').Length != 3 || durationTextInput.Value.Split(':').Any(s => int.TryParse(s, out _) == false)) { durationTextInput.SetValidation(false, true); } else { durationTextInput.SetValidation(true, false); startButton.IsDisabled = true; try { CreateChannelAction(channel, TimeSpan.Parse(durationTextInput.Value), masterEnabledTwoStateButtonGroup.FirstButtonActive, 100); startButton.Text = "Wurde Eingereiht"; Task.Run(() => { System.Threading.Thread.Sleep(5000); startButton.Text = "Einreihen!"; startButton.SetFontAwesomeIcon("plus-circle"); return(startButton.IsDisabled = false); }); } catch (Exception) { startButton.Text = "Einreihen fehlgeschlagen"; throw; } } }; firstContainer.AppendChild(startButton); startButton.AddStyling(StylingOption.MarginBottom, 2); #endregion StartButton #endregion ExecuteAction #region AddToBatch #region Init Container Container secondContainer = new Container(); secondContainer.SetBorder(BorderKind.Rounded, StylingColor.Info); secondContainer.AddStyling(StylingOption.MarginTop, 3); secondContainer.AddStyling(StylingOption.MarginBottom, 1); secondContainer.AddStyling(StylingOption.PaddingTop, 3); secondContainer.AddStyling(StylingOption.PaddingBottom, 2); grid.AddRow().AppendCollum(secondContainer, autoSize: true); #endregion Init Container #region create Heading Heading heading = new Heading(5, "... als Batch-Auftrag speichern"); secondContainer.AppendChild(heading); #endregion create Heading #region batchName Input MultiInputGroup batchNameMultiInputGroup = new MultiInputGroup(); batchNameMultiInputGroup.AddStyling(StylingOption.MarginTop, 4); batchNameMultiInputGroup.AppendLabel("Name für den Batch-Auftrag:"); StylableTextInput batchNameTextInput = batchNameMultiInputGroup.AppendTextInput("Name?"); batchNameMultiInputGroup.AppendValidation("", "Der Name ist bereits vergeben", true); secondContainer.AppendChild(batchNameMultiInputGroup); #endregion batchName Input Button appendToBatchButton = new Button(StylingColor.Success, true, text: "Als Batch-Auftrag speichern", fontAwesomeIcon: "save", asBlock: true); appendToBatchButton.AddStyling(StylingOption.MarginTop, 2); appendToBatchButton.Click += (sender, args) => { if (batchNameTextInput.Value == "") { batchNameTextInput.SetValidation(false, true); return; } if (PageStorage <ManualData> .Instance.StorageData.BatchEntries.Any(entry => entry.Name == batchNameTextInput.Value)) { batchNameTextInput.SetValidation(false, true); } else { batchNameTextInput.SetValidation(true, false); PageStorage <ManualData> .Instance.StorageData.BatchEntries.Add(new BatchEntry(batchNameTextInput.Value, channel.ChannelId, TimeSpan.Parse(durationTextInput.Value), masterEnabledTwoStateButtonGroup.FirstButtonActive, 100)); parent.UpdateBatch(); } }; secondContainer.AppendChild(appendToBatchButton); #endregion AddToBatch }
/// <summary>Initializes a new instance of the <see cref="Truck" /> class.</summary> /// <param name="heading">The heading of the Sprite</param> public Truck(Heading heading) { Sprite = new TruckSprite(); SetHeading(heading); }
private static async Task SeedChecklist(DataContext context, ILogger <DataContext> logger) { try { var anyCheckListExist = await context.CheckLists.AnyAsync(); if (!anyCheckListExist) { ChecklistService service = new ChecklistService(context); int subAdminId = service.GetSubAdminIdByText("Sub-Admin1"); var checkListDto = new CheckListDto { HubName = "Indoctrination Form on Health, Safety and Environment for Hub 1", Heading = "Emergency Procedures", SubAdminId = subAdminId }; var checklist = await service.Create(checkListDto); #region/* Emergency Procedures */ var question2 = new Question { MainHeadingId = checklist.HeadingId, CheckListId = checklist.Id, Content = "⦁ 1st Alarm,warning alarm – Wait for further instruction.", HeaderText = "In the event of fire emergency" }; await service.CreateQuestion(question2); var question3 = new Question { MainHeadingId = checklist.HeadingId, CheckListId = checklist.Id, Content = "⦁ 2nd Alarm, evacuation alarm – Proceed to assembly area in an orderly manner.", FooterText = "Note: Do not re-enter the premises or take the lift." }; await service.CreateQuestion(question3); #endregion #region/* Company policies */ var heading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.MainHeading, Content = "Company policies" }; var headingResult = await service.AddHeading(heading); var question5 = new Question { MainHeadingId = headingResult.Id, CheckListId = checklist.Id, Content = "Quality and performance policy." }; await service.CreateQuestion(question5); var question6 = new Question { MainHeadingId = headingResult.Id, CheckListId = checklist.Id, Content = "Health, safety and environment policy." }; await service.CreateQuestion(question6); var question7 = new Question { MainHeadingId = headingResult.Id, CheckListId = checklist.Id, Content = "Alcohol and substance abuse policy." }; await service.CreateQuestion(question7); var question8 = new Question { MainHeadingId = headingResult.Id, CheckListId = checklist.Id, Content = "Security policy." }; await service.CreateQuestion(question8); #endregion #region/* Associated Hazards - headings */ var hazardHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.MainHeading, Content = "Associated Hazards" }; var hazardResult = await service.AddHeading(hazardHeading); var generalHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.SubHeading, Content = "General Hazard" }; var generalResult = await service.AddHeading(generalHeading); var specificHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.SubHeading, Content = "Site Specific Hazards or Concern" }; var specificResult = await service.AddHeading(specificHeading); var healthHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.SubOfSubHeading, Content = "Health and Safety hazards" }; var healtResult = await service.AddHeading(healthHeading); var warehouseHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.SubOfSubHeading, Content = "Warehouse" }; var warehouseResult = await service.AddHeading(warehouseHeading); var bayHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.SubOfSubHeading, Content = "Loading bay" }; var bayResult = await service.AddHeading(bayHeading); #endregion #region /* Health and Safety hazards */ var question9 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = generalResult.Id, SubOfSubHeadingId = healtResult.Id, Content = "Electrical hazards." }; await service.CreateQuestion(question9); var question10 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = generalResult.Id, SubOfSubHeadingId = healtResult.Id, Content = "Fire hazards." }; await service.CreateQuestion(question10); var question11 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = generalResult.Id, SubOfSubHeadingId = healtResult.Id, Content = "Mechanical hazards." }; await service.CreateQuestion(question11); var question12 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = generalResult.Id, SubOfSubHeadingId = healtResult.Id, Content = "Falls from height/Falling objects." }; await service.CreateQuestion(question12); var question13 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = generalResult.Id, SubOfSubHeadingId = healtResult.Id, Content = "Ergonomic hazards (manual handling hazards)." }; await service.CreateQuestion(question13); var question14 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = generalResult.Id, SubOfSubHeadingId = healtResult.Id, Content = "Slip, trip and fall." }; await service.CreateQuestion(question14); var question15 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = generalResult.Id, SubOfSubHeadingId = healtResult.Id, Content = "Chemical hazards." }; await service.CreateQuestion(question15); #endregion #region /* Warehouse */ var question16 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = specificResult.Id, SubOfSubHeadingId = warehouseResult.Id, Content = "Forklift & MHE movement." }; await service.CreateQuestion(question16); var question17 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = specificResult.Id, SubOfSubHeadingId = warehouseResult.Id, Content = "Charging of Forklift and MHE." }; await service.CreateQuestion(question17); var question18 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = specificResult.Id, SubOfSubHeadingId = warehouseResult.Id, Content = "Housekeeping." }; await service.CreateQuestion(question18); var question19 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = specificResult.Id, SubOfSubHeadingId = warehouseResult.Id, Content = "Charging of micro-battery." }; await service.CreateQuestion(question19); #endregion #region /* Loading bay */ var question20 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = specificResult.Id, SubOfSubHeadingId = bayResult.Id, Content = "Trip and fall over dock leveler." }; await service.CreateQuestion(question20); var question21 = new Question { MainHeadingId = hazardResult.Id, CheckListId = checklist.Id, SubHeadingId = specificResult.Id, SubOfSubHeadingId = bayResult.Id, Content = "Loading and unloading hazards." }; await service.CreateQuestion(question21); #endregion #region Risk Assessment var riskHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.MainHeading, Content = "Risk Assessment" }; var riskResult = await service.AddHeading(riskHeading); var question22 = new Question { MainHeadingId = riskHeading.Id, CheckListId = checklist.Id, Content = "Understand hazard identification, risk evaluation and control measures." }; await service.CreateQuestion(question22); #endregion #region General Security, Health and Safety Rules var securityHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.MainHeading, Content = "General Security, Health and Safety Rules" }; var securityResult = await service.AddHeading(securityHeading); var question23 = new Question { MainHeadingId = securityResult.Id, CheckListId = checklist.Id, Content = "No obstruction of Fire Fighting equipment, Emergency Exit/ stairway and Fireman Access point." }; await service.CreateQuestion(question23); var question24 = new Question { MainHeadingId = securityResult.Id, CheckListId = checklist.Id, Content = "No smoking in the warehouse and office area." }; await service.CreateQuestion(question24); var question25 = new Question { MainHeadingId = securityResult.Id, CheckListId = checklist.Id, Content = "No operating of forklift without valid forklift license." }; await service.CreateQuestion(question25); var question26 = new Question { MainHeadingId = securityResult.Id, CheckListId = checklist.Id, Content = "Always observe warning signs and notices." }; await service.CreateQuestion(question26); var question27 = new Question { MainHeadingId = securityResult.Id, CheckListId = checklist.Id, Content = "Comply with good housekeeping and hygiene habits." }; await service.CreateQuestion(question27); var question28 = new Question { MainHeadingId = securityResult.Id, CheckListId = checklist.Id, Content = "Report all accident, injuries or near miss to your supervisor or manager." }; await service.CreateQuestion(question28); var question29 = new Question { MainHeadingId = securityResult.Id, CheckListId = checklist.Id, Content = "After any injuries, consult first aiders immediately. If required, visit the doctor with your immediate supervisor." }; await service.CreateQuestion(question29); var question30 = new Question { MainHeadingId = securityResult.Id, CheckListId = checklist.Id, Content = "No entry into quarantine or unauthorized area without the escort from host." }; await service.CreateQuestion(question30); #endregion #region Environmental Rules var environmentHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.MainHeading, Content = "Environmental Rules" }; var environmentResult = await service.AddHeading(environmentHeading); var question31 = new Question { MainHeadingId = environmentResult.Id, CheckListId = checklist.Id, Content = "Minimizing the environmental impact to our facility by reducing the consumption of natural resources, and the generation of waste and emissions related to the project, and practicing water conservation. " }; await service.CreateQuestion(question31); var question32 = new Question { MainHeadingId = environmentResult.Id, CheckListId = checklist.Id, Content = "Switch off vehicle engine when doing loading and unloading to reduce pollution." }; await service.CreateQuestion(question32); var question33 = new Question { MainHeadingId = environmentResult.Id, CheckListId = checklist.Id, Content = "Comply with 3 Rs practice. (Reduce, Reuse & Recycle)." }; await service.CreateQuestion(question33); #endregion #region Schedule of PPE in warehouse var scheduleHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.MainHeading, Content = "Schedule of PPE in warehouse" }; var scheduleResult = await service.AddHeading(scheduleHeading); var mandatoryHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.SubHeading, Content = "Mandatory" }; var mandatoryResult = await service.AddHeading(mandatoryHeading); var ifHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.SubHeading, Content = "If applicable" }; var ifResult = await service.AddHeading(ifHeading); var question34 = new Question { MainHeadingId = scheduleResult.Id, CheckListId = checklist.Id, SubHeadingId = mandatoryResult.Id, Content = "Safety boots" }; await service.CreateQuestion(question34); var question35 = new Question { MainHeadingId = scheduleResult.Id, CheckListId = checklist.Id, SubHeadingId = mandatoryResult.Id, Content = "Visibility Vest/ Bolloré Uniform" }; await service.CreateQuestion(question35); var question36 = new Question { MainHeadingId = scheduleResult.Id, CheckListId = checklist.Id, SubHeadingId = ifResult.Id, Content = "Gloves" }; await service.CreateQuestion(question36); #endregion #region/* Legal Requirement */ var legalHeading = new Heading { CheckListId = checkListDto.Id, HeadingType = HeadingType.MainHeading, Content = "Legal Requirement" }; var legalHeadingResult = await service.AddHeading(legalHeading); var question37 = new Question { MainHeadingId = legalHeadingResult.Id, CheckListId = checklist.Id, Content = "The main legal requirements that were complied (Fire Safety Act, Workplace Safety & Health act, Environmental Protection & Management Act)." }; await service.CreateQuestion(question37); #endregion } } catch (Exception ex) { logger.LogError("Error in checklist seed: ", ex); } }
private void print(Heading type, string text, object[] p) { Program.printf(getHeading(type) + " " + text, p); Console.Out.WriteLine(); }
public UnjustifiedLineBuilder(IFormatObject[] objectList, Heading heading) { _objectList = objectList; _heading = heading; }
public ActionResult EditHeading(Heading p) { headingManager.HeadingUpdate(p); return(RedirectToAction("MyHeading")); }
public void UpdateDeviceHeading (Heading deviceHeading) { lastDeviceBearing = deviceHeading.Degrees; }
private string getHeading(Heading h) { return("§7[§r" + headings[(int)h] + "§7]§r"); }
public static void Title(string text, Heading heading, string secondaryText = null, bool centered = false) { Text.Title(text, heading, centered, secondaryText); }
public HtmlHeading(Heading element) { this.element = element; }
// Use this for initialization void Start() { lastState = new Heading(); }
public override void TestInit() { App.Navigation.NavigateToLocalPage(ConfigurationService.GetSection <TestPagesSettings>().LayoutPricingPage); _free = App.Components.CreateByXpath <Heading>("/html/body/div[3]/div/div[1]/div[1]/h4"); _getStarted = App.Components.CreateByXpath <Button>("//*[text()='Get started']"); }
public override void TestInit() { App.NavigationService.NavigateToLocalPage(ConfigurationService.GetSection <TestPagesSettings>().LayoutPricingPage); _free = App.ElementCreateService.CreateByXpath <Heading>("/html/body/div[3]/div/div[1]/div[1]/h4"); _pro = App.ElementCreateService.CreateByXpath <Heading>("/html/body/div[3]/div/div[2]/div[1]/h4"); }
public void HeadingAdd(Heading heading) { _headingDal.Insert(heading); }
internal JustifiedLine(IEnumerable<InlineElement> source, Heading heading) { _texts = source.ToArray(); _heading = heading; }
public void HeadingUpdate(Heading heading) { _headingDal.Update(heading); }
public void Update(Heading p) { c.SaveChanges(); }
public Robot(int x, int y, Heading heading = Heading.N) { Position = new Position(x, y); Heading = heading; Penalties = 0; }
public bool Equals(Heading other) { if (null == other) return false; return other is West; }
private void FindSubheading(IExcelDataReader excelReader, string s) { try { string s2 = ReadCell(excelReader, 0); if (s2 != null) { string head = GetNormalString(@"^\d+ (.*)", s2); if (headings.ContainsKey(head)) { currentHeading = headings[head]; } else { var heiding = new Heading() { HeadingName = head }; Context.Headings.Add(heiding); Context.SaveChanges(); headings.Add(head, heiding.HeadingId); currentHeading = heiding.HeadingId; } } string str = GetNormalString(@"^\d.\d+ (.*)", s); if (str == "Общие показатели") { var tempSubhead = Context.Subheadings .Select(x => new Subheading { SubheadingId = x.SubheadingId, SubheadingName = x.SubheadingName, HeadingId = x.HeadingId }) .Where(x => x.SubheadingName == str && x.HeadingId == currentHeading).FirstOrDefault(); if (tempSubhead == null) { var subh = new Subheading() { SubheadingName = str, HeadingId = currentHeading }; Context.Subheadings.Add(subh); currentSubHead = subh.SubheadingId; } else { currentSubHead = tempSubhead.SubheadingId; } } else { if (subheadings.ContainsKey(str)) { currentSubHead = subheadings[str]; } else { var subh = new Subheading() { SubheadingName = str, HeadingId = currentHeading }; Context.Subheadings.Add(subh); Context.SaveChanges(); subheadings.Add(str, subh.SubheadingId); currentSubHead = subh.SubheadingId; } } } catch (Exception e) { } }
/// <summary>Create a new rover</summary> /// <param name="mySurface">What (Surface) should the rover land on?</param> /// <param name="startingPosition">What (Point) does the rover originate at?</param> /// <param name="directionFacing">What (Heading) is our rover point in?</param> public Rover(Surface mySurface, Point startingPosition, Heading directionFacing) { this.parent = mySurface; this.Direction = directionFacing; this.crashLanded = !this.parent.AddObject(this, startingPosition); }
public void Flee(float pace) { Heading = -1 * (pursuer.transform.position - this.transform.position); Heading.Normalize(); this.gameObject.transform.Translate(Heading * Traits[2] * pace / 50f, Space.World); }
public Player(PlayerIndex playerIndex, Team team, Vector2 submatrix, CourtPosition position) : base() { this.playerIndex = playerIndex; this.team = team; spriteSubmatrix = submatrix; heading = Heading.Forward; courtPosition = position; switch (position) { case CourtPosition.TopLeft: x = 15; y = 65; break; case CourtPosition.TopRight: x = 414; y = 65; break; case CourtPosition.BottomLeft: x = 15; y = 180; break; case CourtPosition.BottomRight: x = 414; y = 180; break; } maxSpeed = MAX_RUN_SPEED; drag = new Vector2(CONTROL_DRAG,CONTROL_DRAG); loadGraphic("player", 34, 34); characterOffset.X = submatrix.X * atlas.Width / 2; characterOffset.Y = submatrix.Y * atlas.Height / 2; sheetOffset.X = characterOffset.X; playerGlow = new PlayerGlow(this); G.state.add(playerGlow); addAnimation("idle", new List<int> { 0, 1, 2, 3 }, 10, true); addAnimation("runForward", new List<int> { 12, 13, 14, 15 }, 15, true); addAnimation("runBackward", new List<int> { 16, 17, 18, 19 }, 15, true); addAnimation("runUpForward", new List<int> { 4, 5, 6, 7 }, 15, true); addAnimation("runDownForward", new List<int> { 8, 9, 10, 11 }, 15, true); addAnimation("runUpBackward", new List<int> { 8, 11, 10, 9 }, 15, true); addAnimation("runDownBackward", new List<int> { 6, 5, 4, 7 }, 15, true); addAnimation("throw", new List<int> { 0, 1, 2, 3 }, 10, false); addAnimation("throwReturn", new List<int> { 4, 4 }, 20, false); addAnimationCallback("throw", onThrowCallback); addOnCompleteCallback("throw", onThrowCompleteCallback); addOnCompleteCallback("throwReturn", onThrowReturnCompleteCallback); addAnimation("hurt", new List<int> { 5 }); addAnimation("hurtFall", new List<int> { 6, 7 }, 10, false); addAnimation("hurtRecover", new List<int> { 8, 8 }, 20, false); addOnCompleteCallback("hurtRecover", onHurtRecoverCompleteCallback); addAnimationCallback("hurtFall", onHurtFallCallback); addAnimation("parry", new List<int> { 10, 9, 9, 10 }, 40, false); addAnimation("parryReturn", new List<int> { 10, 10 }, 20, false); addOnCompleteCallback("parryReturn", onParryReturn); throwOffsets[(int)Heading.Up] = new Vector2[3] { new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0) }; throwOffsets[(int)Heading.UpMid] = new Vector2[3] { new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0) }; throwOffsets[(int)Heading.Forward] = new Vector2[3] { new Vector2(1, 0), new Vector2(3, 0), new Vector2(1, 0) }; throwOffsets[(int)Heading.DownMid] = new Vector2[3] { new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0) }; throwOffsets[(int)Heading.Down] = new Vector2[3] { new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0) }; //We can change this to use Heading later if needed fallOffsets = new Vector2[2] { new Vector2(-4, 0), new Vector2(-11, 0) }; //No actual hit yet, this should substitute for now addAnimation("hit", new List<int> { 12, 13, 14, 15 }, 60, true); height = 22; offset.Y = -5; width = 18; offset.X = -9; shadow = new PlayerShadow(this); G.state.add(shadow); retical = new Retical(playerIndex, team); retical.visible = false; G.state.add(retical); blood = new BloodSpatter(this); G.state.add(blood); play("idle"); }
public void MoveTowards(Vector3 position, float pace) { Heading = position - this.transform.position; Heading.Normalize(); this.gameObject.transform.Translate(Heading * Traits[2] * pace / 50f, Space.World); }