private void ProcessStep() { pMain.Visible = pInputForms.Visible = false; UITools.ShowToolBarButton(MainToolBar, "Apply"); UITools.ShowToolBarButton(MainToolBar, "Prev"); UITools.ShowToolBarButton(MainToolBar, "Next"); switch (Step) { case StepEnum.MainInfo: lbWizardTitle.Text = "Item categorization"; pMain.Visible = true; StepNumber = 1; UITools.HideToolBarButton(MainToolBar, "Apply"); UITools.HideToolBarButton(MainToolBar, "Prev"); RetrievePossibleParents(); break; case StepEnum.InputFormsInfo: lbWizardTitle.Text = "Inputforms attached"; pInputForms.Visible = true; UITools.HideToolBarButton(MainToolBar, "Next"); InputFormsInfo(); break; } if (Step != StepEnum.MainInfo) { lbWizardTitle.Text = lbWizardTitle.Text + " [step " + StepNumber.ToString() + "/" + NbSteps.ToString() + "]"; } }
public override void WriterAddAttribute(XmlWriter writer) { writer.WriteAttributeString("FirstNumber", FirstNumber.ToString()); writer.WriteAttributeString("LastNumber", LastNumber.ToString()); writer.WriteAttributeString("StepNumber", StepNumber.ToString()); base.WriterAddAttribute(writer); }
/// <summary> /// Задает значения по умолчанию (значения по варианту). /// </summary> private void DefaultValues_Click(object sender, EventArgs e) { RangeFrom = 0; RangeFromTextBox.Text = RangeFrom.ToString(); RangeFromChecked = true; RangeTo = 0.05; RangeToTextBox.Text = RangeTo.ToString(); RangeToChecked = true; StepNumber = 100; StepNumberTextBox.Text = StepNumber.ToString(); StepNumberChecked = true; InitialCondition = 0; InitialConditionTextBox.Text = InitialCondition.ToString(); InitialConditionChecked = true; Resistance = 1000; ResistanceTextBox.Text = Resistance.ToString(); ResistanceChecked = true; Capacity = Math.Pow(10, -5); CapacityTextBox.Text = Capacity.ToString(); CapacityChecked = true; Voltage = 10; VoltageTextBox.Text = Voltage.ToString(); VoltageChecked = true; }
/// <summary> /// Возращает путь на диске, где можно сохранять любые файлы, необходимые для логики отката шага транзакции /// </summary> /// <returns>Путь к папке с файлами</returns> public string GetPath(string transactionsPath) { //string transactionsPath = context.ExecutedPackage.TransactionsPath; string transactionPath = Path.Combine(transactionsPath, TransactionName); string stepsPath = Path.Combine(transactionPath, STEPS_SUBFOLDER_NAME); string stepPath = Path.Combine(stepsPath, StepNumber.ToString()); if (!Directory.Exists(stepPath)) { Directory.CreateDirectory(stepPath); } return(stepPath); }
private void UpdateFormVisuals() { lblGen.Text = StepNumber.ToString(); lblPop.Text = _lifeGame.LiveCellCount.ToString(); grdLife.UpdateGrid(_lifeGame.CurrentStates); if (InfiniteLoops == false && _lifeGame.LastStates.Count == 10) { if (_lifeGame.ShortStop) { //the game is in an infinite loop. stop it _timer.Stop(); _lifeGame.LastStates.Clear(); MessageBox.Show("Ending because it will continue repeating as it is forever!"); } } }
protected override void OnLoad(EventArgs e) { // startup init script WetControls.Extensions.ClientScript.InitScript(Page); // datepicker script if (IsDate) { WetControls.Extensions.ClientScript.InitDatePicker(this.Page); } // gouvernment email script if (IsGovernmentEmail) { WetControls.Extensions.ClientScript.InitFrmvldGovemail(this.Page, this.ErrorGovEmail); } // price script if (IsPrice) { WetControls.Extensions.ClientScript.InitFrmvldPrice(this.Page, this.ErrorPrice); } if (EnableClientValidation) { // attributes validation conflicts VerifyValidationConflicts(); if (IsRequired) { base.Attributes.Add("required", "required"); } if (IsPhoneNumber) { base.Attributes.Add("data-rule-phoneUS", "true"); } if (IsPostalCode) { base.Attributes.Add("size", "7"); base.Attributes.Add("data-rule-postalCodeCA", "true"); } if (IsEmail) { base.Attributes.Add("type", "email"); } if (IsGovernmentEmail) { base.Attributes.Add("data-rule-govemail", "true"); } if (IsUrl) { base.Attributes.Add("type", "url"); } if (IsDate) { base.Attributes.Add("type", "date"); base.Attributes.Add("data-rule-dateISO", "true"); } if (IsTime) { base.Attributes.Add("type", "time"); } if (IsAlphanumeric) { base.Attributes.Add("pattern", "[A-Za-z0-9_\\s]"); base.Attributes.Add("data-rule-alphanumeric", "true"); } if (IsDigitsOnly) { base.Attributes.Add("type", "number"); base.Attributes.Add("data-rule-digits", "true"); } if (IsPrice) { base.Attributes.Add("data-rule-price", "true"); } if (IsLettersOnly) { base.Attributes.Add("pattern", "[A-Za-z\\s]"); base.Attributes.Add("data-rule-lettersonly", "true"); } if (IsLettersWithBasicPunc) { base.Attributes.Add("pattern", "[A-Za-z-.,()'\"\\s]"); base.Attributes.Add("data-rule-letterswithbasicpunc", "true"); } if (IsNoWhiteSpace) { base.Attributes.Add("pattern", "[A-Za-z-.,()'\"\\s]"); base.Attributes.Add("data-rule-nowhitespace", "true"); } if (IsNumber) { base.Attributes.Add("type", "number"); } if (MinNumber != 0 && MaxNumber != 0) { base.Attributes.Add("data-rule-range", string.Format("[{0},{1}]", MinNumber, MaxNumber)); } else if (MinNumber != 0) { base.Attributes.Add("min", MinNumber.ToString()); } else if (MaxNumber != 0) { base.Attributes.Add("max", MaxNumber.ToString()); } if (StepNumber != 0) { base.Attributes.Add("step", StepNumber.ToString()); } if (MinLength > 0 && MaxLength > 0) { base.Attributes.Add("data-rule-rangelength", string.Format("[{0},{1}]", MinLength, MaxLength)); } else if (MinLength > 0) { base.Attributes.Add("data-rule-minlength", MinLength.ToString()); } else if (MaxLength > 0) { base.Attributes.Add("maxlength", MaxLength.ToString()); } if (MinWords > 0 && MaxWords > 0) { base.Attributes.Add("data-rule-rangeWords", string.Format("[{0},{1}]", MinWords, MaxWords)); } else if (MinWords > 0) { base.Attributes.Add("data-rule-minWords", MinWords.ToString()); } else if (MaxWords > 0) { base.Attributes.Add("data-rule-maxWords", MaxWords.ToString()); } if (!string.IsNullOrEmpty(EqualTo)) { Control ctrl = Page.FindControlRecursive(EqualTo.TrimStart('#')); // prevent tag at beginning base.Attributes.Add("data-rule-equalTo", (ctrl == null ? "#" + EqualTo : "#" + ctrl.ClientID)); } if (!string.IsNullOrEmpty(ValidationErrorMsg)) { base.Attributes.Add("data-msg", ValidationErrorMsg); } } if (!string.IsNullOrEmpty(Placeholder)) { base.Attributes.Add("placeholder", Placeholder); } base.OnLoad(e); }
public string PrintPageComSelenium(IWebDriver driver, bool full = false, int sleep = 0) { try { if (sleep > 0) { System.Threading.Thread.Sleep(sleep * 1000); } //Create base directory and set image filename string printPath = GetAppPath() + "/Prints" + "/" + CustomerName + "/" + RptID.ToString() + "/" + SuiteName + "/" + ScenarioName + "/" + TestName; if (!Directory.Exists(printPath)) { Directory.CreateDirectory(printPath); } string filename = printPath + "/" + StepNumber.ToString().PadLeft(4, '0') + "_" + StepTurn.ToString().PadLeft(2, '0') + "-" + TestName.Replace("-", "_") + ".png"; if (File.Exists(filename)) { File.Delete(filename); } if (full) { /* * Dispositivo Width X Heigh * Reponsive 400 X 1397 * Galaxy S5 360 X 640 * Pixel 2 411 X 731 * Pixel 2 XL 411 X 823 * iPhone 5/SE 320 X 568 * iPhone 6/7/8 375 X 667 * iPhone 6/7/8 Plus 414 X 736 * iPhone X 375 X 812 * iPad 768 X 1024 * iPad Pro 1024 X 1366 */ Bitmap stitchedImage = null; // First scroll to load all page components ((IJavaScriptExecutor)driver).ExecuteScript(String.Format("window.scrollBy({0}, {1})", 0, -100000)); for (int p = 0; p < 200; p++) { ((IJavaScriptExecutor)driver).ExecuteScript(String.Format("window.scrollBy({0}, {1})", 0, 500)); System.Threading.Thread.Sleep(5); } ((IJavaScriptExecutor)driver).ExecuteScript(String.Format("window.scrollBy({0}, {1})", 0, -100000)); System.Threading.Thread.Sleep(200); // Get full page size long totalwidth1 = (long)((IJavaScriptExecutor)driver).ExecuteScript("return document.body.offsetWidth");//documentElement.scrollWidth"); long totalHeight1 = (long)((IJavaScriptExecutor)driver).ExecuteScript("return document.body.parentNode.scrollHeight"); int totalWidth = (int)totalwidth1; int totalHeight = (int)totalHeight1; // Get viewport size long viewportWidth1 = (long)((IJavaScriptExecutor)driver).ExecuteScript("return document.body.clientWidth"); //documentElement.scrollWidth"); long viewportHeight1 = (long)((IJavaScriptExecutor)driver).ExecuteScript("return window.innerHeight"); //documentElement.scrollWidth"); int viewportWidth = (int)viewportWidth1; int viewportHeight = (int)viewportHeight1; // Split screen in multiple rectangles List <Rectangle> rectangles = new List <Rectangle>(); // Loop until total height for (int i = 0; i < totalHeight; i += viewportHeight) { int newHeight = viewportHeight; // Fix if element height too big if (i + viewportHeight > totalHeight) { newHeight = totalHeight - i; } // Loop until total width for (int ii = 0; ii < totalWidth; ii += viewportWidth) { int newWidth = viewportWidth; // Fix if element width too big if (ii + viewportWidth > totalWidth) { newWidth = totalWidth - ii; } // Create and add new rectangle Rectangle currRect = new Rectangle(ii, i, newWidth, newHeight); rectangles.Add(currRect); } } // Build image stitchedImage = new Bitmap(totalWidth, totalHeight); // Get all screenshots together Rectangle previous = Rectangle.Empty; foreach (var rectangle in rectangles) { // Calculate needed scrolling if (previous != Rectangle.Empty) { int xDiff = rectangle.Right - previous.Right; int yDiff = rectangle.Bottom - previous.Bottom; ((IJavaScriptExecutor)driver).ExecuteScript(String.Format("window.scrollBy({0}, {1})", xDiff, yDiff)); System.Threading.Thread.Sleep(200); } // Take screenshot var screenshot = ((ITakesScreenshot)driver).GetScreenshot(); // Build an image from the screenshot Image screenshotImage; using (MemoryStream memStream = new MemoryStream(screenshot.AsByteArray)) { screenshotImage = Image.FromStream(memStream); } // Calculate source rectangle Rectangle sourceRectangle = new Rectangle(viewportWidth - rectangle.Width, viewportHeight - rectangle.Height, rectangle.Width, rectangle.Height); // Copy image using (Graphics g = Graphics.FromImage(stitchedImage)) { g.DrawImage(screenshotImage, rectangle, sourceRectangle, GraphicsUnit.Pixel); } // Set previous rectangle previous = rectangle; } // Save image file stitchedImage.Save(filename, ImageFormat.Png); } else { Screenshot ss = ((ITakesScreenshot)driver).GetScreenshot(); ss.SaveAsFile(filename, ScreenshotImageFormat.Png); } return(filename); } catch (Exception ex) { Print("Exception at PrintPageComSelenium", ex); return(null); } }
void UpdateDisplay() { timeText.text = timeElapsed.ToString(); stepText.text = StepNumber.ToString(); }
public virtual string[] DeriveKeys() { return(new string[] { ParentAction.Id.ToString(), Stage.ToString(), StepNumber.ToString() }); }