private void AddDirsInListViewFile(IEnumerable <OsFile> dirs, IEnumerable <OsFile> files, string parentPath) { _dataStore.Clear(); var item = new DataStoreCollection <FileInfoView>(); //显示dirs foreach (OsFile dir in dirs) { //移除最后的'/'符号 string dirName = dir.FileName.Remove(dir.FileName.Length - 1, 1); //添加fileInfo string fullName = Path.Combine(new string[] { parentPath, dirName }) + (_isWin ? "\\" : "/"); item.Add(new FileInfoView(dirName, fullName, true, dir.FileMTime, dir.FileSize, dir.FilePerms)); } //显示files foreach (OsFile file in files) { //添加fileInfo string dirName = file.FileName; string fullName = Path.Combine(new string[] { parentPath, dirName }); item.Add(new FileInfoView(dirName, fullName, false, file.FileMTime, file.FileSize, file.FilePerms)); } _dataStore.AddRange(item); }
Control GridView() { var control = new GridView { Size = new Size(-1, 150) }; control.Columns.Add(new GridColumn { DataCell = new ImageViewCell(0), HeaderText = "Image" }); control.Columns.Add(new GridColumn { DataCell = new CheckBoxCell(1), HeaderText = "Check", Editable = true }); control.Columns.Add(new GridColumn { DataCell = new TextBoxCell(2), HeaderText = "Text", Editable = true }); control.Columns.Add(new GridColumn { DataCell = new ComboBoxCell(3) { DataStore = ComboCellItems() }, HeaderText = "Combo", Editable = true }); var items = new DataStoreCollection(); items.Add(new GridItem(bitmap1, true, "Text in Grid 1", "1")); items.Add(new GridItem(icon1, false, "Text in Grid 2", "2")); items.Add(new GridItem(bitmap1, null, "Text in Grid 3", "3")); control.DataStore = items; return(control); }
/// <summary> /// Creates a model with 100 items, with index as Id. /// </summary> public static DataStoreCollection CreateModel() { var model = new DataStoreCollection(); for (var i = 0; i < ItemCount; ++i) model.Add(new DataItem(i)); return model; }
public SectionListGridView(IEnumerable <Section> topNodes) { gridView = new GridView { ShowCellBorders = false }; gridView.Columns.Add(new GridColumn { HeaderText = "Name", Width = 100, AutoSize = false, DataCell = new TextBoxCell("Name"), Sortable = true }); gridView.Columns.Add(new GridColumn { HeaderText = "Section", DataCell = new TextBoxCell("SectionName"), Sortable = true }); var items = new DataStoreCollection(); foreach (var section in topNodes) { foreach (var test in section) { items.Add(new MyItem { Name = (test as ISectionName).Text, SectionName = (section as ISectionName).Text, Section = test, }); } } gridView.DataStore = items; gridView.SelectionChanged += OnSelectedItemChanged; layout = new DynamicLayout(); layout.Add(filterText = new SearchBox { PlaceholderText = "Filter" }); layout.Add(gridView); // Filter filterText.TextChanged += (s, e) => { var filterItems = (filterText.Text ?? "").Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // Set the filter delegate on the GridView gridView.Filter = (filterItems.Length == 0) ? (Func <object, bool>)null : o => { var i = o as MyItem; var matches = true; // Every item in the split filter string should be within the Text property foreach (var filterItem in filterItems) { if (i.Name.IndexOf(filterItem, StringComparison.CurrentCultureIgnoreCase) == -1 && i.SectionName.IndexOf(filterItem, StringComparison.CurrentCultureIgnoreCase) == -1) { matches = false; break; } } return(matches); }; }; }
/// <summary> /// Creates a model with 100 items, with index as Id. /// </summary> public static DataStoreCollection CreateModel() { var model = new DataStoreCollection(); for (var i = 0; i < ItemCount; ++i) { model.Add(new DataItem(i)); } return(model); }
// Hate duplicate code, but I couldn't figure out how to make it accept // a data store using her reader method. private void loadBusinessFriendTipsHelper(NpgsqlDataReader R) { friend_data.Add(new TipInfo() { uid = R.GetString(0), date = (DateTime)R.GetTimeStamp(1), name = R.GetString(2), likes = R.GetInt32(3), text = R.GetString(4) }); }
public void Test_GetByName() { DataStoreCollection collection = new DataStoreCollection(); IDataStore dataStore1 = DataAccess.Data.InitializeDataStore("TestStore1"); collection.Add(dataStore1); IDataStore dataStore2 = DataAccess.Data.InitializeDataStore("TestStore2"); collection.Add(dataStore2); IDataStore foundStore1 = collection.GetByName("TestStore1"); Assert.IsNotNull(foundStore1, "The first store wasn't found when searching by short store name."); IDataStore foundStore2 = collection.GetByName("TestStore2"); Assert.IsNotNull(foundStore2, "The second store wasn't found when searching by short store name."); }
private void queryFriendInfoHelper(NpgsqlDataReader R) { friendData.Add(new UserInfo() // Made a business class to keep the info together { UserID = R.GetString(0), Username = R.GetString(1), // name likes = R.GetInt32(2), // total likes avgStars = Math.Round(R.GetDouble(3), 2), //average stars date = R.GetDateTime(4) // yelping since date }); }
private void queryLatestTipsHelper(NpgsqlDataReader R) { latestTipsData.Add(new TipInfo() // Made a business class to keep the info together { uid = R.GetString(0), // user id date = (DateTime)R.GetTimeStamp(1), // name name = R.GetString(2), // tip leaver's name text = R.GetString(3), // text in the tip businessname = R.GetString(4), // name of business city = R.GetString(5) //city }); }
GridView Default(bool addItems = true) { var control = new GridView { Size = new Size(300, 100) }; LogEvents(control); var dropDown = MyDropDown("DropDownKey"); control.Columns.Add(new GridColumn { DataCell = new CheckBoxCell("Check"), Editable = true, AutoSize = true, Resizable = false }); control.Columns.Add(new GridColumn { HeaderText = "Image", DataCell = new ImageViewCell("Image") }); control.Columns.Add(new GridColumn { HeaderText = "Text", DataCell = new TextBoxCell("Text"), Editable = true, Sortable = true }); control.Columns.Add(new GridColumn { HeaderText = "Drop Down", DataCell = dropDown, Editable = true, Sortable = true }); #if Windows // Drawable cells - need to implement on other platforms. var drawableCell = new DrawableCell { PaintHandler = args => { var m = args.Item as MyGridItem; if (m != null) { args.Graphics.FillRectangle(Brushes.Cached(m.Color) as SolidBrush, args.CellBounds); } } }; control.Columns.Add(new GridColumn { HeaderText = "Owner drawn", DataCell = drawableCell }); #endif if (addItems) { var items = new DataStoreCollection(); var rand = new Random(); for (int i = 0; i < 10000; i++) { items.Add(new MyGridItem(rand, i, dropDown)); } control.DataStore = items; } return(control); }
public void LoadSetting(Setting setting) { var header = setting.HttpHeaderSetting; if (header.HttpHeaderList != null) { var items = new DataStoreCollection<HeaderItem>(); foreach (var i in header.HttpHeaderList) { items.Add(new HeaderItem(i.Key, i.Value)); } _gridViewHeader.DataStore = items; } }
/// <summary> /// 载入webshell数据 /// </summary> public void LoadWebshellData() { DataTable dataTable = ShellManager.GetDataTable(); if (dataTable == null) { return; } var item = new DataStoreCollection <Shell>(); foreach (DataRow row in dataTable.Rows) { Shell shell = DataConvert.ConvertDataRowToShellStruct(row); item.Add(shell); } _gridViewShell.DataStore = item; }
// Function that adds the businesses to the grid data store. private void queryBusinessHelper(NpgsqlDataReader R) { data.Add(new Business() // Made a business class to keep the info together { // This just populates the info into an instance of the business class // These have to be in the same order as the select statement in the query // or else things break! name = R.GetString(0), // name state = R.GetString(1), // state city = R.GetString(2), // city zip = R.GetString(3), // zip bid = R.GetString(4), // business id addy = R.GetString(5), // address dist = Math.Round(R.GetDouble(6), 2), // distance from user stars = R.GetDouble(7), // number of stars tips = R.GetInt32(8), // number of tips checkins = R.GetInt32(9) // number of check ins }); }
/// <summary> /// 载入webshell数据 /// </summary> public void LoadWebshellData() { DataTable dataTable = ShellManager.GetDataTable(); if (dataTable == null) { return; } var item = new DataStoreCollection<Shell>(); foreach (DataRow row in dataTable.Rows) { Shell shell = DataConvert.ConvertDataRowToShellStruct(row); item.Add(shell); } _gridViewShell.DataStore = item; }
// Adds the columns to the grid. private void addColGrid() { SortStore.Add("Name"); SortStore.Add("Address"); SortStore.Add("Distance"); SortStore.Add("Stars"); SortStore.Add("Tips"); SortStore.Add("Check-ins"); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell("name"), HeaderText = "Business Name", //Width = 300, AutoSize = true, Resizable = false, Sortable = true, Editable = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell("addy"), HeaderText = "Address", //Width = 60, AutoSize = true, Resizable = false, Sortable = true, Editable = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell("city"), HeaderText = "City", //Width = 120, AutoSize = true, Resizable = false, Sortable = true, Editable = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell("state"), HeaderText = "State", //Width = 60, AutoSize = true, Resizable = false, Sortable = true, Editable = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell("dist"), HeaderText = "Distance", //Width = 60, AutoSize = true, Resizable = false, Sortable = true, Editable = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell("stars"), HeaderText = "Stars", //Width = 60, AutoSize = true, Resizable = false, Sortable = true, Editable = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell("tips"), HeaderText = "Tips", //Width = 60, AutoSize = true, Resizable = false, Sortable = true, Editable = false }); grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell("checkins"), HeaderText = "Check-ins", //Width = 60, AutoSize = true, Resizable = false, Sortable = true, Editable = false }); }
private void AddDirsInListViewFile(IEnumerable<OsFile> dirs, IEnumerable<OsFile> files, string parentPath) { _dataStore.Clear(); var item = new DataStoreCollection<FileInfoView>(); //显示dirs foreach (OsFile dir in dirs) { //移除最后的'/'符号 string dirName = dir.FileName.Remove(dir.FileName.Length - 1, 1); //添加fileInfo string fullName = Path.Combine(new string[] { parentPath, dirName }) + (_isWin ? "\\" : "/"); item.Add(new FileInfoView(dirName, fullName, true, dir.FileMTime, dir.FileSize, dir.FilePerms)); } //显示files foreach (OsFile file in files) { //添加fileInfo string dirName = file.FileName; string fullName = Path.Combine(new string[] { parentPath, dirName }); item.Add(new FileInfoView(dirName, fullName, false, file.FileMTime, file.FileSize, file.FilePerms)); } _dataStore.AddRange(item); }
GridView Default(bool addItems = true) { var control = new GridView { Size = new Size(300, 100) }; LogEvents(control); var dropDown = MyDropDown("DropDownKey"); control.Columns.Add(new GridColumn { DataCell = new CheckBoxCell("Check"), Editable = true, AutoSize = true, Resizable = false }); control.Columns.Add(new GridColumn { HeaderText = "Image", DataCell = new ImageViewCell("Image") }); control.Columns.Add(new GridColumn { HeaderText = "Text", DataCell = new TextBoxCell("Text"), Editable = true, Sortable = true }); control.Columns.Add(new GridColumn { HeaderText = "Drop Down", DataCell = dropDown, Editable = true, Sortable = true }); #if Windows // Drawable cells - need to implement on other platforms. var drawableCell = new DrawableCell { PaintHandler = args => { var m = args.Item as MyGridItem; if (m != null) args.Graphics.FillRectangle(Brushes.Cached(m.Color) as SolidBrush, args.CellBounds); } }; control.Columns.Add(new GridColumn { HeaderText = "Owner drawn", DataCell = drawableCell }); #endif if (addItems) { var items = new DataStoreCollection(); var rand = new Random(); for (int i = 0; i < 10000; i++) { items.Add(new MyGridItem(rand, i, dropDown)); } control.DataStore = items; } return control; }