public void EditPort() { //MessageBox.Show(DataGridItem.Name); PortModel SelectedPort = new PortModel(); SelectedPort = DataGridItem; //stores the selected port model Component.Ports.Remove(DataGridItem); //remove port from datapath object //Ports.Remove(DataGridItem); Datagrid.Remove(DataGridItem); //remove port from datagrid this.Port.Clear(); this.Port.Name = SelectedPort.Name; OnPropertyChanged("PortNameTxt"); this.Port.Direction = SelectedPort.Direction; OnPropertyChanged("DirectionSel"); this.Port.Bus = SelectedPort.Bus; OnPropertyChanged("BusSel"); this.Port.MSB = SelectedPort.MSB; OnPropertyChanged("MsbTxt"); this.Port.LSB = SelectedPort.LSB; OnPropertyChanged("LsbTxt"); }
public string Index(FormCollection collection) { //获取所有可以进行操作的元素 Entities _Entities = new Entities(); List <Tmplete> _lstTmplete = _Entities.Tmplete.ToList(); //Tree _Tree = new Tree(); //foreach (var item in _lstTmplete) //{ // _Tree.id = item.ID; // _Tree.text = item.ParamKey; // var m = (from u in _Entities.Tmplete where u.ParentID == item.ID select u); // if (0 < m.Count()) // { // } //} Datagrid <Tmplete> _DatagridDataResult = new Datagrid <Tmplete>(); _DatagridDataResult.total = _lstTmplete.Count(); _DatagridDataResult.rows = _lstTmplete; return(JsonConvert.SerializeObject(_DatagridDataResult)); }
public void PointsOnDatagridAreCorrectColors() { var datagrid = new Datagrid(GetMultiColoredScreen(), Substitute.For <IInputDevice>(), Substitute.For <IOCRReader>(), 1, 3, new [] { 1, 3 }); AssertPixelsOnControlAreCorrect(datagrid); AssertGettingOutOfBoundsPixelsThrows(datagrid); }
public void ClicksCorrectPixelOnDatagrid() { var inputDevice = Substitute.For <IInputDevice>(); var control = new Datagrid(Substitute.For <IScreen>(), inputDevice, Substitute.For <IOCRReader>(), 1, 3, new [] { 1, 3 }); AssertClicksAreCorrect(control, inputDevice); }
public void ReadsResearchTableInWindow() { var screenshot = new HijackableScreenShotCapturer(); var inputDevice = new ResearchTableInWindowInputDevice(screenshot); var screen = new Screen(new ScreenDataRetriever(Substitute.For <ISleeper>(), screenshot)); var window = new Control(screen, inputDevice, 5, 1000, 5, 1000); var ocr = new OCRReader(new OCRSplitter()); var datagrid = new Datagrid(window, inputDevice, ocr, 521, 568, new[] { 370, 652, 718 }) { LineHeight = 16, TopOfCharactersOffset = 3 }; var table = datagrid.GetTable(); Assert.AreEqual(3, table.Count); Assert.AreEqual("GenomeSequenceResearch", table[0][0]); Assert.AreEqual("TerraformingModule", table[1][0]); Assert.AreEqual("TerraformingRate0.0012atm", table[2][0]); Assert.AreEqual("5000", table[0][1]); Assert.AreEqual("5000", table[1][1]); Assert.AreEqual("3000", table[2][1]); }
public void TestDataGridCorrectLocation() { var control = new Datagrid(GetWindow(), Substitute.For <IInputDevice>(), Substitute.For <IOCRReader>(), 20, 40, new [] { 20, 60 }); Assert.AreEqual(30, control.Top); Assert.AreEqual(50, control.Bottom); Assert.AreEqual(30, control.Left); Assert.AreEqual(70, control.Right); }
public void DeletePort() { PortModel SelectedPort = new PortModel(); SelectedPort = DataGridItem; Component.Ports.Remove(DataGridItem); //remove port from datapath object //Ports.Remove(DataGridItem); Datagrid.Remove(DataGridItem); //remove port from datagrid }
public void DeletePort() { PortModel SelectedPort = new PortModel(); SelectedPort = DataGridItem; DataPath.Ports.Remove(DataGridItem); //remove port from datapath object Datagrid.Remove(DataGridItem); //remove port from datagrid Ports.Remove(DataGridItem); }
public PopulationAndProductionWindow(IScreen screen, IWindowFinder windowFinder, IInputDevice inputDevice, IOCRReader ocr, ISettingsStore settings) : base("Population and Production", screen, windowFinder, inputDevice, settings) { ResearchTable = new Datagrid(this, inputDevice, ocr, 406, 613, new [] { 406, 687, 754, 776 }) { LineHeight = 16, TopOfCharactersOffset = 3, Settings = PrintSettings.NewResearchTable }; AvailableScientistsTable = new Datagrid(this, inputDevice, ocr, 406, 613, new[] { 790, 909, 1056, 1184 }) { LineHeight = 16, TopOfCharactersOffset = 3, Settings = PrintSettings.AvailableScientistTable }; ConstructionOptions = new Datagrid(this, inputDevice, ocr, 245, 669, new [] { 398, 599 }) { LineHeight = 16, TopOfCharactersOffset = 3 }; AllocatedLabs = new Textbox(this, inputDevice, ocr, left: 885, right: 929, top: 357, bottom: 371) { CharacterOffset = 3, CharacterHeight = 9, Colors = new[] { new byte[] { 0, 0, 0 } } }; AvailableLabs = new Textbox(this, inputDevice, ocr, left: 1037, right: 1073, top: 357, bottom: 371) { CharacterOffset = 3, CharacterHeight = 9, Colors = new[] { new byte[] { 109, 109, 109 } } }; NumberOfIndustrialProject = new Textbox(this, inputDevice, ocr, left: 725, right: 769, top: 696, bottom: 710) { CharacterOffset = 3, CharacterHeight = 9, Colors = new[] { new byte[] { 0, 0, 0 } } }; CreateIndustrialProject = new Button(this, inputDevice, left: 635, right: 707, top: 730, bottom: 754); InstallationType = new Combobox(this, inputDevice, ocr, left: 501, right: 801, top: 180, bottom: 196) { CharacterOffset = 4, CharacterHeight = 9, Colors = new[] { new byte[] { 0, 0, 0 } } }; ContractAmount = new Textbox(this, inputDevice, ocr, left: 501, right: 553, top: 220, bottom: 234) { CharacterOffset = 3, CharacterHeight = 9, Colors = new[] { new byte[] { 0, 0, 0 } } }; CivilianContractSupply = new RadioButton(this, inputDevice, left: 696, right: 707, top: 220, bottom: 231); CivilianContractDemand = new RadioButton(this, inputDevice, left: 784, right: 795, top: 221, bottom: 232); AddCivilianContract = new Button(this, inputDevice, left: 411, right: 491, top: 514, bottom: 538); Populations = new TreeList(this, inputDevice, ocr, left: 21, right: 361, top: 100, bottom: 807); Populations.Refresh += (sender, args) => { MakeActive(); Empire.SelectOption(1); }; PurchaseMineralOutput = new RadioButton(this, inputDevice, left: 536, right: 547, top: 804, bottom: 815); MassDriverDestination = new Combobox(this, inputDevice, ocr, left: 1005, right: 1184, top: 156, bottom: 172) { CharacterOffset = 4, CharacterHeight = 9, Colors = new[] { new byte[] { 0, 0, 0 } } }; Empire = new Combobox(this, inputDevice, ocr, left: 19, right: 363, top: 46, bottom: 66) { CharacterOffset = 6, CharacterHeight = 11, Colors = new[] { new byte[] { 0, 0, 0 } } }; CurrentResearchProject = new Datagrid(this, inputDevice, ocr, 193, 289, new[] { 399, 632, 799, 859, 929, 999, 1132, 1158 }) { LineHeight = 16, TopOfCharactersOffset = 3 }; RemoveRL = new Button(this, inputDevice, left: 683, right: 763, top: 299, bottom: 323); AddRL = new Button(this, inputDevice, left: 587, right: 667, top: 299, bottom: 323); NumberOfLabs = new Label(this, inputDevice, ocr, left: 515, right: 541, top: 140, bottom: 148); MatchingScientistsOnly = new RadioButton(this, inputDevice, left: 740, right: 750, top: 362, bottom: 372); }