public static void Upload(ClientPipelineArgs args, Edit fileEdit) { try { CheckPackageFolder(); if (!args.IsPostBack) { UploadPackageForm.Show(ApplicationContext.PackagePath, true); args.WaitForPostBack(); } else { if (args.Result.StartsWith("ok:", StringComparison.InvariantCulture)) { string[] strArray = args.Result.Substring("ok:".Length).Split('|'); if (strArray.Length >= 1 && fileEdit != null) { fileEdit.Value = strArray[0]; } } } } catch (Exception ex) { Log.Error(ex.Message, typeof(DialogUtils)); SheerResponse.Alert(ex.Message); } }
protected void OnItemSaved(object sender, EventArgs args) { CustomItemSettings settings = new CustomItemSettings(HttpContext.Current); // Only continue if we have valid args, auto update is set to true, and the file exists already if (args != null && settings.AutoUpdate) { // Get the template destination Item _temp = masterDb.GetItem(GetCurrentContentGuid()); if (_temp != null) { string file_path = FileUtil.GetClassFilePath(CodeUtil.GetClassNameForTemplate(_temp), settings.BaseFileOutputPath); // Make sure the template already exists if (File.Exists(file_path)) { // Set these up since we don't have the editor open CustomItemNamespace = new Edit(); CustomItemFilePath = new Edit(); // Call the current code beside OnLoad(args); OnOK(sender, args); } } } return; }
public void Edit() { // Arrange var organisation = new OrganisationBuilder(this.Session).Build(); this.Session.Derive(); this.Session.Commit(); var edit = new Edit { Id = organisation.Id.ToString(), Description = "Hello", Owner = new Select(), Werknemers = new MultipleSelect() }; var controller = new OrganisationController { AllorsSession = this.Session }; // Act var viewResult = (ViewResult)controller.Edit(edit, Command.Save); // Assert viewResult.TempData.Count.ShouldEqual(0); organisation.Description.ShouldEqual("Hello"); }
public ActionResult Edit(string id) { var organisation = (Organisation)this.AllorsSession.Instantiate(id); var model = new Edit(); this.Map(model, organisation); return this.View(model); }
// GET: /Student/Edit/5 public async Task<ActionResult> Edit(Edit.Query query) { var student = await _mediator.SendAsync(query); if (student == null) { return HttpNotFound(); } return View(student); }
/// <summary> /// Add an edit operation to this transaction /// </summary> /// <param name = "edit">Edit to add</param> public override void AddEdit(Edit edit) { #if DEBUG if (!(edit is Transaction)) throw new InvalidOperationException("Only transaction edits can be added to an UndoRedoSession"); #endif base.AddEdit(edit); RaiseHistoryChanged(); }
public UserPicker() { Viewer = new Edit(); Viewer.ReadOnly = true; Viewer.Class = "scUserPickerEdit textEdit clrString"; PickButton = new Button(); PickButton.Header = "..."; PickButton.Class = "scUserPickerButton"; Controls.Add(Viewer); Controls.Add(PickButton); }
private static int CompareEdits(Edit left, Edit right) { int res = right.Position - left.Position; if (res == 0) { if (left is InsertionEdit) { if (right is DeletionEdit) { res = 1; } } else if (right is InsertionEdit) { res = -1; } } return res; }
public void Add(Edit Edit) { try { lock (List) { List.Add(new EditItem(Edit._Page, Edit)); } } catch (Exception fail) { Core.ExceptionHandler(fail); } }
public UserPicker() { Viewer = new Edit { ReadOnly = true, Class = "scUserPickerEdit textEdit clrString", ID = GetUniqueID("edit_") }; PickButton = new Button { Header = "...", Class = "scUserPickerButton" }; Controls.Add(Viewer); Controls.Add(PickButton); }
public ItemSelector() : base() { e = new Edit(); e.ReadOnly = true; e.Width = new System.Web.UI.WebControls.Unit(60, System.Web.UI.WebControls.UnitType.Percentage); Literal l = new Literal(); l.Text = " "; b = new Button(); b.Header = "select..."; this.Controls.Add(e); this.Controls.Add(l); this.Controls.Add(b); }
private void button_change_Click(object sender, EventArgs e) { if (textBox_pass.Text.Equals(textBox_conpass.Text)) { Edit ed = new Edit(); ed.changePassword(Username, textBox_pass.Text); MessageBox.Show("Your Password has been updated!!!"); this.Hide(); Profile pf = new Profile(Username); pf.Show(); } else { MessageBox.Show("Password Didnt Match !!!"); } }
public ItemSelector() : base() { e = new InputBox(); e.ReadOnly = true; e.Width = new System.Web.UI.WebControls.Unit(60, System.Web.UI.WebControls.UnitType.Percentage); e.Float = "left"; e.Style.Add("margin-right", "10px"); e.Style.Add("margin-bottom", "20px"); e.Attributes.Add("id", e.ID); e.ID = Control.GetUniqueID("input"); this.ID = e.ID; Literal l = new Literal(); l.Text = " "; b = new Button(); b.Header = "select..."; this.Controls.Add(e); this.Controls.Add(l); this.Controls.Add(b); }
private void button_Edit_Click(object sender, EventArgs e) { DataShow ds = new DataShow(); String dob = comboBox_date.Text + " " + comboBox_month.Text + " " + comboBox_year.Text; String gender = ""; if (radioButton_male.Checked) { gender = "Male"; } else { gender = "Female"; } Edit ed = new Edit(); username=ed.editData(textBox_username.Text, textBox_name.Text, textBox_designation.Text, textBox_email.Text, textBox_phonenumber.Text, richTextBox_address.Text,dob,gender); MessageBox.Show("Your Information is updated!!!"); Edit_Profile_Load(sender,e); }
public void AcrylicRendering_LuminosityBlend() { if (!OnRS2OrGreater()) { return; } if (PlatformConfiguration.IsDevice(DeviceType.Phone)) { Log.Warning("Test is disabled on phone due to Bug 10952754: [Watson Failure] caused by NULL_CLASS_PTR_READ_c0000005_Windows.UI.Xaml.dll!RenderTargetBitmapImplUsingSpriteVisuals::PostDraw."); return; } using (var setup = new TestSetupHelper(new[] { "Acrylic Tests", "navigateToRenderingAcrylic" })) { var result = new Edit(FindElement.ById("TestResult")); using (var waiter = new ValueChangedEventWaiter(result)) { Button setLuminosityBlendButton = new Button(FindElement.ById("SetLuminosityButton")); setLuminosityBlendButton.Invoke(); waiter.Wait(); } LogResult(result, "SetLuminosityBlend"); using (var waiter = new ValueChangedEventWaiter(result)) { Button unsetLuminosityBlendButton = new Button(FindElement.ById("UnsetLuminosityButton")); unsetLuminosityBlendButton.Invoke(); waiter.Wait(); } LogResult(result, "ClearLuminosityBlend"); } }
public IActionResult Edit(Edit mdl) { Movie mID = _session.Get <Movie>(mdl.Id); Review review = mID.Reviews.SingleOrDefault(r => r.User.Id == _context.UserId); using (var txn = _session.BeginTransaction()) { mID.Id = mdl.Id; mID.MovieName = mdl.MovieName; mID.LengthInMin = mdl.LengthInMin; mID.Summary = mdl.Summary; mID.Year = mdl.Year; mID.Genre = mdl.Genre; mID.ContentRating = mdl.ContentRating; mID.Language = mdl.Language; review.Rating = mdl.Rating; review.ReviewText = mdl.ReviewText; //_session.SaveOrUpdate(mID); _session.Flush(); txn.Commit(); } return(RedirectToAction("Index")); }
public static void Browse(ClientPipelineArgs args, Edit fileEdit) { try { CheckPackageFolder(); if (args.IsPostBack) { if (args.HasResult && fileEdit != null) { fileEdit.Value = args.Result; } } else { BrowseDialog.BrowseForOpen(ApplicationContext.PackagePath, "*.zip", "Choose Package", "Click the package that you want to install and then click Open.", "People/16x16/box.png"); args.WaitForPostBack(); } } catch (Exception ex) { Log.Error(ex.Message, typeof(DialogUtils)); SheerResponse.Alert(ex.Message); } }
public void SimpleTestMethod2() { var inputStepFrequency = new Edit(FindElement.ById("inputStepFrequency")); var inputMinimum = new Edit(FindElement.ById("inputMinimum")); var inputRangeStart = new Edit(FindElement.ById("inputRangeStart")); var inputRangeEnd = new Edit(FindElement.ById("inputRangeEnd")); var inputMaximum = new Edit(FindElement.ById("inputMaximum")); var submitStepFrequency = new Button(FindElement.ById("submitStepFrequency")); var submitMinimum = new Button(FindElement.ById("submitMinimum")); var submitRangeStart = new Button(FindElement.ById("submitRangeStart")); var submitRangeEnd = new Button(FindElement.ById("submitRangeEnd")); var submitMaximum = new Button(FindElement.ById("submitMaximum")); var submitAll = new Button(FindElement.ById("submitAll")); KeyboardHelper.EnterText(inputStepFrequency, "1"); KeyboardHelper.EnterText(inputMinimum, "0"); KeyboardHelper.EnterText(inputRangeStart, "10"); KeyboardHelper.EnterText(inputRangeEnd, "90"); KeyboardHelper.EnterText(inputMaximum, "100"); submitAll.Click(); Wait.ForIdle(); var currentStepFrequency = new TextBlock(FindElement.ById("currentStepFrequency")); var currentMinimum = new TextBlock(FindElement.ById("currentMinimum")); var currentRangeStart = new TextBlock(FindElement.ById("currentRangeStart")); var currentRangeEnd = new TextBlock(FindElement.ById("currentRangeEnd")); var currentMaximum = new TextBlock(FindElement.ById("currentMaximum")); Verify.AreEqual("1", currentStepFrequency.GetText()); Verify.AreEqual("0", currentMinimum.GetText()); Verify.AreEqual("10", currentRangeStart.GetText()); Verify.AreEqual("90", currentRangeEnd.GetText()); Verify.AreEqual("100", currentMaximum.GetText()); }
public void BasicAcrylicOnRectangle() { if (!OnRS2OrGreater()) { return; } using (IDisposable page1 = new TestSetupHelper("Acrylic Tests"), page2 = new TestSetupHelper("navigateToBasicAcrylic")) { ChooseFromComboBox("TestNameComboBox", "BasicAcrylicOnRectangle"); var result = new Edit(FindElement.ById("TestResult")); using (var waiter = new ValueChangedEventWaiter(result)) { Button runTestButton = new Button(FindElement.ById("RunTestButton")); runTestButton.Invoke(); LogBrushSate(); waiter.Wait(); } Verify.AreEqual(result.Value, "BasicAcrylicOnRectangle: Passed"); } }
public void AcrylicFromMarkup() { if (!OnRS2OrGreater()) { return; } using (var setup = new TestSetupHelper(new[] { "Acrylic Tests", "navigateToMarkupAcrylic" })) { var result = new Edit(FindElement.ById("TestResult")); using (var waiter = new ValueChangedEventWaiter(result)) { Button runTestButton = new Button(FindElement.ById("RunTestButton")); runTestButton.Invoke(); LogBrushSate(); if (result.Value.Equals("AcrylicFromMarkup: Skipped")) { Log.Error("Error: FallbackBrush in use - expecting effect brush"); return; } waiter.Wait(); } if (PlatformConfiguration.IsDevice(DeviceType.Phone)) { // On Phone, HostBackdrop validation will fail since Comp will just render black Verify.AreEqual(result.Value, "AcrylicFromMarkup: Failed (True,False,True)"); } else { Verify.AreEqual(result.Value, "AcrylicFromMarkup: Passed"); } } }
public void VerifyOpaqueTintOptimization() { if (!OnRS2OrGreater()) { return; } // Opaque Tint Optimization removed with Luminosity-based Acrylic recipe added in 19H1 if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.NineteenH1)) { return; } using (var setup = new TestSetupHelper(new[] { "Acrylic Tests", "navigateToBasicAcrylic" })) { ChooseFromComboBox("TestNameComboBox", "VerifyOpaqueTintOptimization"); var result = new Edit(FindElement.ById("TestResult")); using (var waiter = new ValueChangedEventWaiter(result)) { Button runTestButton = new Button(FindElement.ById("RunTestButton")); runTestButton.Invoke(); LogBrushSate(); if (result.Value.Equals("VerifyOpaqueTintOptimization: Skipped")) { Log.Error("Error: FallbackBrush in use - expecting effect brush"); return; } waiter.Wait(); } Verify.AreEqual(result.Value, "VerifyOpaqueTintOptimization: Passed"); } }
public Control MakeControl() { Control input = null; if (this.Type == "Text") { input = new Edit(); input.ID = Control.GetUniqueID("input"); } else if (this.Type == "Dropdown") { Combobox c = new Combobox(); foreach (var value in this.PossibleValues()) { ListItem li = new ListItem(); li.Header = value.Name; li.Value = value.Value; c.Controls.Add(li); } input = c; input.ID = Control.GetUniqueID("input"); } else if (this.Type == "Item Selector") { ASR.Controls.ItemSelector iSelect = new ASR.Controls.ItemSelector(); input = iSelect; input.ID = Control.GetUniqueID("input"); iSelect.Click = string.Concat("itemselector", ":", input.ID); if (this.Parameters["root"] != null) iSelect.Root = this.Parameters["root"]; if (this.Parameters["folder"] != null) iSelect.Folder = this.Parameters["folder"]; if (this.Parameters["displayresult"] != null) iSelect.DisplayValueType = (ASR.Controls.ItemInfo)Enum.Parse(typeof(ASR.Controls.ItemInfo), this.Parameters["displayresult"].ToString()); if (this.Parameters["valueresult"] != null) iSelect.ValueType = (ASR.Controls.ItemInfo)Enum.Parse(typeof(ASR.Controls.ItemInfo), this.Parameters["valueresult"].ToString()); if (this.Parameters["filter"] != null) iSelect.Filter = this.Parameters["filter"]; } else if (this.Type == "User Selector") { ASR.Controls.UserSelector uSelect = new ASR.Controls.UserSelector(); input = uSelect; input.ID = Control.GetUniqueID("input"); uSelect.Click = string.Concat("itemselector", ":", input.ID); if (this.Parameters["filter"] != null) uSelect.Filter = this.Parameters["filter"]; } else if (this.Type == "Date picker") { var dtPicker = new ASR.Controls.DateTimePicker(); dtPicker.Style.Add("float", "left"); dtPicker.ID = Sitecore.Web.UI.HtmlControls.Control.GetUniqueID("input"); dtPicker.Click = "datepicker" + ":" + dtPicker.ID; if (this.Parameters["Format"] != null) dtPicker.Format = this.Parameters["Format"]; input = dtPicker; } //input.ID = Control.GetUniqueID("input"); input.Value = this.Value; return input; }
public ActionResult Edit(Edit model, Command? command) { if (command == Command.Cancel) { return this.RedirectToRoute("Default", new { controller = "Organisation", action = "Index" }); } var organisation = (Organisation)this.AllorsSession.Instantiate(model.Id); var currentCultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; var currentUICultureInfo = System.Threading.Thread.CurrentThread.CurrentUICulture; if (command == Command.Save) { if (this.ModelState.IsValid) { organisation.Name = model.Name; organisation.Description = model.Description; organisation.Information = model.Information; organisation.Incorporated = model.Incorporated; organisation.IncorporationDate = model.IncorporationDate.HasValue ? model.IncorporationDate.Value.ToUniversalTime() : (DateTime?)null; organisation.Owner = (Person)this.AllorsSession.Instantiate(model.Owner.Id); organisation.Employees = model.Werknemers != null ? this.AllorsSession.Instantiate(model.Werknemers.Ids) : null; if (model.Logo.PostedFile != null) { if (organisation.ExistLogo) { organisation.Logo.Delete(); } var media = new MediaBuilder(this.AllorsSession).WithContent(model.Logo.PostedFile.GetContent()).Build(); var image = new ImageBuilder(this.AllorsSession).WithOriginalFilename(model.Logo.PostedFile.FileName).WithOriginal(media).Build(); organisation.Logo = image; } if (model.Images.PostedFile != null) { var media = new MediaBuilder(this.AllorsSession).WithContent(model.Images.PostedFile.GetContent()).Build(); var image = new ImageBuilder(this.AllorsSession).WithOriginalFilename(model.Images.PostedFile.FileName).WithOriginal(media).Build(); organisation.AddImage(image); } foreach (var item in model.Images.Items) { if (item.Delete) { var image = (Image)this.AllorsSession.Instantiate(item.Id); image.Delete(); } } var derivationLog = this.AllorsSession.Derive(); if (derivationLog.HasErrors) { foreach (var error in derivationLog.Errors) { this.ModelState.AddModelError(string.Empty, error.Message); } } else { this.AllorsSession.Commit(); this.ModelState.Clear(); } } } this.Map(model, organisation); return this.View(model); }
private void Map(Edit edit, Organisation organisation) { if (organisation != null) { edit.Id = organisation.Id.ToString(); edit.Name = organisation.Name; edit.Description = organisation.Description; edit.Information = organisation.Information; edit.Incorporated = organisation.Incorporated; edit.IncorporationDate = organisation.IncorporationDate; edit.EmployeeCount = organisation.Employees.Count; edit.Owner = new Select { Id = organisation.ExistOwner ? organisation.Owner.Id.ToString() : "0", List = new[] { new SelectListItem { Value = "0" } } .Concat(this.AllorsSession.Extent<Person>().Select(x => new SelectListItem { Text = x.UserName, Value = x.Id.ToString(), })) .ToArray() }; edit.Werknemers = new MultipleSelect { Ids = organisation.Employees.Select(x => x.Id.ToString()).ToArray(), List = this.AllorsSession.Extent<Person>().Select(x => new SelectListItem { Text = x.UserName, Value = x.Id.ToString(), }).ToArray() }; edit.Logo = new ImageModel { UniqueId = organisation.ExistLogo ? organisation.Logo.Thumbnail.UniqueId.ToString("N") : null, FileName = organisation.ExistLogo ? organisation.Logo.OriginalFilename : null }; edit.Images = new ImagesModel { Items = organisation.Images.Select(x => new ImagesItemModel { Id = x.Id.ToString(), UniqueId = x.Thumbnail.UniqueId.ToString("N"), FileName = x.OriginalFilename }).ToArray() }; } }
public void TopNavigationSelectionTest() { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", "Top NavigationView Test" })) { if (!PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone2)) { Log.Warning("Skipping: only works in RS2 and above"); return; } Button resetResultButton = new Button(FindElement.ById("ResetResult")); UIObject home = FindElement.ByName("Home"); UIObject apps = FindElement.ById("AppsItem"); UIObject suppressSelection = FindElement.ByName("SuppressSelection"); var invokeResult = new Edit(FindElement.ById("ItemInvokedResult")); var selectResult = new Edit(FindElement.ById("SelectionChangedResult")); var invokeRecommendedTransition = new Edit(FindElement.ById("InvokeRecommendedTransition")); var selectionChangeRecommendedTransition = new Edit(FindElement.ById("SelectionChangeRecommendedTransition")); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { apps.Click(); waiter.Wait(); } // First time selection raise ItemInvoke and SelectionChange events Verify.AreEqual(invokeResult.Value, "Apps"); Verify.AreEqual(selectResult.Value, "Apps"); Verify.AreEqual(invokeRecommendedTransition.Value, "Default"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, "Default"); resetResultButton.Click(); Wait.ForIdle(); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { apps.Click(); waiter.Wait(); } // Click it again, only raise ItemInvoke event Verify.AreEqual(invokeResult.Value, "Apps"); Verify.AreEqual(selectResult.Value, ""); Verify.AreEqual(invokeRecommendedTransition.Value, "Default"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, ""); resetResultButton.Click(); Wait.ForIdle(); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { suppressSelection.Click(); waiter.Wait(); } // Only click for suppress items Verify.AreEqual(invokeResult.Value, "SuppressSelection"); Verify.AreEqual(selectResult.Value, ""); Verify.AreEqual(invokeRecommendedTransition.Value, "Default"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, ""); using (var waiter = new ValueChangedEventWaiter(invokeResult)) { home.Click(); waiter.Wait(); } // Click home again, it raise two events. transition from right to left Verify.AreEqual(invokeResult.Value, "Home"); Verify.AreEqual(selectResult.Value, "Home"); // Only RS5 or above supports SlideNavigationTransitionInfo if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5)) { Verify.AreEqual(invokeRecommendedTransition.Value, "FromLeft"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, "FromLeft"); } resetResultButton.Click(); Wait.ForIdle(); // click apps again. transition from left to right using (var waiter = new ValueChangedEventWaiter(invokeResult)) { apps.Click(); waiter.Wait(); } Verify.AreEqual(invokeResult.Value, "Apps"); Verify.AreEqual(selectResult.Value, "Apps"); // Only RS5 or above supports SlideNavigationTransitionInfo if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5)) { Verify.AreEqual(invokeRecommendedTransition.Value, "FromRight"); Verify.AreEqual(selectionChangeRecommendedTransition.Value, "FromRight"); } } }
public void testType_Delete() { Edit e = new Edit(1, 2, 1, 1); Assert.AreEqual(Edit.Type.DELETE, e.EditType); }
public void testToString() { Edit e = new Edit(1, 2, 1, 4); Assert.AreEqual("REPLACE(1-2,1-4)", e.ToString()); }
Stack <Edit> futureEdits = new Stack <Edit>(); //Edits that can be redone from the current edit //Stores Edit information public void trackEdit(Edit edit) { pastEdits.Push(edit); futureEdits.Clear(); }
public static void PerformHumanAction(this Edit edit, Action <Edit> action) { action(edit); Thread.Sleep(HumanTimeSpan); }
protected override bool TryGetDeclarationBodyEdit(Edit<SyntaxNode> edit, Dictionary<SyntaxNode, EditKind> editMap, out SyntaxNode oldBody, out SyntaxNode newBody) { // Detect a transition between a property/indexer with an expression body and with an explicit getter. // int P => old_body; <-> int P { get { new_body } } // int this[args] => old_body; <-> int this[args] { get { new_body } } // First, return getter or expression body for property/indexer update: if (edit.Kind == EditKind.Update && (edit.OldNode.IsKind(SyntaxKind.PropertyDeclaration) || edit.OldNode.IsKind(SyntaxKind.IndexerDeclaration))) { oldBody = SyntaxUtilities.TryGetEffectiveGetterBody(edit.OldNode); newBody = SyntaxUtilities.TryGetEffectiveGetterBody(edit.NewNode); if (oldBody != null && newBody != null) { return true; } } // Second, ignore deletion of a getter body: if (IsGetterToExpressionBodyTransformation(edit.Kind, edit.OldNode ?? edit.NewNode, editMap)) { oldBody = newBody = null; return false; } return base.TryGetDeclarationBodyEdit(edit, editMap, out oldBody, out newBody); }
private void btnSimpan_Click(object sender, EventArgs e) { Edit.EditData(tbNama.Text, tbDeadline.Text, tbKateg.Text, tbDesk.Text, tbCariId.Text); MessageBox.Show("Tugas berhasil diedit"); this.Close(); }
public void VerifyLightDismissDoesntSendDuplicateEvents() { var testScenarios = RegressionTestScenario.BuildLeftNavRegressionTestScenarios(); foreach (var testScenario in testScenarios) { using (var setup = new TestSetupHelper(new[] { "NavigationView Tests", testScenario.TestPageName })) { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone3)) { Log.Warning("Test is disabled on RS2 and older due to lack of SplitView events"); return; } CheckBox isPaneOpenCheckBox = new CheckBox(FindElement.ById("IsPaneOpenCheckBox")); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); SetNavViewWidth(ControlWidth.Medium); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); PaneOpenCloseTestCaseRetry(3, () => { // recover from the exception if needed if (isPaneOpenCheckBox.ToggleState != ToggleState.Off) { using (var waiter = isPaneOpenCheckBox.GetToggledWaiter()) { isPaneOpenCheckBox.Toggle(); waiter.Wait(); } WaitAndAssertPaneStatus(PaneOpenStatus.Closed); } Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False"); Log.Comment("Reset the event count"); new Button(FindElement.ById("ClosingEventCountResetButton")).Invoke(); Wait.ForIdle(); Log.Comment("Open the pane"); using (var waiter = isPaneOpenCheckBox.GetToggledWaiter()) { isPaneOpenCheckBox.Toggle(); waiter.Wait(); } WaitAndAssertPaneStatus(PaneOpenStatus.Opened); Verify.AreEqual(ToggleState.On, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be True"); var closingCounts = new Edit(FindElement.ByName("ClosingEventCountTextBlock")); var expectedString = "1-1"; // trigger a light dismiss KeyboardHelper.PressKey(Key.Left, ModifierKey.Alt); Wait.ForIdle(); WaitAndAssertPaneStatus(PaneOpenStatus.Closed); Verify.AreEqual(ToggleState.Off, isPaneOpenCheckBox.ToggleState, "IsPaneOpen expected to be False"); Verify.AreEqual(expectedString, closingCounts.GetText()); }); } } }
/// <summary> /// Add an edit operation to this transaction /// </summary> /// <param name="edit">Edit to add</param> public override void AddEdit(Edit edit) { base.AddEdit(edit); RaiseHistoryChanged(); }
public EditItem(Page __Page, Edit __Edit) { this.Edit = __Edit; this.Page = __Page; InitializeComponent(); }
public async Task<IActionResult> Edit(Edit.Command model) { await Mediator.SendAsync(model); return RedirectToAction("Index"); }
private void About_MouseClick(object sender, MouseEventArgs e) { Edit ed = new Edit(); ed.Show(); }
public void SaveEdit(object o, EventArgs e) { if (Session["currentSim"] == null) { return; } SimFileData data = (SimFileData)Session["currentSim"]; ChartData selectedData = null; foreach (ChartData cd in data.Charts) { if (cd.ChartInfo.ID == HdnChart.Value) { selectedData = cd; } } Edit edit = new Edit(); edit.New(CurrentUser); edit.Comment1 = CmbComment1.SelectedIndex; edit.Comment2 = CmbComment2.SelectedIndex; edit.Difficulty = CmbEditDifficulty.SelectedValue; edit.Name = TxtName.Text; edit.Description = TxtNotes.Text; edit.Rating = Convert.ToInt32(CmbRating.SelectedValue); edit.Style = selectedData.ChartInfo.Style.ToString(); edit.SongID = HdnSongId.Value; edit.Public = ChkPublic.Checked; edit.Video = video.Text; Song s = Song.GetSong(edit.SongID); if (!s.Confirmed) { s.FirstMeasure = first.Text.ToInt(); } int offset = s.FirstMeasure - data.FirstMeasure; if (offset > 0) { while (offset != 0) { for (int i = 0; i < 16; i++) { selectedData.TapData.Add(Arrow.None); selectedData.FreezeData.Add(Arrow.None); } offset--; } } if (offset < 0) { while (offset != 0) { selectedData.TapData.RemoveRange(0, 16); selectedData.FreezeData.RemoveRange(0, 16); offset++; } } selectedData.TapData.RemoveRange(0, 16); selectedData.FreezeData.RemoveRange(0, 16); edit.Steps = Converter.ConvertTapsToXml("STEP", selectedData.TapData).ToString() + Converter.ConvertTapsToXml("FREEZ_ARROW", selectedData.FreezeData).ToString(); edit.Stats = selectedData.GenerateStats(); edit.Save(); File.WriteAllText(Server.MapPath(string.Format("/sims/{0}.sm", edit.ID)), (string)Session["simFile"]); Session.Remove("currentSim"); Session.Remove("simFile"); Session["editid"] = edit.ID; Response.Redirect("convert.aspx"); }
public void UpdateMinMaxTest() { using (var setup = new TestSetupHelper("ProgressRing Tests")) { Log.Comment("Updating Minimum and Maximum value of ProgressRing"); UIObject testProgressRing = FindElement.ByName("TestProgressRing"); TextBlock minimumInputText = FindElement.ByName <TextBlock>("MinimumInputText"); TextBlock maximumInputText = FindElement.ByName <TextBlock>("MaximumInputText"); TextBlock valueText = FindElement.ByName <TextBlock>("ValueText"); double oldMinimumInputText = Convert.ToDouble(minimumInputText.DocumentText); double oldMaximumInputText = Convert.ToDouble(minimumInputText.DocumentText); Edit minimumInput = FindElement.ByName <Edit>("MinimumInput"); Edit maximumInput = FindElement.ByName <Edit>("MaximumInput"); minimumInput.SetValue("10"); maximumInput.SetValue("15"); Button updateMinMaxButton = FindElement.ByName <Button>("UpdateMinMaxButton"); updateMinMaxButton.InvokeAndWait(); double newMinimumInputText = Convert.ToDouble(minimumInputText.DocumentText); double newMaximumInputText = Convert.ToDouble(maximumInputText.DocumentText); Verify.AreNotSame(oldMinimumInputText, newMinimumInputText, "Minimum updated"); Verify.AreNotSame(oldMaximumInputText, newMaximumInputText, "Maximum updated"); // Below edge cases are handled by Rangebase Log.Comment("Updating Minimum and Maximum when Maximum < Minimum"); maximumInput.SetValue("5"); updateMinMaxButton.InvokeAndWait(); Verify.AreEqual(Convert.ToDouble(minimumInputText.DocumentText), Convert.ToDouble(maximumInputText.DocumentText), "Maximum updates to equal Minimum"); Log.Comment("Updating Minimum and Maximum when Minimum > Value"); minimumInput.SetValue("15"); updateMinMaxButton.InvokeAndWait(); Verify.AreEqual(Convert.ToDouble(valueText.DocumentText), Convert.ToDouble(minimumInputText.DocumentText), "Value updates to equal Minimum"); Verify.AreEqual(Convert.ToDouble(maximumInputText.DocumentText), Convert.ToDouble(minimumInputText.DocumentText), "Maximum also updates to equal Minimum"); Log.Comment("Updating Minimum and Maximum to be a decimal number"); minimumInput.SetValue("0.1"); maximumInput.SetValue("1.1"); updateMinMaxButton.InvokeAndWait(); double oldValue = Convert.ToDouble(valueText.DocumentText); Button changeValueButton = FindElement.ByName <Button>("ChangeValueButton"); changeValueButton.InvokeAndWait(); double newValue = Convert.ToDouble(valueText.DocumentText); double diff = Math.Abs(oldValue - newValue); Verify.IsGreaterThan(diff, Convert.ToDouble(0), "Value of ProgressRing increments properly within range with decimal Minimum and Maximum"); } }
private static void WriteBlock(XmlDocument doc, XmlElement pparent, Edit edit, List<int> fileIDs, ObservableCollection<Compound> compounds, COMPOUND_TYPES type) { //First we have a counter to keep track of rc1, rc2 etc int counter = 0; foreach (Compound comp in compounds) { //First we determine what element this will belong to string parentname = string.Empty; switch (type) { case COMPOUND_TYPES.Reactant: parentname = "reactant"; break; case COMPOUND_TYPES.Reagent: parentname = "reagent"; break; case COMPOUND_TYPES.Product: parentname = "product"; break; } XmlElement parent = doc.CreateElement(parentname); //Fileid is generated on the fly XmlElement fileid = doc.CreateElement("fileid"); comp.FileID = GenerateFileID(fileIDs); fileid.InnerText = comp.FileID.ToString(); //Local id is also generated on the fly we simply pass our counter and type XmlElement localid = doc.CreateElement("localid"); localid.InnerText = GenerateLocalID(counter, type); //The name is a copy of our compoud name XmlElement name = doc.CreateElement("name"); name.InnerText = comp.Name; //Copy over ref id XmlElement refid = doc.CreateElement("refid"); refid.InnerText = comp.RefName; //Same for formula XmlElement formula = doc.CreateElement("formula"); formula.InnerText = comp.Formula; //And same for state XmlElement state = doc.CreateElement("state"); state.InnerText = comp.State.ToString(); //density is the same, but it has a temperature <--- NOT DONE XmlElement density = doc.CreateElement("density"); // at temp x density.InnerText = comp.Density.ToString(); //THIS IS NOT COMPLETE; DENSITY EXISTS AT A GIVEN TEMP density.SetAttribute("temp", "25"); XmlElement islimiting = doc.CreateElement("islimiting"); islimiting.InnerText = comp.IsLimiting.ToString(); XmlElement isTarget = doc.CreateElement("istarget"); isTarget.InnerText = comp.IsTarget.ToString(); //The mols have a unit so we look into the dictionary to get the value at whatever unit XmlElement mols = doc.CreateElement("mols"); // unit mols.InnerText = comp.MolsValue.ToString(); mols.SetAttribute("unit", comp.MolsUnit); mols.SetAttribute("unit_power", comp.Mols.Power.ToString()); //The mass is also at a unit so just the same, however some compounds are measured //not in mass but by volume so we check this and output null if thats the case XmlElement mass = doc.CreateElement("mass"); //unit if (comp.MassValue > 0) { mass.InnerText = comp.MassValue.ToString(); mass.SetAttribute("unit", comp.MassUnit); mass.SetAttribute("unit_power", comp.Mass.Power.ToString()); } else { mass.InnerText = "null"; mass.SetAttribute("unit", "mol"); mass.SetAttribute("unit_power", "0"); } //and likewise for the volume, sometimes things are measured by mass and not volume XmlElement volume = doc.CreateElement("volume"); //unit if (comp.VolumeValue > 0) { volume.InnerText = comp.VolumeValue.ToString(); volume.SetAttribute("unit", "l"); volume.SetAttribute("unit_power", comp.Volume.Power.ToString()); } else { volume.InnerText = "null"; volume.SetAttribute("unit", "l"); volume.SetAttribute("unit_power", "0"); } XmlElement solvent = doc.CreateElement("solvent"); if (!string.IsNullOrEmpty(comp.SolventName)) { solvent.InnerText = comp.SolventName; solvent.SetAttribute("conc", comp.Solution.Concentration.Value.ToString()); solvent.SetAttribute("conc_unit", comp.Solution.Concentration.UnitType); solvent.SetAttribute("unit_power", comp.Solution.Concentration.Power.ToString()); } else { solvent.InnerText = "null"; solvent.SetAttribute("conc", "null"); solvent.SetAttribute("conc_unit", "mol/l"); solvent.SetAttribute("unit_power", "0"); } //Now we have to append all of these as children to the parent element given parent.AppendChild(fileid); parent.AppendChild(localid); parent.AppendChild(name); parent.AppendChild(refid); parent.AppendChild(formula); parent.AppendChild(state); parent.AppendChild(density); parent.AppendChild(islimiting); parent.AppendChild(isTarget); parent.AppendChild(mols); parent.AppendChild(mass); parent.AppendChild(volume); parent.AppendChild(solvent); //NOw that we have added all of the elements we add this parent element to our parents parent, giving us the correct format pparent.AppendChild(parent); counter++; } }
private void btnEdit_Click(object sender, EventArgs e) { #region //string manv = dgvNhanVien.CurrentRow.Cells[0].Value.ToString(); //manv = manv.Trim(); //Global.MANV(manv); //string fname = dgvNhanVien.CurrentRow.Cells[1].Value.ToString(); //fname = fname.Trim(); //Global.FNAME(fname); //string lname = dgvNhanVien.CurrentRow.Cells[2].Value.ToString(); //lname = lname.Trim(); //Global.LNAME(lname); //string gender = dgvNhanVien.CurrentRow.Cells[3].Value.ToString(); //gender = gender.Trim(); //Global.gender(gender); //Edit ed = new Edit(); //byte[] pic; //pic = (byte[])dgvNhanVien.CurrentRow.Cells[8].Value; //MemoryStream picture = new MemoryStream(pic); //Global.pic = Image.FromStream(picture); //string phone = dgvNhanVien.CurrentRow.Cells[5].Value.ToString(); //phone = phone.Trim(); //Global.PHONE(phone); //string address = dgvNhanVien.CurrentRow.Cells[6].Value.ToString(); //address = address.Trim(); //Global.ADDRESS(address); //string cmnd = dgvNhanVien.CurrentRow.Cells[7].Value.ToString(); //cmnd = cmnd.Trim(); //Global.CMND(cmnd); //string type = dgvNhanVien.CurrentRow.Cells[9].Value.ToString(); //type = type.Trim(); //Global.TYPE(type); #endregion //DateTime BDAY= (DateTime)dgvNhanVien.CurrentRow.Cells[4].Value; //Global.Birthday(BDAY); //byte[] pic; //pic = (byte[])dgvNhanVien.CurrentRow.Cells[7].Value; //ed.ShowDialog(); Edit ed = new Edit(); ed.txtMaNV.Text = dgvNhanVien.CurrentRow.Cells[0].Value.ToString(); ed.txtMaNV.Text = ed.txtMaNV.Text.Trim(); ed.txtHo.Text = dgvNhanVien.CurrentRow.Cells[2].Value.ToString(); ed.txtTen.Text = dgvNhanVien.CurrentRow.Cells[1].Value.ToString(); dgvNhanVien.CurrentRow.Cells[3].Value.ToString().Trim(); if (dgvNhanVien.CurrentRow.Cells[3].Value.ToString() == "male") { ed.radioMale.Checked = true; } else { ed.radioFemale.Checked = true; } ed.dtpBirthday.Value = (DateTime)dgvNhanVien.CurrentRow.Cells[4].Value; ed.txtSdt.Text = dgvNhanVien.CurrentRow.Cells[5].Value.ToString(); ed.txtAddress.Text = dgvNhanVien.CurrentRow.Cells[6].Value.ToString(); ed.txtCmnd.Text = dgvNhanVien.CurrentRow.Cells[7].Value.ToString(); dgvNhanVien.CurrentRow.Cells[9].Value = dgvNhanVien.CurrentRow.Cells[9].Value.ToString().Trim(); if (dgvNhanVien.CurrentRow.Cells[9].Value.ToString() == "Giam Sat") { ed.radioGS.Checked = true; } else if (dgvNhanVien.CurrentRow.Cells[9].Value.ToString() == "Van Phong") { ed.radioVP.Checked = true; } else { ed.radioTho.Checked = true; } byte[] pic; pic = (byte[])dgvNhanVien.CurrentRow.Cells[8].Value; MemoryStream picture = new MemoryStream(pic); ed.ptbAva.Image = Image.FromStream(picture); ed.ShowDialog(); }
public void testType_Insert() { Edit e = new Edit(1, 1, 1, 2); Assert.AreEqual(Edit.Type.INSERT, e.EditType); }
public override string ToString() { return($"Read: {Read.ToString()} Edit:{Edit.ToString()} Delete: {Delete.ToString()} + Create: {Create.ToString()}"); }
public void testType_Replace() { Edit e = new Edit(1, 2, 1, 4); Assert.AreEqual(Edit.Type.REPLACE, e.EditType); }
private static void Blame(EditList editList, NGit.Blame.Candidate a, NGit.Blame.Candidate b) { Region r = b.ClearRegionList(); Region aTail = null; Region bTail = null; for (int eIdx = 0; eIdx < editList.Count;) { // If there are no more regions left, neither side has any // more responsibility for the result. Remaining edits can // be safely ignored. if (r == null) { return; } Edit e = editList[eIdx]; // Edit ends before the next candidate region. Skip the edit. if (e.GetEndB() <= r.sourceStart) { eIdx++; continue; } // Next candidate region starts before the edit. Assign some // of the blame onto A, but possibly split and also on B. if (r.sourceStart < e.GetBeginB()) { int d = e.GetBeginB() - r.sourceStart; if (r.length <= d) { // Pass the blame for this region onto A. Region next = r.next; r.sourceStart = e.GetBeginA() - d; aTail = Add(aTail, a, r); r = next; continue; } // Split the region and assign some to A, some to B. aTail = Add(aTail, a, r.SplitFirst(e.GetBeginA() - d, d)); r.SlideAndShrink(d); } // At this point e.getBeginB() <= r.sourceStart. // An empty edit on the B side isn't relevant to this split, // as it does not overlap any candidate region. if (e.GetLengthB() == 0) { eIdx++; continue; } // If the region ends before the edit, blame on B. int rEnd = r.sourceStart + r.length; if (rEnd <= e.GetEndB()) { Region next = r.next; bTail = Add(bTail, b, r); r = next; if (rEnd == e.GetEndB()) { eIdx++; } continue; } // This region extends beyond the edit. Blame the first // half of the region on B, and process the rest after. int len = e.GetEndB() - r.sourceStart; bTail = Add(bTail, b, r.SplitFirst(r.sourceStart, len)); r.SlideAndShrink(len); eIdx++; } if (r == null) { return; } // For any remaining region, pass the blame onto A after shifting // the source start to account for the difference between the two. Edit e_1 = editList[editList.Count - 1]; int endB = e_1.GetEndB(); int d_1 = endB - e_1.GetEndA(); if (aTail == null) { a.regionList = r; } else { aTail.next = r; } do { if (endB <= r.sourceStart) { r.sourceStart -= d_1; } r = r.next; }while (r != null); }
// An special edit which acts as a sentinel value by marking the end the // list of edits /// <summary>Does the three way merge between a common base and two sequences.</summary> /// <remarks>Does the three way merge between a common base and two sequences.</remarks> /// <?></?> /// <param name="cmp">comparison method for this execution.</param> /// <param name="base">the common base sequence</param> /// <param name="ours">the first sequence to be merged</param> /// <param name="theirs">the second sequence to be merged</param> /// <returns>the resulting content</returns> public MergeResult <S> Merge <S>(SequenceComparator <S> cmp, S @base, S ours, S theirs ) where S : Sequence { IList <S> sequences = new AList <S>(3); sequences.AddItem(@base); sequences.AddItem(ours); sequences.AddItem(theirs); MergeResult <S> result = new MergeResult <S>(sequences); if (ours.Size() == 0) { if (theirs.Size() != 0) { EditList theirsEdits = diffAlg.Diff(cmp, @base, theirs); if (!theirsEdits.IsEmpty()) { // we deleted, they modified -> Let their complete content // conflict with empty text result.Add(1, 0, 0, MergeChunk.ConflictState.FIRST_CONFLICTING_RANGE); result.Add(2, 0, theirs.Size(), MergeChunk.ConflictState.NEXT_CONFLICTING_RANGE); } else { // we deleted, they didn't modify -> Let our deletion win result.Add(1, 0, 0, MergeChunk.ConflictState.NO_CONFLICT); } } else { // we and they deleted -> return a single chunk of nothing result.Add(1, 0, 0, MergeChunk.ConflictState.NO_CONFLICT); } return(result); } else { if (theirs.Size() == 0) { EditList oursEdits = diffAlg.Diff(cmp, @base, ours); if (!oursEdits.IsEmpty()) { // we modified, they deleted -> Let our complete content // conflict with empty text result.Add(1, 0, ours.Size(), MergeChunk.ConflictState.FIRST_CONFLICTING_RANGE); result.Add(2, 0, 0, MergeChunk.ConflictState.NEXT_CONFLICTING_RANGE); } else { // they deleted, we didn't modify -> Let their deletion win result.Add(2, 0, 0, MergeChunk.ConflictState.NO_CONFLICT); } return(result); } } EditList oursEdits_1 = diffAlg.Diff(cmp, @base, ours); Iterator <Edit> baseToOurs = oursEdits_1.Iterator(); EditList theirsEdits_1 = diffAlg.Diff(cmp, @base, theirs); Iterator <Edit> baseToTheirs = theirsEdits_1.Iterator(); int current = 0; // points to the next line (first line is 0) of base // which was not handled yet Edit oursEdit = NextEdit(baseToOurs); Edit theirsEdit = NextEdit(baseToTheirs); // iterate over all edits from base to ours and from base to theirs // leave the loop when there are no edits more for ours or for theirs // (or both) while (theirsEdit != END_EDIT || oursEdit != END_EDIT) { if (oursEdit.GetEndA() < theirsEdit.GetBeginA()) { // something was changed in ours not overlapping with any change // from theirs. First add the common part in front of the edit // then the edit. if (current != oursEdit.GetBeginA()) { result.Add(0, current, oursEdit.GetBeginA(), MergeChunk.ConflictState.NO_CONFLICT ); } result.Add(1, oursEdit.GetBeginB(), oursEdit.GetEndB(), MergeChunk.ConflictState. NO_CONFLICT); current = oursEdit.GetEndA(); oursEdit = NextEdit(baseToOurs); } else { if (theirsEdit.GetEndA() < oursEdit.GetBeginA()) { // something was changed in theirs not overlapping with any // from ours. First add the common part in front of the edit // then the edit. if (current != theirsEdit.GetBeginA()) { result.Add(0, current, theirsEdit.GetBeginA(), MergeChunk.ConflictState.NO_CONFLICT ); } result.Add(2, theirsEdit.GetBeginB(), theirsEdit.GetEndB(), MergeChunk.ConflictState .NO_CONFLICT); current = theirsEdit.GetEndA(); theirsEdit = NextEdit(baseToTheirs); } else { // here we found a real overlapping modification // if there is a common part in front of the conflict add it if (oursEdit.GetBeginA() != current && theirsEdit.GetBeginA() != current) { result.Add(0, current, Math.Min(oursEdit.GetBeginA(), theirsEdit.GetBeginA()), MergeChunk.ConflictState .NO_CONFLICT); } // set some initial values for the ranges in A and B which we // want to handle int oursBeginB = oursEdit.GetBeginB(); int theirsBeginB = theirsEdit.GetBeginB(); // harmonize the start of the ranges in A and B if (oursEdit.GetBeginA() < theirsEdit.GetBeginA()) { theirsBeginB -= theirsEdit.GetBeginA() - oursEdit.GetBeginA(); } else { oursBeginB -= oursEdit.GetBeginA() - theirsEdit.GetBeginA(); } // combine edits: // Maybe an Edit on one side corresponds to multiple Edits on // the other side. Then we have to combine the Edits of the // other side - so in the end we can merge together two single // edits. // // It is important to notice that this combining will extend the // ranges of our conflict always downwards (towards the end of // the content). The starts of the conflicting ranges in ours // and theirs are not touched here. // // This combining is an iterative process: after we have // combined some edits we have to do the check again. The // combined edits could now correspond to multiple edits on the // other side. // // Example: when this combining algorithm works on the following // edits // oursEdits=((0-5,0-5),(6-8,6-8),(10-11,10-11)) and // theirsEdits=((0-1,0-1),(2-3,2-3),(5-7,5-7)) // it will merge them into // oursEdits=((0-8,0-8),(10-11,10-11)) and // theirsEdits=((0-7,0-7)) // // Since the only interesting thing to us is how in ours and // theirs the end of the conflicting range is changing we let // oursEdit and theirsEdit point to the last conflicting edit Edit nextOursEdit = NextEdit(baseToOurs); Edit nextTheirsEdit = NextEdit(baseToTheirs); for (; ;) { if (oursEdit.GetEndA() >= nextTheirsEdit.GetBeginA()) { theirsEdit = nextTheirsEdit; nextTheirsEdit = NextEdit(baseToTheirs); } else { if (theirsEdit.GetEndA() >= nextOursEdit.GetBeginA()) { oursEdit = nextOursEdit; nextOursEdit = NextEdit(baseToOurs); } else { break; } } } // harmonize the end of the ranges in A and B int oursEndB = oursEdit.GetEndB(); int theirsEndB = theirsEdit.GetEndB(); if (oursEdit.GetEndA() < theirsEdit.GetEndA()) { oursEndB += theirsEdit.GetEndA() - oursEdit.GetEndA(); } else { theirsEndB += oursEdit.GetEndA() - theirsEdit.GetEndA(); } // A conflicting region is found. Strip off common lines in // in the beginning and the end of the conflicting region // Determine the minimum length of the conflicting areas in OURS // and THEIRS. Also determine how much bigger the conflicting // area in THEIRS is compared to OURS. All that is needed to // limit the search for common areas at the beginning or end // (the common areas cannot be bigger then the smaller // conflicting area. The delta is needed to know whether the // complete conflicting area is common in OURS and THEIRS. int minBSize = oursEndB - oursBeginB; int BSizeDelta = minBSize - (theirsEndB - theirsBeginB); if (BSizeDelta > 0) { minBSize -= BSizeDelta; } int commonPrefix = 0; while (commonPrefix < minBSize && cmp.Equals(ours, oursBeginB + commonPrefix, theirs , theirsBeginB + commonPrefix)) { commonPrefix++; } minBSize -= commonPrefix; int commonSuffix = 0; while (commonSuffix < minBSize && cmp.Equals(ours, oursEndB - commonSuffix - 1, theirs , theirsEndB - commonSuffix - 1)) { commonSuffix++; } minBSize -= commonSuffix; // Add the common lines at start of conflict if (commonPrefix > 0) { result.Add(1, oursBeginB, oursBeginB + commonPrefix, MergeChunk.ConflictState.NO_CONFLICT ); } // Add the conflict (Only if there is a conflict left to report) if (minBSize > 0 || BSizeDelta != 0) { result.Add(1, oursBeginB + commonPrefix, oursEndB - commonSuffix, MergeChunk.ConflictState .FIRST_CONFLICTING_RANGE); result.Add(2, theirsBeginB + commonPrefix, theirsEndB - commonSuffix, MergeChunk.ConflictState .NEXT_CONFLICTING_RANGE); } // Add the common lines at end of conflict if (commonSuffix > 0) { result.Add(1, oursEndB - commonSuffix, oursEndB, MergeChunk.ConflictState.NO_CONFLICT ); } current = Math.Max(oursEdit.GetEndA(), theirsEdit.GetEndA()); oursEdit = nextOursEdit; theirsEdit = nextTheirsEdit; } } } // maybe we have a common part behind the last edit: copy it to the // result if (current < @base.Size()) { result.Add(0, current, @base.Size(), MergeChunk.ConflictState.NO_CONFLICT); } return(result); }
public void RetemplateUpdateIndicatorWidthTest() { using (var setup = new TestSetupHelper("ProgressBar Tests")) { Log.Comment("Navigate to Progress Bar Re-template Page"); Button navigateToReTemplatePage = FindElement.ByName <Button>("NavigateToReTemplatePage"); Log.Comment("Set Re-template ProgressBar settings to default for testing"); RangeValueSpinner progressBar = FindElement.ByName <RangeValueSpinner>("TestProgressBar"); Edit minimumInput = FindElement.ByName <Edit>("MinimumInput"); Edit maximumInput = FindElement.ByName <Edit>("MaximumInput"); Edit widthInput = FindElement.ByName <Edit>("WidthInput"); TextBlock widthInputText = FindElement.ByName <TextBlock>("WidthInputText"); TextBlock indicatorWidthText = FindElement.ByName <TextBlock>("IndicatorWidthText"); Button changeValueButton = FindElement.ByName <Button>("ChangeValueButton"); Button updateWidthButton = FindElement.ByName <Button>("UpdateWidthButton"); minimumInput.SetValue("0"); maximumInput.SetValue("100"); widthInput.SetValue("100"); Verify.AreEqual(progressBar.Minimum, 0); Verify.AreEqual(progressBar.Maximum, 100); Verify.AreEqual(Convert.ToDouble(widthInputText.DocumentText), 100); Log.Comment("Changing value of Re-template ProgressBar updates Indicator Width"); changeValueButton.Invoke(); Verify.AreEqual(progressBar.Value, Convert.ToDouble(indicatorWidthText.DocumentText)); Log.Comment("Updating width of Re-template ProgressBar also updates Indicator Width"); widthInput.SetValue("200"); updateWidthButton.InvokeAndWait(); Verify.AreEqual((progressBar.Value * 2), Convert.ToDouble(indicatorWidthText.DocumentText), "Indicator width is adjusted to Re-template ProgressBar width"); Log.Comment("Changing value of ProgressBar of different width updates Indicator width"); changeValueButton.InvokeAndWait(); Verify.AreEqual((progressBar.Value * 2), Convert.ToDouble(indicatorWidthText.DocumentText), "Indicator width is adjusted to ProgressBar width"); Log.Comment("Updating Maximum and Minimum also updates Indicator Width"); minimumInput.SetValue("10"); maximumInput.SetValue("16"); changeValueButton.InvokeAndWait(); double range = progressBar.Maximum - progressBar.Minimum; double adjustedValueFromRange = progressBar.Value - progressBar.Minimum; double calculatedValue = (adjustedValueFromRange / range) * Convert.ToDouble(widthInputText.DocumentText); Verify.AreEqual(calculatedValue, Convert.ToDouble(indicatorWidthText.DocumentText), "Indicator Width is adjusted based on range and Re-template ProgressBar width"); } }
private System.Web.UI.Control GetVariableEditor(Hashtable variable) { object value = variable["Value"]; string name = (string) variable["Name"]; string editor = variable["Editor"] as string; Type type = value.GetType(); if (type == typeof (DateTime) || (!string.IsNullOrEmpty(editor) && (editor.IndexOf("date", StringComparison.OrdinalIgnoreCase) > -1 || editor.IndexOf("time", StringComparison.OrdinalIgnoreCase) > -1))) { var dateTimePicker = new DateTimePicker { ID = Control.GetUniqueID("variable_" + name + "_"), ShowTime = (variable["ShowTime"] != null && (bool) variable["ShowTime"]) || (!string.IsNullOrEmpty(editor) && editor.IndexOf("time", StringComparison.OrdinalIgnoreCase) > -1), }; dateTimePicker.Value = value is DateTime ? DateUtil.ToIsoDate((DateTime)value) : (string)value; return dateTimePicker; } if (type == typeof (Item) || (!string.IsNullOrEmpty(editor) && (editor.IndexOf("item", StringComparison.OrdinalIgnoreCase) > -1))) { var item = (Item) value; var dataContext = new DataContext { DefaultItem = item.Paths.Path, ID = Control.GetUniqueID("dataContext"), DataViewName = "Master", Root = variable["Root"] as string ?? "/sitecore", Parameters = "databasename=" + item.Database.Name, Database = item.Database.Name, Selected = new[] {new DataUri(item.ID, item.Language, item.Version)}, Folder = item.ID.ToString(), Language = item.Language, Version = item.Version }; DataContextPanel.Controls.Add(dataContext); var treePicker = new TreePicker { ID = Control.GetUniqueID("variable_" + name + "_"), Value = item.ID.ToString(), DataContext = dataContext.ID }; treePicker.Class += " treePicker"; return treePicker; } if (type == typeof(bool) || (!string.IsNullOrEmpty(editor) && (editor.IndexOf("bool", StringComparison.OrdinalIgnoreCase) > -1))) { var checkBox = new Checkbox { ID = Control.GetUniqueID("variable_" + name + "_"), Header = (string) variable["Title"], HeaderStyle = "margin-top:20px; display:inline-block;", Checked = (bool) value }; checkBox.Class = "varCheckbox"; return checkBox; } if (!string.IsNullOrEmpty(editor)) { bool showRoles = editor.IndexOf("role", StringComparison.OrdinalIgnoreCase) > -1; bool showUsers = editor.IndexOf("user", StringComparison.OrdinalIgnoreCase) > -1; bool multiple = editor.IndexOf("multiple", StringComparison.OrdinalIgnoreCase) > -1; if (showRoles || showUsers) { UserPicker picker = new UserPicker(); picker.Style.Add("float", "left"); picker.ID = Control.GetUniqueID("variable_" + name + "_"); picker.Class += " scContentControl textEdit clr" + value.GetType().Name; picker.Value = value.ToString(); picker.ExcludeRoles = !showRoles; picker.ExcludeUsers = !showUsers; picker.DomainName = variable["Domain"] as string ?? variable["DomainName"] as string; picker.Multiple = multiple; picker.Click = "UserPickerClick(" + picker.ID + ")"; return picker; } } Control edit; if (variable["lines"] != null && ((int)variable["lines"] > 1)) { edit = new Memo(); edit.Attributes.Add("rows", variable["lines"].ToString()); } else if (variable["Options"] != null) { edit = new Combobox(); string[] options = ((string) variable["Options"]).Split('|'); int i = 0; while (i < options.Length) { var item = new ListItem() { Header = options[i++], Value = options[i++], }; edit.Controls.Add(item); } } else { edit = new Edit(); } if (!string.IsNullOrEmpty((string)variable["Tooltip"])) { edit.ToolTip = (string)variable["Tooltip"]; } edit.Style.Add("float", "left"); edit.ID = Control.GetUniqueID("variable_" + name + "_"); edit.Class += " scContentControl textEdit clr"+value.GetType().Name; edit.Value = value.ToString(); return edit; }
public static MiddleSnakeResult Middle(byte[] original, byte[] patched, Bounds bounds = null) { // Set bounds to default unless they have been specified. (-1 as 0 offset but +1 as extra row added to represent starting before the byte arays so cancel out) bounds = bounds ?? new Bounds(new Point(0, 0), new Point(patched.Length, original.Length)); // Handle base cases with zero area if (bounds.IsVerticalBaseCase()) { // As the lower and upper x values are the same, this implies the only move is down which denotes a deletion. // The index of the deletion corresponded to the x position at the start of the move. Edit edit = new Deletion(bounds.ToIndex(), bounds.Lower.X); // Increment the lower y value of the bounds and check that it still has an area Bounds upper = new Bounds(new Point(bounds.Lower.X, bounds.Lower.Y + 1), bounds.Upper); if (upper.Lower == upper.Upper) { upper = null; } // Return the new middle snake return(new MiddleSnakeResult(edit, null, upper)); } if (bounds.IsHorizontalBaseCase()) { // Across => Insertion Edit edit = new Insertion(bounds.ToIndex(), bounds.Lower.X, patched[bounds.Lower.X]); Bounds upper = new Bounds(new Point(bounds.Lower.X + 1, bounds.Upper.Y), bounds.Upper); if (upper.Lower == upper.Upper) { upper = null; } return(new MiddleSnakeResult(edit, null, upper)); } // Store the size of the bounds. int N = bounds.Upper.Y - bounds.Lower.Y; int M = bounds.Upper.X - bounds.Lower.X; // Create an array to store x-distances along k-lines EditDistanceArray V = new EditDistanceArray(N, M); // Keep checking until a match must have been found for (int d = 0; d <= (N + M + 1) / 2; d++) { // Run the algorithm forwards and backwards foreach (Direction direction in Enum.GetValues(typeof(Direction))) { // Check and update every other k-line within the current bounds. for (int k = -d; k <= d; k += 2) { // Make sure the k-line is valid. bool valid = N <M && k <= M && (k != -d && k > -N || k == -d && k >= -N) || N> M && k >= -N && (k != d && k < M || k == d && k <= M) || N == M && k >= -N && k <= M; /* * bool valid = ((N < M && k != -d && k > -N && k <= M) || * (N < M && k == -d && k >= -N && k <= M) || * (N > M && k != d && k >= -N && k < M) || * (N > M && k == d && k >= -N && k <= M) || * (N == M && k >= -N && k <= M)) * ? true * : false; */ /* * if (N < M && k != -d && k > -N && k <= M) * { * valid = true; * } * * if (N < M && k == -d && k >= -N && k <= M) * { * valid = true; * } * * if (N > M && k != d && k >= -N && k < M) * { * valid = true; * } * * if (N > M && k == d && k >= -N && k <= M) * { * valid = true; * } * * if (N == M && k >= -N && k <= M) * { * valid = true; * } */ if (valid) { // Check if the x-distance is larger by moving down/up or right/left and store it bool down = ((k == -d) || (k != d) && V.GetX(k - 1, direction) < V.GetX(k + 1, direction)); int startX; int startY; // Update the current k-lines new x-distance if (down) { startX = (int)V.GetX(k + 1, direction); startY = (int)V.GetY(k + 1, direction); V.SetX(k, direction, startX); } else { startX = (int)V.GetX(k - 1, direction); startY = (int)V.GetY(k - 1, direction); V.SetX(k, direction, startX + 1); } int currentX = (int)V.GetX(k, direction); int currentY = (int)V.GetY(k, direction); int currentSnake = Snake.Length(original, patched, bounds, (int)V.GetX(k, direction), (int)V.GetY(k, direction), direction); int endX = currentX + currentSnake; int endY = currentY + currentSnake; // Update the current k-lines x-distance with the snake length from that point V.SetX(k, direction, endX); int globalEndX; int globalEndY; if (direction == Direction.Forward) { globalEndX = endX + bounds.Lower.X; globalEndY = endY + bounds.Lower.Y; } else { globalEndX = bounds.Upper.X - endX; globalEndY = bounds.Upper.Y - endY; } bool specialCase = false; if (direction == Direction.Forward) { if (globalEndX == bounds.Upper.X && globalEndY == bounds.Upper.Y) { specialCase = true; } } else { if (globalEndX == bounds.Lower.X && globalEndY == bounds.Lower.Y) { specialCase = true; } } // Check if the middle snake reached the end of the bounds in one movement if (specialCase) { Edit edit = null; // Handle exact matches (No differences) if (startY == -1) { return(new MiddleSnakeResult(null, null, null)); } if (direction == Direction.Forward) { // Check if the move was down or across if (down) { edit = new Deletion(bounds.ToIndex(), bounds.Lower.X + startX); } else { edit = new Insertion(bounds.ToIndex(), bounds.Lower.X + startX, patched[bounds.Lower.X + startX]); } } else { if (down) { edit = new Deletion(bounds.ToIndex(), bounds.Lower.Y + currentY); } else { edit = new Insertion(bounds.ToIndex(), bounds.Lower.Y + currentY, patched[bounds.Lower.Y + currentY]); } } return(new MiddleSnakeResult(edit, null, null)); } // Check if there is an overlap along the current k-line from each end if (V.Overlapped(k, direction)) { // Values to store when returning the result of the middle snake. Bounds upper; Bounds lower; if (direction == Direction.Reverse) { // Invert the positions as they are from the bottom right not the top left startX = M - startX; startY = N - startY; endX = M - endX; endY = N - endY; // Lower bounds are from the lower bound point to snake end point lower = new Bounds(new Point(bounds.Lower.X, bounds.Lower.Y), new Point(endX + bounds.Lower.X, endY + bounds.Lower.Y)); // Upper bounds are from the finish to the end upper = new Bounds(new Point(endX + bounds.Lower.X, endY + bounds.Lower.Y), new Point(bounds.Upper.X, bounds.Upper.Y)); } else { lower = new Bounds(new Point(bounds.Lower.X, bounds.Lower.Y), new Point(endX + bounds.Lower.X, endY + bounds.Lower.Y)); upper = new Bounds(new Point(endX + bounds.Lower.X, endY + bounds.Lower.Y), new Point(bounds.Upper.X, bounds.Upper.Y)); } if (lower.Lower.Equals(lower.Upper)) { lower = null; } if (upper.Lower.Equals(upper.Upper)) { upper = null; } return(new MiddleSnakeResult(null, lower, upper)); } } } } } return(null); }
public override void Process(TagHelperContext context, TagHelperOutput output) { if (Source.IsNullOrWhiteSpace()) { Source = Url.Action(DefaultSourceAction); } if (GridClass.IsNullOrWhiteSpace()) { GridClass = DefaultClass; } if (ModelType == null) { ModelType = ViewContext.ViewData.ModelMetadata.ModelType; } var viewConfig = ViewConfigureAttribute.GetAttribute(ModelType); StringBuilder tableHeaderBuilder = new StringBuilder(); StringBuilder tableSearchBuilder = new StringBuilder(); if (viewConfig != null) { var primaryKey = viewConfig.MetaData.Properties.Select(m => m.Value).FirstOrDefault(m => m.CustomAttributes.Any(attr => attr.AttributeType == typeof(KeyAttribute))); viewConfig.InitDisplayName(); if ((EditAble ?? true) && primaryKey != null) { string name = primaryKey.Name.FirstCharToLowerCase(); if (name.Length == 2) { name = name.ToLower(); } if (Edit.IsNullOrWhiteSpace()) { Edit = Url.Action(DefaultEditAction) + "/{" + name + "}"; } tableHeaderBuilder.AppendFormat(TableHeadStructure, string.Empty, WebUtility.HtmlEncode(EditLinkTemplate.FormatWith(Edit)), string.Empty, "操作", string.Empty, Query.Operators.None, string.Empty, string.Empty); tableSearchBuilder.Append(TableSearchStructure); } var columns = viewConfig.GetViewPortDescriptors(true) .Where(m => m.IsShowInGrid) .Each(m => { var dropDown = m as DropDownListDescriptor; StringBuilder optionBuilder = new StringBuilder(); if (dropDown != null) { foreach (var item in dropDown.OptionItems) { optionBuilder.AppendFormat("{{\"name\":\"{0}\",\"value\":\"{1}\"}},", item.Value, item.Key); } } else if (m.DataType == typeof(bool) || m.DataType == typeof(bool?)) { optionBuilder.AppendFormat("{{\"name\":\"{0}\",\"value\":\"{1}\"}},", "是", "true"); optionBuilder.AppendFormat("{{\"name\":\"{0}\",\"value\":\"{1}\"}},", "否", "false"); } tableHeaderBuilder.AppendFormat(TableHeadStructure, m.Name.FirstCharToLowerCase(), WebUtility.HtmlEncode(m.GridColumnTemplate), OrderAsc == m.Name ? "asc" : OrderDesc == m.Name ? "desc" : "", m.DisplayName, optionBuilder.Length == 0 ? string.Empty : WebUtility.HtmlEncode($"[{optionBuilder.ToString().Trim(',')}]"), m.SearchOperator, m.DataType.Name, (m as TextBoxDescriptor)?.JavaScriptDateFormat); tableSearchBuilder.Append(TableSearchStructure); }); } output.TagName = "div"; output.Attributes.Add("class", "container-fluid"); output.Content.SetHtmlContent(TableStructure.FormatWith(GridClass, Source, tableHeaderBuilder, tableSearchBuilder)); }
private void CreateControls(int id, string email) { var editRecipient = new Edit { Width = new Unit("100%"), ID = "editRecipient" + id, Value = email }; for (var i = 1; i < id; i++) { var edit = gpConfigurations.FindControl("editRecipient" + i) as Edit; if (edit != null) edit.Width = new Unit("100%"); } var lRecipient = new Literal { Text = "E-mail №" + id, ID = "lRecipient" + id, Value = Recipients.ToString(CultureInfo.InvariantCulture) }; gpConfigurations.Controls.Add(lRecipient); gpConfigurations.Controls.Add(editRecipient); }
public void RevealHoverLightPosition_Values() { if (PlatformConfiguration.IsOSVersionLessThan(OSVersion.Redstone2)) { Log.Comment("RevealHoverLightPosition_Values needs to be running on RS2 or greater"); return; } using (var setup = new TestSetupHelper(new[] { "Reveal Tests", "navigateToRevealStates" })) { var result = new Edit(FindElement.ById("TestResult")); var target = FindElement.ById("LargeButton2"); using (var waiter = new ValueChangedEventWaiter(result)) { // Note for this test case we specifically attach the hover light via hover, not press. // This provides regression coverage for Bug 14079741: Reveal hover light doesn't follow pointer until first interaction/click Log.Comment("Move pointer over LargeButton2 (which will attach RevealHoverLight)."); target.MovePointer(50, 50); Wait.ForIdle(); ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePosition_Offset1_Values"); FindElement.ByName <Button>("StartLoggingValues").InvokeAndWait(); TestEnvironment.Application.CoreWindow.MovePointer(0, 0); Wait.ForIdle(); Log.Comment("Move pointer to Offset1 [10, 90] on LargeButton2. Wait for light to position to reach expected values."); target.MovePointer(10, 90); Wait.ForIdle(); waiter.Wait(); } LogResult(result, "Offset1_Values"); using (var waiter = new ValueChangedEventWaiter(result)) { ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePosition_Offset2_Values"); FindElement.ByName <Button>("StartLoggingValues").InvokeAndWait(); // Move mouse pointer away so it does not create BorderLight on the item TestEnvironment.Application.CoreWindow.MovePointer(0, 0); Wait.ForIdle(); Log.Comment("Move pointer to Offset2 [50, 50]. Wait for light to position to reach expected values."); target.MovePointer(50, 50); Wait.ForIdle(); waiter.Wait(); } LogResult(result, "Offset2_Values"); target = FindElement.ById("NarrowButton2"); using (var waiter = new ValueChangedEventWaiter(result)) { Log.Comment("Tap and hold NarrowButton2 (which will attach RevealHoverLight)."); InputHelper.TapAndHold(target, 3000); Wait.ForIdle(); ChooseFromComboBox("ValidationActionsComboBox", "HoverLight_ValidatePosition_Offset3_Values"); FindElement.ByName <Button>("StartLoggingValues").InvokeAndWait(); TestEnvironment.Application.CoreWindow.MovePointer(0, 0); Wait.ForIdle(); Log.Comment("Tap on NarrowButton2 at [10, 40]. Wait for light position to reach expected values."); InputHelper.Tap(target, 10, 40); Wait.ForIdle(); waiter.Wait(); } LogResult(result, "Offset3_Values"); } }
public async Task<ActionResult> Edit(Edit.Query query) { var model = await _mediator.SendAsync(query); return View(model); }
internal override void ReportSyntacticRudeEdits( List<RudeEditDiagnostic> diagnostics, Match<SyntaxNode> match, Edit<SyntaxNode> edit, Dictionary<SyntaxNode, EditKind> editMap) { if (HasParentEdit(editMap, edit)) { return; } var classifier = new EditClassifier(this, diagnostics, edit.OldNode, edit.NewNode, edit.Kind, match); classifier.ClassifyEdit(); }
public async Task<ActionResult> Edit(Edit.Command command) { await _mediator.SendAsync(command); return this.RedirectToActionJson("Index"); }
public void MakeEdit(Edit edit) { Database.InsertEdit(Id, edit.Action, edit.Type, edit.X, edit.Y); }
public int GetHashCode(Edit <EqA, A> x) => x?.GetHashCode() ?? 0;
private bool WaitForOffsetToSettle(Edit text, double millisecondsTimeout, bool failOnError) { Wait.ForIdle(); const double millisecondsNormalStepTimeout = 100; const double millisecondsIdleStepTimeout = 600; ValueChangedEventWaiter waiter = new ValueChangedEventWaiter(text); int unsuccessfulWaits = 0; int maxUnsuccessfulWaits = (int)(millisecondsIdleStepTimeout / millisecondsNormalStepTimeout); Log.Comment("Original State: " + elements.GetScrollViewerStateTextBox().GetText()); Log.Comment("Original Offset: " + text.Value); // When the initial State is still Idle, use a longer timeout to allow it to transition out of Idle. double millisecondsWait = (elements.GetScrollViewerStateTextBox().GetText() == "Idle") ? millisecondsIdleStepTimeout : millisecondsNormalStepTimeout; double millisecondsCumulatedWait = 0; do { Log.Comment("Waiting for Offset change."); waiter.Reset(); if (waiter.TryWait(TimeSpan.FromMilliseconds(millisecondsWait))) { unsuccessfulWaits = 0; } else { unsuccessfulWaits++; } millisecondsCumulatedWait += millisecondsWait; millisecondsWait = millisecondsNormalStepTimeout; Log.Comment("Current State: " + elements.GetScrollViewerStateTextBox().GetText()); Log.Comment("Current Offset: " + text.Value); Wait.ForIdle(); }while (elements.GetScrollViewerStateTextBox().GetText() != "Idle" && millisecondsCumulatedWait < millisecondsTimeout && unsuccessfulWaits <= maxUnsuccessfulWaits); if (elements.GetScrollViewerStateTextBox().GetText() == "Idle") { Log.Comment("Idle State reached after " + millisecondsCumulatedWait + " out of " + millisecondsTimeout + " milliseconds. Final Offset: " + text.Value); return(true); } else { string message = unsuccessfulWaits > maxUnsuccessfulWaits ? "Offset has not changed within " + millisecondsIdleStepTimeout + " milliseconds outside of Idle State." : "Idle State was not reached within " + millisecondsTimeout + " milliseconds."; if (failOnError) { Log.Error(message); } else { Log.Warning(message); } return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="AddChildElement"/> class. /// </summary> public AddChildElement() { this.TemplateList = new Listview(); ElementName = new Edit(); }
public void Reset() { Edit.ClearData(); ObjectScene.ClearData(); }
private UIObject Launch(string deploymentDir) { UIObject coreWindow = null; // When running from MUXControls repo we want to install the app. // When running in TestMD we also want to install the app. // In CatGates, we install the test app as part of the deploy script, so we don't need to do anything here. #if BUILD_WINDOWS if (TestEnvironment.TestContext.Properties.Contains("RunFromTestMD")) { TestAppInstallHelper.InstallTestAppIfNeeded(deploymentDir, _packageName, _packageFullName); } #elif USING_TAEF TestAppInstallHelper.InstallTestAppIfNeeded(deploymentDir, _packageName, _packageFullName); #else BuildAndInstallTestAppIfNeeded(); #endif Log.Comment("Launching app {0}", _appName); coreWindow = LaunchApp(_packageName); Verify.IsNotNull(coreWindow, "coreWindow"); Log.Comment("Waiting for the close-app invoker to be found to signal that the app has launched successfully..."); for (int retries = 0; retries < 5; ++retries) { UIObject obj; coreWindow.Descendants.TryFind(UICondition.Create("@AutomationId='__CloseAppInvoker'"), out obj); if (obj != null) { Log.Comment("Invoker found!"); break; } Log.Comment("Invoker not found. Sleeping for 500 ms before trying again..."); Thread.Sleep(500); } var unhandledExceptionReportingTextBox = new Edit(coreWindow.Descendants.Find(UICondition.Create("@AutomationId='__UnhandledExceptionReportingTextBox'"))); var valueChangedSource = new PropertyChangedEventSource(unhandledExceptionReportingTextBox, Scope.Element, UIProperty.Get("Value.Value")); valueChangedSource.Start(new TestAppCrashDetector()); Log.Comment("15056441 tracing, device family:" + Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily); // On phone, we work around different scale factors between devices by configuring the test app to // lay out the test pages at the device's resolution, effectively giving us a scale factor of 1.0. if (PlatformConfiguration.IsDevice(DeviceType.Phone)) { Log.Comment("Enabling view scaling workaround on phone."); try { var viewScalingCheckBox = new CheckBox(coreWindow.Descendants.Find(UICondition.Create("@AutomationId='__ViewScalingCheckBox'"))); using (var waiter = viewScalingCheckBox.GetToggledWaiter()) { viewScalingCheckBox.Check(); } Log.Comment("15056441 Tracing: New checkbox state is " + viewScalingCheckBox.ToggleState); } catch (UIObjectNotFoundException) { Log.Error("Could not find the view scaling CheckBox."); TestEnvironment.LogDumpTree(UIObject.Root); throw; } } return(coreWindow); }