public override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); //this.enter = false; this.curOverRow = null; this.Invalidate(); }
public ListViewRow SelectListViewRowName(ListView listView, string rowName) { ListViewRow row = listView.Rows.Where(x => x.Name.Contains(rowName)).FirstOrDefault(); row.Select(); return(row); }
/// <summary> /// 文件删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Press(object sender, EventArgs e) { try { this.Client.File.Exists(lblFile.BindDisplayValue.ToString(), MobileResourceManager.DefaultDocumentResourceName, (obj, args) => { if (args.Exists == true) { //删除手机上文件 this.Client.File.Delete(lblFile.BindDisplayValue.ToString(), MobileResourceManager.DefaultDocumentResourceName, (obj1, args1) => { if (args1.isError == true) { throw new Exception(args1.error); } else { ListViewRow row = this.Tag as ListViewRow; ((FileUp.frmFileDetail)(this.Form)).RemoveRow(row);//删除当前列表行项 } }); } else { this.Form.Toast("文件不存在,请下载文件到手机!"); } }); } catch (Exception ex) { this.Form.Toast(ex.Message, ToastLength.SHORT); } }
private static void AddFromAvailableFields(Window windowSelectedFields, string columnName) { ListView listSelectedFields = windowSelectedFields.Get <ListView>(SearchCriteria.ByControlType(ControlType.DataGrid).AndIndex(0)); ListViewRow row = listSelectedFields.Rows.First(r => r.Name == columnName); row.DoubleClick(); }
public override void Action() { ListView cb = (ListView)control; ListViewRow listItem = cb.Rows.Where(item => item.Name == criteria).FirstOrDefault(); if (actionType == ActionType.click) { listItem.Click(); return; } if (actionType == ActionType.doubleClick) { listItem.DoubleClick(); return; } if (actionType == ActionType.select) { listItem.Select(); return; } throw new Exception($"Control Doesn't Accept Action Type {actionType}"); }
public void SelectedRow() { listView.Select(0); ListViewRow listViewRow = listView.SelectedRows[0]; Assert.AreEqual("Search", listViewRow.Cells["Key"].Text); }
public void SelectedSymbolRepeatedPositionRowClick() { //get handle of the Position Table ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId")); string symbol; List <News> news; ListBox articlesView; //click the particular symbol of the Position table ListViewRow symbolRow = list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("Symbol"))); symbolRow.Click(); //Get the news item for a particular symbol symbol = TestDataInfrastructure.GetTestInputData("Symbol"); news = TestDataInfrastructure.GetDataForId <NewsDataProvider, News>(symbol); //Get the handler of the News Article View displayed articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView")); //Get the number of news items for the particular symbol int newsCount = news.Count; Assert.AreEqual(newsCount, articlesView.Items.Count); //click the particular symbol of the Position table symbolRow.Click(); //Get the handler of the News Article View displayed articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView")); Assert.AreEqual(newsCount, articlesView.Items.Count); }
public void ClickingAlreadyShownSymbolDisplaysNewsArticlesCorrespondingly() { //get handle of the Position Table ListView list = Window.Get <ListView>(TestDataInfrastructure.GetControlId("PositionTableId")); string symbol; List <News> news; ListBox articlesView; //click the particular symbol of the Position table STOCK0 ListViewRow symbolRow = list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("Symbol"))); symbolRow.Click(); //click on the position symbol STOCK6 ListViewRow secondSymbolRow = list.Rows.Find(row => row.Cells[TestDataInfrastructure.GetTestInputData("PositionTableSymbol")].Text.Equals(TestDataInfrastructure.GetTestInputData("PositionSymbol"))); secondSymbolRow.Click(); //click the particular symbol of the Position table STOCK0 symbolRow.Click(); //Get the news item for a particular symbol symbol = TestDataInfrastructure.GetTestInputData("Symbol"); news = TestDataInfrastructure.GetDataForId <NewsDataProvider, News>(symbol); //Get the handler of the News Article View displayed articlesView = Window.Get <ListBox>(TestDataInfrastructure.GetControlId("NewsArticlesView")); Assert.AreEqual(news.Count, articlesView.Items.Count); }
private void CheckRow(ListViewRow listViewRow, string cell1Value, string cell2Value) { var cells = listViewRow.Cells; Assert.That(cells, Has.Length.EqualTo(2)); CheckCellValue(cells[0], cell1Value); CheckCellValue(cells[1], cell2Value); }
public static ListViewCells GetCells(this ListViewRow row, ListViewHeader header) { AutomationElementCollection coll = row.AutomationElement.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ClassNameProperty, "DataGridCell")); List <AutomationElement> list = coll.Cast <object>().Cast <AutomationElement>().ToList(); return(new ListViewCells(list, row.ActionListener, header)); }
void CellCount() { using (var window = StartScenario("OpenListView", "ListViewWindow")) { var listView = window.Get <ListView>("ListView"); ListViewRow row = listView.Rows[0]; Assert.Equal(2, row.Cells.Count); } }
public void ScrollAndSelectInAComboBox() { var listView = window.Get <ListView>("listView"); ListViewRow row = listView.Rows[0]; var comboBox = (ComboBox)row.Get(SearchCriteria.ByControlType(ControlType.ComboBox)); Assert.AreNotEqual(null, comboBox); comboBox.Select("%"); Assert.AreEqual("%", comboBox.SelectedItem.Text); }
void SelectedRow() { using (var window = StartScenario("OpenListView", "ListViewWindow")) { var listView = window.Get <ListView>("ListView"); listView.Select(0); ListViewRow listViewRow = listView.SelectedRows[0]; Assert.Equal("Search", listViewRow.Cells["Key"].Text); } }
private bool DataMatches(ListViewRow row, string[] data) { for (int i = 0; i < data.Length; i++) { if (row.Cells[i].Text != data[i]) { return(false); } } return(true); }
public void CellText() { ListViewRow first = listView.Rows[0]; Assert.AreEqual("Search", first.Cells[0].Text); Assert.AreEqual("Google", first.Cells[1].Text); ListViewRow second = listView.Rows[1]; Assert.AreEqual("Mail", second.Cells[0].Text); Assert.AreEqual("GMail", second.Cells[1].Text); }
public void SelectRow() { listView.Select(0); ListViewRow firstRow = listView.Rows[0]; Assert.AreEqual(true, firstRow.IsSelected); Assert.AreEqual("listView item selected - " + 0, window.Get <Label>("result").Text); listView.Select(1); ListViewRow secondRow = listView.Rows[1]; Assert.AreEqual(true, secondRow.IsSelected); }
private void btnRemove_Press(object sender, EventArgs e) { lv = this.Owner as Smobiler.Core.Controls.ListView; lvRow = this.Tag as ListViewRow; int rowIndex = lv.Rows.IndexOf(lvRow); demoListViewRemove dl = lv.Owner as demoListViewRemove; dl.RemoveNum(rowIndex); //也可直接移除本项 //lv.Rows.Remove(lvRow); }
public In_ClientCaseSearch_SelectClient(Application application, string clientName) { WindowTools windowTools = new WindowTools(); List <Window> windows = windowTools.GetWindows(application); Window window = windowTools.GetWindow(windows, "ClientCaseSearch"); ListView listView = windowTools.GetListView(window, SearchCriteria.ByAutomationId("listView")); ListViewRow result = windowTools.SelectListViewRowName(listView, clientName); Assert.IsNotNull(result, "Client Name Not Found In ClientCaseSearch List View."); windowTools.DoubleClickIUItem(result); }
public int FindSelectedRowIndex() { var rowIndex = -1; ListViewRow selectedRow = null; if (UIItem.SelectedRows.Count > 0) { selectedRow = UIItem.SelectedRows[0]; rowIndex = UIItem.Rows.IndexOf(selectedRow); } return(rowIndex); }
void CellText() { using (var window = StartScenario("OpenListView", "ListViewWindow")) { var listView = window.Get <ListView>("ListView"); ListViewRow first = listView.Rows[0]; Assert.Equal("Search", first.Cells[0].Text); Assert.Equal("Google", first.Cells[1].Text); ListViewRow second = listView.Rows[1]; Assert.Equal("Mail", second.Cells[0].Text); Assert.Equal("GMail", second.Cells[1].Text); } }
void SelectRow() { using (var window = StartScenario("OpenListView", "ListViewWindow")) { var listView = window.Get <ListView>("ListView"); listView.Select(0); ListViewRow firstRow = listView.Rows[0]; Assert.Equal(true, firstRow.IsSelected); Assert.Equal("ListView item selected - " + 0, listView.HelpText); listView.Select(1); ListViewRow secondRow = listView.Rows[1]; Assert.Equal(true, secondRow.IsSelected); } }
private void SelectBatchFromList(string batchName, ListView listview) { logger.LogInfo($"Trying to select batch {batchName}"); ListViewRows rows = listview.Rows; /*foreach (var listViewRow in rows) * { * logger.LogInfo($"Row found {listViewRow.Cells[0].Name}"); * }*/ ListViewRow row = rows.First(r => r.Cells[0].Name.Equals(batchName)); logger.LogInfo($"Selecting Batch with name: {row.Cells[0].Name}"); row.Select(); }
public SelectFacility(Application application, string facilityName) { WindowTools windowTools = new WindowTools(); Window window = windowTools.GetWindow(application, "Select Facility"); RadioButton facilityRadioButton = windowTools.GetRadioButton(window, SearchCriteria.ByAutomationId("facilityRadioButton")); windowTools.ClickIUIItem(facilityRadioButton); ListBox facilityFilter = windowTools.GetListBox(window, SearchCriteria.ByAutomationId("ListBox")); windowTools.SelectListBoxItem(facilityFilter, "Any"); ListView facilityList = windowTools.GetListView(window, SearchCriteria.ByAutomationId("listView")); ListViewRow row = windowTools.SelectListViewRowName(facilityList, facilityName); windowTools.DoubleClickIUItem(row); }
AutofacConfig AutofacConfig = new AutofacConfig();//调用配置类 #endregion /// <summary> /// 删除列表行项 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelRow_Press(object sender, EventArgs e) { try { MessageBox.Show("确认要删除选中行项?", MessageBoxButtons.YesNo, (Object s1, MessageBoxHandlerArgs args) => { //此委托为异步委托事件 if (args.Result == Smobiler.Core.Controls.ShowResult.Yes) { switch (this.Form.ToString()) { case "SmoONE.UI.RB.frmRTypeTemplate": ReturnInfo r = AutofacConfig.rBService.DeleteRB_Type_Template(((frmRBModelLayout)this.Parent.Parent).NO); if (r.IsSuccess == true) { ListViewRow row = this.Parent.Parent.Tag as ListViewRow; ((RB.frmRTypeTemplate)(this.Form)).RemoveRow(row); //删除当前列表行项 Toast("删除消费模板成功"); } else { throw new Exception(r.ErrorInfo); } break; case "SmoONE.UI.RB.frmRBRows": ReturnInfo r1 = AutofacConfig.rBService.DeleteRB_Rows(Convert.ToInt32(((frmConsumptionLayout)this.Parent.Parent).NO)); if (r1.IsSuccess == true) { ListViewRow row = this.Parent.Parent.Tag as ListViewRow; ((RB.frmRBRows)(this.Form)).RemoveRow(row); //删除当前列表行项 Toast("删除消费记录成功"); } else { throw new Exception(r1.ErrorInfo); } break; } } }); } catch (Exception ex) { Toast(ex.Message); } }
public override void OnMouseDown(System.Windows.Forms.MouseEventArgs e) { base.OnMouseDown(e); if (e.Button == System.Windows.Forms.MouseButtons.Left) { ListViewRow item = RowHitTest(e.X, e.Y); // FIXME Implementare multiselect con CTRL / SHIFT this.selectedRows.Clear(); if (item != null) { this.selectedRows.Add(item); } this.Invalidate(); } }
public override void FromXmlElement(System.Xml.XmlElement element, Dictionary <string, System.IO.MemoryStream> resources) { base.FromXmlElement(element, resources); foreach (System.Xml.XmlElement child in element.ChildNodes) { if (child.Name == "Columns") { foreach (System.Xml.XmlElement col in child.ChildNodes) { var c = new ListViewColumn(); c.Title = col.GetAttribute("title"); c.Width = (float)System.Xml.XmlConvert.ToDecimal(col.GetAttribute("width")); this.Columns.Add(c); } } else if (child.Name == "Items") { foreach (System.Xml.XmlElement item in child.ChildNodes) { var r = new ListViewRow(); foreach (System.Xml.XmlElement value in item.ChildNodes) { r.Values.Add(value.GetAttribute("value")); } this.Items.Add(r); } } } SerializationHelper.LoadBitmapFromResources(element, "backgroundNormal9P", resources, s => this.BackgroundNormal9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundHeaderBar9P", resources, s => this.BackgroundHeaderBar9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundColumnHeader9P", resources, s => this.BackgroundColumnHeader9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundRowOver9P", resources, s => this.BackgroundRowOver9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundRowSelected9P", resources, s => this.BackgroundRowSelected9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundRowSelectedOver9P", resources, s => this.BackgroundRowSelectedOver9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundRowNormal9P", resources, s => this.BackgroundRowNormal9P = s); SerializationHelper.LoadBitmapFromResources(element, "scrollbarNormal9P", resources, s => this.ScrollbarNormal9P = s); SerializationHelper.LoadFont(element, "headerFont", s => this.HeaderFont = s); SerializationHelper.LoadColor(element, "headerForeColor", s => this.HeaderForeColor = s); SerializationHelper.LoadFont(element, "activeRowFont", s => this.ActiveRowFont = s); SerializationHelper.LoadColor(element, "activeRowForeColor", s => this.ActiveRowForeColor = s); //SerializationHelper.LoadInteger(element, "activeRow", s => { if (s >= 0 && s < this.items.Count) this.ActiveRow = this.items[s]; else this.activeRow = null; }); }
public static void TestServerApp(Computer computer, bool createXml, int rowId) { Application application = Application.Launch("Project2.exe"); Window window = application.GetWindow("Integracja Systemów - Marcin Bobel", InitializeOption.NoCache); Button loadDataFromCsvButton = window.Get <Button>("LoadDataFromCsvButton"); loadDataFromCsvButton.Click(); ListView priceList = window.Get <ListView>("PriceList"); if (priceList == null || priceList.Items.Count < rowId) { throw new ArgumentException("RowId grather than avaiable rows"); } ListViewRow row = priceList.Rows[rowId]; var properties = computer.GetType().GetProperties().ToList(); for (int i = 0; i < properties.Count; i++) { var value = properties[i].GetValue(computer); if (value == null) { continue; } row.Cells[i].Click(); row.Cells[i].Enter(""); row.Cells[i].Enter(value.ToString()); row.Cells[i].Click(); } ; if (createXml) { Button saveToXmlButton = window.Get <Button>("ExportToXmlButton"); saveToXmlButton.Click(); } Button saveToDbButton = window.Get <Button>("ExportToDbButton"); saveToDbButton.Click(); }
private static void PutFieldFirstInList(ListView listSelectedFields, string columnName) { ListViewRow row = listSelectedFields.Rows.First(r => r.Name == columnName); int itemIndex = listSelectedFields.Rows.IndexOf(row); if (itemIndex != 0) { Thread.Sleep(200); listSelectedFields.Select(itemIndex - 1); Keyboard.Instance.HoldKey(KeyboardInput.SpecialKeys.SHIFT); listSelectedFields.Select(0); Keyboard.Instance.LeaveKey(KeyboardInput.SpecialKeys.SHIFT); Thread.Sleep(200); Keyboard.Instance.HoldKey(KeyboardInput.SpecialKeys.ALT); Keyboard.Instance.PressSpecialKey(KeyboardInput.SpecialKeys.DOWN); Thread.Sleep(200); Keyboard.Instance.LeaveKey(KeyboardInput.SpecialKeys.ALT); } }
/// <summary> /// 用于在ListView中选择时,设置当前选择的值。 /// </summary> /// <param name="row"></param> public void SetSelected(ListViewRow row) { if (listView1.Rows.Contains(row) == true) { if (lv1SelectedRow != null) { ((userFilterItemTemplate)lv1SelectedRow.Control).setUnSelected(); } lv1SelectedRow = row; } else if (listView2.Rows.Contains(row) == true) { if (lv2SelectedRow != null) { ((userFilterItemTemplate)lv2SelectedRow.Control).setUnSelected(); } lv2SelectedRow = row; } }
public void PrintLatestRecord() { GetAllButtonButton().Click(); ListView tem = GetEntitiesList(); for (int i = 0; i < tem.Rows.Count; i++) { ListViewRow row = tem.Rows[i]; Debug.WriteLine(" {0} {1} {2} {3} {4} {5} {6} {7}", row.Cells[0].Name, row.Cells[1].Name, row.Cells[2].Name, row.Cells[3].Name, row.Cells[4].Name, row.Cells[5].Name, row.Cells[6].Name , row.Cells[7].Name); Console.WriteLine(" {0} {1} {2} {3} {4} {5} {6} {7}", row.Cells[0].Name, row.Cells[1].Name, row.Cells[2].Name, row.Cells[3].Name, row.Cells[4].Name, row.Cells[5].Name, row.Cells[6].Name , row.Cells[7].Name); //for (int j = 0; j < row.Cells.Count; j++) //{ // Debug.WriteLine(row.Cells[j].Name); // Console.WriteLine(row.Cells[j].Name); //} } }
public override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); //this.enter = false; this.curOverRow = null; this.Invalidate(); }
public override void OnMouseMove(System.Windows.Forms.MouseEventArgs e) { base.OnMouseMove(e); this.curOverRow = RowHitTest(e.X, e.Y); this.Invalidate(); }
public override void FromXmlElement(System.Xml.XmlElement element, Dictionary<string, System.IO.MemoryStream> resources) { base.FromXmlElement(element, resources); foreach (System.Xml.XmlElement child in element.ChildNodes) { if (child.Name == "Columns") { foreach (System.Xml.XmlElement col in child.ChildNodes) { var c = new ListViewColumn(); c.Title = col.GetAttribute("title"); c.Width = (float)System.Xml.XmlConvert.ToDecimal(col.GetAttribute("width")); this.Columns.Add(c); } } else if (child.Name == "Items") { foreach (System.Xml.XmlElement item in child.ChildNodes) { var r = new ListViewRow(); foreach (System.Xml.XmlElement value in item.ChildNodes) { r.Values.Add(value.GetAttribute("value")); } this.Items.Add(r); } } } SerializationHelper.LoadBitmapFromResources(element, "backgroundNormal9P", resources, s => this.BackgroundNormal9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundHeaderBar9P", resources, s => this.BackgroundHeaderBar9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundColumnHeader9P", resources, s => this.BackgroundColumnHeader9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundRowOver9P", resources, s => this.BackgroundRowOver9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundRowSelected9P", resources, s => this.BackgroundRowSelected9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundRowSelectedOver9P", resources, s => this.BackgroundRowSelectedOver9P = s); SerializationHelper.LoadBitmapFromResources(element, "backgroundRowNormal9P", resources, s => this.BackgroundRowNormal9P = s); SerializationHelper.LoadBitmapFromResources(element, "scrollbarNormal9P", resources, s => this.ScrollbarNormal9P = s); SerializationHelper.LoadFont(element, "headerFont", s => this.HeaderFont = s); SerializationHelper.LoadColor(element, "headerForeColor", s => this.HeaderForeColor = s); SerializationHelper.LoadFont(element, "activeRowFont", s => this.ActiveRowFont = s); SerializationHelper.LoadColor(element, "activeRowForeColor", s => this.ActiveRowForeColor = s); //SerializationHelper.LoadInteger(element, "activeRow", s => { if (s >= 0 && s < this.items.Count) this.ActiveRow = this.items[s]; else this.activeRow = null; }); }
void items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (activeRow != null && !this.items.Contains(activeRow)) activeRow = null; this.Invalidate(); }