public CardWindow() { _emptyImage = new Bitmap(1, 1); using (var gr = Graphics.FromImage(_emptyImage)) gr.Clear(Color.FromKnownColor(KnownColor.Transparent)); InitializeComponent(); AutoScaleMode = AutoScaleMode.Dpi; UniversalDragAndDrop.SetupDragAndDrop(listView, SimpleDropSink_Dropped, SimpleDropSink_CanDrop, (sender, args) => RefreshList()); SetupImageLists(); olvColumnName.AspectGetter = rowObject => (rowObject as Card)?.Name; olvColumnFilename.AspectGetter = rowObject => (rowObject as Card)?.Location.Name; olvColumnModDate.AspectGetter = rowObject => (rowObject as Card)?.Location.LastWriteTime; olvColumnSex.AspectGetter = rowObject => (rowObject as Card)?.Sex; olvColumnPersonality.AspectGetter = rowObject => (rowObject as Card)?.PersonalityName; olvColumnExtended.AspectGetter = rowObject => (rowObject as Card)?.Extended?.Count.ToString() ?? "-"; Details(this, EventArgs.Empty); ((OLVColumn)listView.Columns[listView.Columns.Count - 1]).FillsFreeSpace = true; _typedListView = new TypedObjectListView <Card>(listView); listView.CacheVirtualItems += ListView_CacheVirtualItems; listView.EmptyListMsgFont = new Font(Font.FontFamily, 24); listView.EmptyListMsg = "No cards were found"; ListTools.SetUpSearchBox(listView, toolStripTextBoxSearch); }
// for ControlCollection and IList public static bool Swap(this IList source, int fromIndex, int toIndex, Action <int, object?> insertAt) { Func <int, object?> getAt = (index) => source[index]; Action <int> removeAt = (index) => source.RemoveAt(index); return(ListTools.SwapItem(fromIndex, toIndex, insertAt, getAt, removeAt)); }
void Start() { myList = ListTools.Ordered(100); myList = ListTools.RandomizeList(myList); main = new Thread(new ThreadStart(StartSort)); main.Start(); }
public SideloaderModsWindow() { InitializeComponent(); _listView = new TypedObjectListView <SideloaderModInfo>(objectListView1); objectListView1.EmptyListMsgFont = new Font(Font.FontFamily, 24); objectListView1.EmptyListMsg = "No mods were found"; objectListView1.FormatRow += ObjectListView1_FormatRow; objectListView1.PrimarySortColumn = olvColumnName; ListTools.SetUpSearchBox(objectListView1, toolStripTextBoxSearch); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } ListTools = await _context.ListTools.FirstOrDefaultAsync(m => m.ToolId == id); if (ListTools == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } ListTools = await _context.ListTools.FindAsync(id); if (ListTools != null) { _context.ListTools.Remove(ListTools); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
void Start() { Panel_Info = _panel.FindChild("Panel_Info"); Panel_Tools = _panel.FindChild("Panel_Tools"); Menu_Item = _panel.FindChild("Menu_Item"); Btn_Info = Menu_Item.GetChild(0).GetComponent<Button>(); Btn_Info.onClick.AddListener(delegate () { to_Info(); }); _listTools = Menu_Item.GetChild(1).GetComponent<ListTools>(); //Panel_Info下的组件 Panel_Description = Panel_Info.FindChild("Panel_Description"); Text_Description = Panel_Description.FindChild("Text_Description").GetComponent<Text>(); Panel_Photo = Panel_Info.FindChild("Panel_Photo"); imgSwitch = Panel_Photo.GetComponent<ImgSwitch>(); init(); }
void Start() { myList = new List <int>(listCount); myList = ListTools.RandomizeList(myList); }
public static void Move <T>(this IList <T> list, int fromIndex, int toIndex) => ListTools.MoveItem <IList <T>, T>(fromIndex, toIndex, (index) => list[index], (index, item) => list.Insert(index, item), (index) => list.RemoveAt(index));
public static OperatorBlueprint compose(OperatorBlueprint orginal, List <int> pathInOrginal, OperatorBlueprint composeWith, EnumReplace replace) { OperatorBlueprint result; TreeElement currentTreeElement; result = orginal.clone(); if (replace == EnumReplace.YES) { List <int> pathWithoutLast = pathInOrginal.GetRange(0, pathInOrginal.Count - 1); int lastPathIndex = pathInOrginal[pathInOrginal.Count - 1]; // check if the pathInOrginal is one of pathToFreeOperators, if this is the case, remove it int pathToFreeOperatorsI; for (pathToFreeOperatorsI = 0; pathToFreeOperatorsI < result.pathsToFreeOperators.Count; pathToFreeOperatorsI++) { List <int> pathsToFreeOperator; pathsToFreeOperator = result.pathsToFreeOperators[pathToFreeOperatorsI]; if (ListTools.isListTheSameInt(pathsToFreeOperator, pathInOrginal)) { result.pathsToFreeOperators.RemoveAt(pathToFreeOperatorsI); pathToFreeOperatorsI--; continue; } } // include path to free operators from composeWith List <List <int> > pathsWithAppendedPath = appendPathsToPath(pathInOrginal, composeWith.pathsToFreeOperators); result.pathsToFreeOperators.AddRange(pathsWithAppendedPath); // walk the path in the orginal/result // without the last because we replace it currentTreeElement = walkTreeElementByPath(result.rootTreeElement, pathWithoutLast); currentTreeElement.childrens[lastPathIndex] = cloneTreeElement(composeWith.rootTreeElement); } else if (replace == EnumReplace.NO) { // TODO throw new NotImplementedException(); // walk the path in the orginal/result // without the last because we replace it //currentTreeElement = walkTreeElementByPath(result.rootTreeElement, pathInOrginal); // must be a branch because we add the other plan of the operator/scaffold currentTreeElement.type = TreeElement.EnumType.BRANCH; // add foreach (TreeElement iterationChildElement in composeWith.rootTreeElement.childrens) { currentTreeElement.childrens.Add(cloneTreeElement(iterationChildElement)); } } else { throw new Exception("internal error"); } return(result); }
public Form1() { InitializeComponent(); ListTools h = new ListTools(); }