Beispiel #1
0
        private void AddValidRow(DataGridViewRow dr, Dictionary<string, string> results)
        {
            if (results.Count == 0) return;

            // Prepare the new row
            DataGridViewRow dgvr = new DataGridViewRow();
            dgvr.CreateCells(gridViewResults);
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            style.BackColor = Color.LightGreen;
            style.ForeColor = Color.Black;
            dgvr.Cells[3].Style = style;

            // Based on the Crawling Settings, add the new data to the result grid view
            switch (cs.CrawlItemType)
            {
                case "Social Media":
                    dgvr.SetValues(new object[] {count, dr.Cells[1].Value, dr.Cells[2].Value, "Valid", results["facebook"], results["linkedin"], results["twitter"], results["youtube"] });
                    SaveToDB(count, dr.Cells[1].Value, dr.Cells[2].Value, "Valid", results["facebook"], results["linkedin"], results["twitter"], results["youtube"]);
                    break;
                case "Contact Info":
                    dgvr.SetValues(new object[] {count, dr.Cells[1].Value, dr.Cells[2].Value, "Valid", results["email"], results["phone"], results["fax"] });

                    break;

            }
            gridViewResults.Rows.Add(dgvr);
        }
		public DialogShipGroupColumnFilter( DataGridView target, ShipGroupData group ) {
			InitializeComponent();


			var rows = new LinkedList<DataGridViewRow>();
			var row = new DataGridViewRow();

			row.CreateCells( ColumnView );
			row.SetValues( "(全て)", null, null, "-" );
			row.Cells[ColumnView_Width.Index].ReadOnly = true;
			rows.AddLast( row );

			foreach ( var c in group.ViewColumns.Values.OrderBy( c => c.DisplayIndex ) ) {
				row = new DataGridViewRow();
				row.CreateCells( ColumnView );
				row.SetValues( target.Columns[c.Name].HeaderText, c.Visible, c.AutoSize, c.Width );
				row.Cells[ColumnView_Width.Index].ValueType = typeof( int );
				row.Tag = c.Name;
				rows.AddLast( row );
			}

			ColumnView.Rows.AddRange( rows.ToArray() );


			ScrLkColumnCount.Minimum = 0;
			ScrLkColumnCount.Maximum = group.ViewColumns.Count;
			ScrLkColumnCount.Value = group.ScrollLockColumnCount;
		}
Beispiel #3
0
        private void AddInvalidRow(DataGridViewRow dr)
        {
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            style.BackColor = Color.Red;
            style.ForeColor = Color.Black;

            DataGridViewRow dgvr = new DataGridViewRow();
            dgvr.CreateCells(gridViewResults);
            dgvr.SetValues(new object[] {count, dr.Cells[1].Value, dr.Cells[2].Value, "Invalid" });
            dgvr.Cells[3].Style = style;
            gridViewResults.Rows.Add(dgvr);
        }
Beispiel #4
0
        /// <summary>
        /// Adds a new tune to the Tune List. 
        /// </summary>
        /// <param name="assetNumber">Tune asset number</param>
        /// <param name="tuneType">Tune type</param>
        /// <param name="tuneDate">Tune date</param>
        /// <param name="entryDate">Date tune entered into program</param>
        /// <param name="staffMember">Tuning staff</param>
        /// <param name="notes">Extra notes about the tune</param>
        public void AddNewTune(string assetNumber, string tuneType, string tuneDate, string entryDate, string staffMember, string notes)
        {
            DataGridViewRow row = new DataGridViewRow();
            row.CreateCells(mTuneListDGV);
            bool rowSet = row.SetValues(assetNumber, tuneType, tuneDate, entryDate, staffMember, notes);
            row.HeaderCell.Value = (1 + mTuneListDGV.Rows.Count).ToString() ;
            mTuneListDGV.Rows.Add(row);

            // The first entered row will be selected, we dont want this to happen.
            if (mTuneListDGV.Rows.Count == 1)
            {
                mTuneListDGV.Rows[0].Selected = false;

                // Now that the first row is inserted and unselected we can
                // enable calls to OnSelectionChanged to actually do something
                mAllowSelectionChange = true;
            }
        }
		public DialogShipGroupSortOrder( DataGridView target, ShipGroupData group ) {
			InitializeComponent();

			var rows_enabled = new LinkedList<DataGridViewRow>();
			var rows_disabled = new LinkedList<DataGridViewRow>();

			var columns = target.Columns.Cast<DataGridViewColumn>();
			var names = columns.Select( c => c.Name );


			if ( group.SortOrder == null )
				group.SortOrder = new List<KeyValuePair<string, ListSortDirection>>();

			foreach ( var sort in group.SortOrder.Where( s => names.Contains( s.Key ) ) ) {

				var row = new DataGridViewRow();

				row.CreateCells( EnabledView );
				row.SetValues( target.Columns[sort.Key].HeaderText, sort.Value );
				row.Cells[EnabledView_Name.Index].Tag = sort.Key;
				row.Tag = columns.FirstOrDefault( c => c.Name == sort.Key ).DisplayIndex;

				rows_enabled.AddLast( row );
			}

			foreach ( var name in names.Where( n => group.SortOrder.Count( s => n == s.Key ) == 0 ) ) {

				var row = new DataGridViewRow();

				row.CreateCells( DisabledView );
				row.SetValues( target.Columns[name].HeaderText );
				row.Cells[DisabledView_Name.Index].Tag = name;
				row.Tag = columns.FirstOrDefault( c => c.Name == name ).DisplayIndex;

				rows_disabled.AddLast( row );
			}

			EnabledView.Rows.AddRange( rows_enabled.ToArray() );
			DisabledView.Rows.AddRange( rows_disabled.ToArray() );


			AutoSortFlag.Checked = group.AutoSortEnabled;
		}
        /// <summary>
        /// 更新dataGridView
        /// </summary>
        /// <param name="_alarmlist"></param>
        public void UpdateDataGrid(AlarmList _alarmlist)
        {
            dgvAlarmList.Rows.Clear();

            int i = 0;
            foreach (Alarm alarm in _alarmlist)
            {
                DataGridViewRow dgvr = new DataGridViewRow();
                dgvr.SetValues(new object[4]);

                dgvAlarmList.Rows.Add(dgvr);

                dgvAlarmList.Rows[i].Cells["id"].Value = alarm.ID;
                dgvAlarmList.Rows[i].Cells["unit"].Value = alarm.Unit;
                dgvAlarmList.Rows[i].Cells["channel"].Value = alarm.Chanenl;
                dgvAlarmList.Rows[i].Cells["action"].Value = alarm.AlarmEvent;
                dgvAlarmList.Rows[i].Cells["time"].Value = alarm.Time;

                //取出AlarmRoot
                Data.AlarmRoot alarmRoot = new Data.AlarmRoot(Convert.ToInt32(alarm.Chanenl.IP), alarm.Unit.IP,
                                                              alarm.Chanenl.Code);
                AlAlarmRoot.Add(alarmRoot.ToString());

                i = i + 1;
            }

            dgv_Resize(dgvAlarmList);

            //排序
            if (dgvAlarmList.Columns != null)
            {
                // ReSharper disable AssignNullToNotNullAttribute
                dgvAlarmList.Sort(dgvAlarmList.Columns["id"], ListSortDirection.Ascending);
                // ReSharper restore AssignNullToNotNullAttribute
            }
        }
        /// <summary>
        /// ShipView用の新しい行のインスタンスを作成します。
        /// </summary>
        /// <param name="ship">追加する艦娘データ。</param>
        private DataGridViewRow CreateShipViewRow( ShipData ship )
        {
            if ( ship == null ) return null;

            DataGridViewRow row = new DataGridViewRow();
            row.CreateCells( ShipView );

            row.SetValues(
                ship.MasterID,
                ship.MasterShip.ShipType,
                ship.MasterShip.Name,
                ship.Level,
                ship.ExpTotal,
                ship.ExpNext,
                ship.ExpNextRemodel,
                new Fraction( ship.HPCurrent, ship.HPMax ),
                ship.Condition,
                new Fraction( ship.Fuel, ship.MasterShip.Fuel ),
                new Fraction( ship.Ammo, ship.MasterShip.Ammo ),
                GetEquipmentString( ship, 0 ),
                GetEquipmentString( ship, 1 ),
                GetEquipmentString( ship, 2 ),
                GetEquipmentString( ship, 3 ),
                GetEquipmentString( ship, 4 ),
                ship.FleetWithIndex,
                ship.RepairingDockID == -1 ? ship.RepairTime : -1000 + ship.RepairingDockID,
                ship.FirepowerBase,
                ship.FirepowerRemain,
                ship.TorpedoBase,
                ship.TorpedoRemain,
                ship.AABase,
                ship.AARemain,
                ship.ArmorBase,
                ship.ArmorRemain,
                ship.ASWBase,
                ship.EvasionBase,
                ship.LOSBase,
                ship.LuckBase,
                ship.LuckRemain,
                ship.IsLocked,
                ship.SallyArea
                );

            row.Cells[ShipView_Name.Index].Tag = ship.ShipID;
            row.Cells[ShipView_Level.Index].Tag = ship.ExpTotal;

            {
                DataGridViewCellStyle cs;
                double hprate = (double)ship.HPCurrent / Math.Max( ship.HPMax, 1 );
                if ( hprate <= 0.25 )
                    cs = CSRedRight;
                else if ( hprate <= 0.50 )
                    cs = CSOrangeRight;
                else if ( hprate <= 0.75 )
                    cs = CSYellowRight;
                else if ( hprate < 1.00 )
                    cs = CSGreenRight;
                else
                    cs = CSDefaultRight;

                row.Cells[ShipView_HP.Index].Style = cs;
            }
            {
                DataGridViewCellStyle cs;
                if ( ship.Condition < 20 )
                    cs = CSRedRight;
                else if ( ship.Condition < 30 )
                    cs = CSOrangeRight;
                else if ( ship.Condition < Utility.Configuration.Config.Control.ConditionBorder )
                    cs = CSYellowRight;
                else if ( ship.Condition < 50 )
                    cs = CSDefaultRight;
                else
                    cs = CSGreenRight;

                row.Cells[ShipView_Condition.Index].Style = cs;
            }
            row.Cells[ShipView_Fuel.Index].Style = ship.Fuel < ship.MasterShip.Fuel ? CSYellowRight : CSDefaultRight;
            row.Cells[ShipView_Ammo.Index].Style = ship.Fuel < ship.MasterShip.Fuel ? CSYellowRight : CSDefaultRight;
            {
                DataGridViewCellStyle cs;
                if ( ship.RepairTime == 0 )
                    cs = CSDefaultRight;
                else if ( ship.RepairTime < 1000 * 60 * 60 )
                    cs = CSYellowRight;
                else if ( ship.RepairTime < 1000 * 60 * 60 * 6 )
                    cs = CSOrangeRight;
                else
                    cs = CSRedRight;

                row.Cells[ShipView_RepairTime.Index].Style = cs;
            }
            row.Cells[ShipView_FirepowerRemain.Index].Style = ship.FirepowerRemain == 0 ? CSGrayRight : CSDefaultRight;
            row.Cells[ShipView_TorpedoRemain.Index].Style = ship.TorpedoRemain == 0 ? CSGrayRight : CSDefaultRight;
            row.Cells[ShipView_AARemain.Index].Style = ship.AARemain == 0 ? CSGrayRight : CSDefaultRight;
            row.Cells[ShipView_ArmorRemain.Index].Style = ship.ArmorRemain == 0 ? CSGrayRight : CSDefaultRight;
            row.Cells[ShipView_LuckRemain.Index].Style = ship.LuckRemain == 0 ? CSGrayRight : CSDefaultRight;

            row.Cells[ShipView_Locked.Index].Style = ship.IsLocked ? CSIsLocked : CSDefaultCenter;

            return row;
        }
		private void LoadFiles( string path ) {

			if ( !Directory.Exists( path ) ) return;

			CurrentPath = path;

			APIView.Rows.Clear();

			var rows = new LinkedList<DataGridViewRow>();

			foreach ( string file in Directory.GetFiles( path, "*.json", SearchOption.TopDirectoryOnly ) ) {

				var row = new DataGridViewRow();
				row.CreateCells( APIView );

				row.SetValues( Path.GetFileName( file ) );
				rows.AddLast( row );

			}

			APIView.Rows.AddRange( rows.ToArray() );
			APIView.Sort( APIView_FileName, ListSortDirection.Ascending );

		}
        /// <summary>
        /// 詳細ビューを更新します。
        /// </summary>
        private void UpdateDetailView( int equipmentID )
        {
            DetailView.SuspendLayout();

            DetailView.Rows.Clear();

            //装備数カウント
            var eqs = KCDatabase.Instance.Equipments.Values.Where( eq => eq.EquipmentID == equipmentID );
            var countlist = new IDDictionary<DetailCounter>();

            foreach ( var eq in eqs ) {
                var c = countlist[DetailCounter.CalculateID( eq )];
                if ( c == null ) {
                    countlist.Add( new DetailCounter( eq.Level, eq.AircraftLevel ) );
                    c = countlist[DetailCounter.CalculateID( eq )];
                }
                c.countAll++;
                c.countRemain++;
                c.countRemainPrev++;
            }

            //装備艦集計
            foreach ( var ship in KCDatabase.Instance.Ships.Values ) {

                foreach ( var eq in ship.AllSlotInstance.Where( s => s != null && s.EquipmentID == equipmentID ) ) {

                    countlist[DetailCounter.CalculateID( eq )].countRemain--;

                }

                foreach ( var c in countlist.Values ) {
                    if ( c.countRemain != c.countRemainPrev ) {

                        int diff = c.countRemainPrev - c.countRemain;

                        c.equippedShips.Add( ship.NameWithLevel + ( diff > 1 ? ( " x" + diff ) : "" ) );

                        c.countRemainPrev = c.countRemain;
                    }
                }

            }

            //行に反映
            var rows = new List<DataGridViewRow>( eqs.Count() );

            foreach ( var c in countlist.Values ) {

                if ( c.equippedShips.Count() == 0 ) {
                    c.equippedShips.Add( "" );
                }

                foreach ( var s in c.equippedShips ) {

                    var row = new DataGridViewRow();
                    row.CreateCells( DetailView );
                    row.SetValues( c.level, c.aircraftLevel, c.countAll, c.countRemain, s );
                    rows.Add( row );
                }

            }

            DetailView.Rows.AddRange( rows.ToArray() );
            DetailView.Sort( DetailView_AircraftLevel, ListSortDirection.Ascending );
            DetailView.Sort( DetailView_Level, ListSortDirection.Ascending );

            DetailView.ResumeLayout();

            Text = "装備一覧 - " + KCDatabase.Instance.MasterEquipments[equipmentID].Name;
        }
		public DialogAlbumMasterShip() {
			InitializeComponent();

			Aircrafts = new ImageLabel[] { Aircraft1, Aircraft2, Aircraft3, Aircraft4, Aircraft5 };
			Equipments = new ImageLabel[] { Equipment1, Equipment2, Equipment3, Equipment4, Equipment5 };


			TitleHP.ImageList =
			TitleFirepower.ImageList =
			TitleTorpedo.ImageList =
			TitleAA.ImageList =
			TitleArmor.ImageList =
			TitleASW.ImageList =
			TitleEvasion.ImageList =
			TitleLOS.ImageList =
			TitleLuck.ImageList =
			TitleSpeed.ImageList =
			TitleRange.ImageList =
			Rarity.ImageList =
			Fuel.ImageList =
			Ammo.ImageList =
			TitleBuildingTime.ImageList =
			MaterialFuel.ImageList =
			MaterialAmmo.ImageList =
			MaterialSteel.ImageList =
			MaterialBauxite.ImageList =
			PowerUpFirepower.ImageList =
			PowerUpTorpedo.ImageList =
			PowerUpAA.ImageList =
			PowerUpArmor.ImageList =
			RemodelBeforeLevel.ImageList =
			RemodelBeforeAmmo.ImageList =
			RemodelBeforeSteel.ImageList =
			RemodelAfterLevel.ImageList =
			RemodelAfterAmmo.ImageList =
			RemodelAfterSteel.ImageList =
				ResourceManager.Instance.Icons;

			TitleAirSuperiority.ImageList =
			TitleDayAttack.ImageList =
			TitleNightAttack.ImageList =
			Equipment1.ImageList =
			Equipment2.ImageList =
			Equipment3.ImageList =
			Equipment4.ImageList =
			Equipment5.ImageList =
				ResourceManager.Instance.Equipments;

			TitleHP.ImageIndex = (int)ResourceManager.IconContent.ParameterHP;
			TitleFirepower.ImageIndex = (int)ResourceManager.IconContent.ParameterFirepower;
			TitleTorpedo.ImageIndex = (int)ResourceManager.IconContent.ParameterTorpedo;
			TitleAA.ImageIndex = (int)ResourceManager.IconContent.ParameterAA;
			TitleArmor.ImageIndex = (int)ResourceManager.IconContent.ParameterArmor;
			TitleASW.ImageIndex = (int)ResourceManager.IconContent.ParameterASW;
			TitleEvasion.ImageIndex = (int)ResourceManager.IconContent.ParameterEvasion;
			TitleLOS.ImageIndex = (int)ResourceManager.IconContent.ParameterLOS;
			TitleLuck.ImageIndex = (int)ResourceManager.IconContent.ParameterLuck;
			TitleSpeed.ImageIndex = (int)ResourceManager.IconContent.ParameterSpeed;
			TitleRange.ImageIndex = (int)ResourceManager.IconContent.ParameterRange;
			Fuel.ImageIndex = (int)ResourceManager.IconContent.ResourceFuel;
			Ammo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
			TitleBuildingTime.ImageIndex = (int)ResourceManager.IconContent.FormArsenal;
			MaterialFuel.ImageIndex = (int)ResourceManager.IconContent.ResourceFuel;
			MaterialAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
			MaterialSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel;
			MaterialBauxite.ImageIndex = (int)ResourceManager.IconContent.ResourceBauxite;
			PowerUpFirepower.ImageIndex = (int)ResourceManager.IconContent.ParameterFirepower;
			PowerUpTorpedo.ImageIndex = (int)ResourceManager.IconContent.ParameterTorpedo;
			PowerUpAA.ImageIndex = (int)ResourceManager.IconContent.ParameterAA;
			PowerUpArmor.ImageIndex = (int)ResourceManager.IconContent.ParameterArmor;
			RemodelBeforeAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
			RemodelBeforeSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel;
			RemodelAfterAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
			RemodelAfterSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel;
			TitleAirSuperiority.ImageIndex = (int)ResourceManager.EquipmentContent.CarrierBasedFighter;
			TitleDayAttack.ImageIndex = (int)ResourceManager.EquipmentContent.Seaplane;
			TitleNightAttack.ImageIndex = (int)ResourceManager.EquipmentContent.Torpedo;

			ParameterLevel.Value = ParameterLevel.Maximum = ExpTable.ShipMaximumLevel;
			

			TableBattle.Visible = false;
			BasePanelShipGirl.Visible = false;


			ControlHelper.SetDoubleBuffered( TableShipName );
			ControlHelper.SetDoubleBuffered( TableParameterMain );
			ControlHelper.SetDoubleBuffered( TableParameterSub );
			ControlHelper.SetDoubleBuffered( TableConsumption );
			ControlHelper.SetDoubleBuffered( TableEquipment );
			ControlHelper.SetDoubleBuffered( TableArsenal );
			ControlHelper.SetDoubleBuffered( TableRemodel );
			ControlHelper.SetDoubleBuffered( TableBattle );

			ControlHelper.SetDoubleBuffered( ShipView );


			//ShipView Initialize
			ShipView.SuspendLayout();

			ShipView_ShipID.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			ShipView_ShipType.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;


			ShipView.Rows.Clear();

			List<DataGridViewRow> rows = new List<DataGridViewRow>( KCDatabase.Instance.MasterShips.Values.Count( s => s.Name != "なし" ) );

			foreach ( var ship in KCDatabase.Instance.MasterShips.Values ) {

				if ( ship.Name == "なし" ) continue;

				DataGridViewRow row = new DataGridViewRow();
				row.CreateCells( ShipView );
				row.SetValues( ship.ShipID, KCDatabase.Instance.ShipTypes[ship.ShipType].Name, ship.NameWithClass );
				rows.Add( row );

			}
			ShipView.Rows.AddRange( rows.ToArray() );

			ShipView_ShipID.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
			ShipView_ShipType.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;

			ShipView.Sort( ShipView_ShipID, ListSortDirection.Ascending );
			ShipView.ResumeLayout();
		}
		public DialogAlbumMasterEquipment() {
			InitializeComponent();

			TitleFirepower.ImageList =
			TitleTorpedo.ImageList =
			TitleAA.ImageList =
			TitleArmor.ImageList =
			TitleASW.ImageList =
			TitleEvasion.ImageList =
			TitleLOS.ImageList =
			TitleAccuracy.ImageList =
			TitleBomber.ImageList =
			TitleSpeed.ImageList =
			TitleRange.ImageList =
			Rarity.ImageList =
			MaterialFuel.ImageList =
			MaterialAmmo.ImageList =
			MaterialSteel.ImageList =
			MaterialBauxite.ImageList =
				ResourceManager.Instance.Icons;

			EquipmentType.ImageList = ResourceManager.Instance.Equipments;

			TitleFirepower.ImageIndex = (int)ResourceManager.IconContent.ParameterFirepower;
			TitleTorpedo.ImageIndex = (int)ResourceManager.IconContent.ParameterTorpedo;
			TitleAA.ImageIndex = (int)ResourceManager.IconContent.ParameterAA;
			TitleArmor.ImageIndex = (int)ResourceManager.IconContent.ParameterArmor;
			TitleASW.ImageIndex = (int)ResourceManager.IconContent.ParameterASW;
			TitleEvasion.ImageIndex = (int)ResourceManager.IconContent.ParameterEvasion;
			TitleLOS.ImageIndex = (int)ResourceManager.IconContent.ParameterLOS;
			TitleAccuracy.ImageIndex = (int)ResourceManager.IconContent.ParameterAccuracy;
			TitleBomber.ImageIndex = (int)ResourceManager.IconContent.ParameterBomber;
			TitleSpeed.ImageIndex = (int)ResourceManager.IconContent.ParameterSpeed;
			TitleRange.ImageIndex = (int)ResourceManager.IconContent.ParameterRange;
			MaterialFuel.ImageIndex = (int)ResourceManager.IconContent.ResourceFuel;
			MaterialAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
			MaterialSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel;
			MaterialBauxite.ImageIndex = (int)ResourceManager.IconContent.ResourceBauxite;


			BasePanelEquipment.Visible = false;


			ControlHelper.SetDoubleBuffered( TableEquipmentName );
			ControlHelper.SetDoubleBuffered( TableParameterMain );
			ControlHelper.SetDoubleBuffered( TableParameterSub );
			ControlHelper.SetDoubleBuffered( TableArsenal );

			ControlHelper.SetDoubleBuffered( EquipmentView );


			//Initialize EquipmentView
			EquipmentView.SuspendLayout();

			EquipmentView_ID.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			EquipmentView_Icon.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			//EquipmentView_Type.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;


			EquipmentView.Rows.Clear();

			List<DataGridViewRow> rows = new List<DataGridViewRow>( KCDatabase.Instance.MasterEquipments.Values.Count( s => s.Name != "なし" ) );

			foreach ( var eq in KCDatabase.Instance.MasterEquipments.Values ) {

				if ( eq.Name == "なし" ) continue;

				DataGridViewRow row = new DataGridViewRow();
				row.CreateCells( EquipmentView );
				row.SetValues( eq.EquipmentID, eq.IconType, FormMain.Instance.Translator.GetTranslation(eq.CategoryTypeInstance.Name, Utility.TranslationType.EquipmentType), eq.Name );
				rows.Add( row );

			}
			EquipmentView.Rows.AddRange( rows.ToArray() );

			EquipmentView_ID.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
			EquipmentView_Icon.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
			//EquipmentView_Type.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;

			EquipmentView.Sort( EquipmentView_ID, ListSortDirection.Ascending );
			EquipmentView.ResumeLayout();

		}
        private void UpdateBGMPlayerUI()
        {
            BGMPlayer_ControlGrid.Rows.Clear();

            var rows = new DataGridViewRow[BGMHandles.Count];

            int i = 0;
            foreach ( var h in BGMHandles.Values ) {
                var row = new DataGridViewRow();
                row.CreateCells( BGMPlayer_ControlGrid );
                row.SetValues( h.Enabled, h.HandleID, h.Path );
                rows[i] = row;
                i++;
            }

            BGMPlayer_ControlGrid.Rows.AddRange( rows );

            BGMPlayer_VolumeAll.Value = (int)BGMHandles.Values.Average( h => h.Volume );
        }
Beispiel #13
0
        void BindRow(DataGridViewRow row)
        {
            var vals = new object[Grid.Columns.Count];

            var t = (Test)row.Tag;
            if (t == null) throw new InvalidOperationException ("Row has no associated Test");

            if (t.Result == TestResult.Pass) {
                vals[_resultImageColIndex] = AllImages.Images[PassStatusIcon];
            }
            else if (t.Result == TestResult.Fail) {
                vals[_resultImageColIndex] = AllImages.Images[FailStatusIcon];
            }
            else if (t.Result == TestResult.Unknown) {
                vals[_resultImageColIndex] = AllImages.Images[UnknownStatusIcon];
            }

            if (!_funcElm.IsShared) {
                vals[_thisColIndex] = t.ThisString;
            }

            foreach (var p in _paramInfos) {
                var arg = t.GetArgument (p.Name);
                vals[p.ColIndex] = arg.ValueString;
            }

            if (_testType == TestType.Function || _testType == TestType.PropertyGetter) {
                vals[_resultColIndex] = t.ValueString;
                vals[_expectedColIndex] = t.ExpectedValueString;
            }

            vals[_assertColIndex] = t.AssertString;

            vals[_failColIndex] = TrimCellText (t.FailInfo);

            row.SetValues (vals);
        }
Beispiel #14
0
        public void refresh(string connectionString)
        {
            List<int> focus_ids = new List<int>();

            foreach (DataGridViewRow row in SelectedRows)
            {
                focus_ids.Add(row.Index);
            }
            int scrollIndexDiff = 0;
            try {
                scrollIndexDiff = this.SelectedRows[0].Index - this.FirstDisplayedScrollingRowIndex;
            }
            catch { }

            Rows.Clear();

            try
            {
                using (SqlConnection con = new SqlConnection(connectionString))
                {
                    con.Open();
                    using (SqlCommand command = new SqlCommand(SelectQuery, con))
                    {
                        SqlDataReader reader = command.ExecuteReader();
                        while (reader.Read())
                        {
                            object[] values = new object[reader.FieldCount];
                            reader.GetValues(values);
                            DataGridViewRow row = new DataGridViewRow();
                            row.CreateCells(this);
                            row.SetValues(values);
                            this.Rows.Add(row);
                        }
                        reader.Close();
                    }
                    con.Close();
                }
            }
            catch { }

            tablestrip.filter_use(this);

            foreach (DataGridViewRow row in Rows)
            {
                if (focus_ids.Contains(row.Index))
                {
                    row.Selected = true;
                }
                else
                {
                    row.Selected = false;
                }
            }

            int scrollIndex = 0;
            try { scrollIndex = this.SelectedRows[0].Index; } catch { }
            while (scrollIndexDiff != 0)
            {
                if (scrollIndex == 0)
                {
                    foreach (DataGridViewRow row in this.Rows)
                    {
                        if (row.Visible == true)
                        {
                            scrollIndex = row.Index;
                            break;
                        }
                    }
                    break;
                }
                scrollIndex--;
                if (this.Rows[scrollIndex].Visible == true)
                {
                    scrollIndexDiff--;
                }
            }
            this.FirstDisplayedScrollingRowIndex = scrollIndex;
        }
		private void ClearQuestView() {

			QuestView.Rows.Clear();

			{
				DataGridViewRow row = new DataGridViewRow();
				row.CreateCells( QuestView );
				row.SetValues( null, null, null, GeneralRes.Unacquired, null );
				QuestView.Rows.Add( row );
			}

		}
        public GameResultForm(GameResult Game, bool isProcessed)
        {
            InitializeComponent();

            // Build Team Grid 1
            foreach (Player P in Game.GetPlayersByTeam(1).OrderByDescending(p => p.RoundScore))
            {
                DataGridViewRow Row = new DataGridViewRow();
                Row.CreateCells(Team1Grid);
                Row.SetValues(new object[] {
                    Image.FromStream(Me.GetManifestResourceStream("BF2Statistics.Resources.rank_" + P.Rank + "icon.gif")),
                    P.Name, P.RoundScore, P.Stats.Kills, P.Stats.Deaths
                });
                Row.Tag = P.Pid;
                Team1Grid.Rows.Add(Row);
            }

            // Build Team Grid 2
            foreach (Player P in Game.GetPlayersByTeam(2).OrderByDescending(p => p.RoundScore))
            {
                DataGridViewRow Row = new DataGridViewRow();
                Row.CreateCells(Team2Grid);
                Row.SetValues(new object[] {
                    Image.FromStream(Me.GetManifestResourceStream("BF2Statistics.Resources.rank_" + P.Rank + "icon.gif")),
                    P.Name, P.RoundScore, P.Stats.Kills, P.Stats.Deaths
                });
                Row.Tag = P.Pid;
                Team2Grid.Rows.Add(Row);
            }

            // Set flag images
            ArmyFlag1.Image = Image.FromStream(Me.GetManifestResourceStream("BF2Statistics.Resources.armyflag_" + GetArmyCode(Game.Team1ArmyId) + ".png"));
            ArmyFlag2.Image = Image.FromStream(Me.GetManifestResourceStream("BF2Statistics.Resources.armyflag_" + GetArmyCode(Game.Team2ArmyId) + ".png"));

            // Set team names
            TeamName1.Text = ArmyNames[Game.Team1ArmyId];
            TeamName2.Text = ArmyNames[Game.Team2ArmyId];

            // Set secondary team text
            if (Game.WinningTeam == 1)
            {
                TicketsLabel1.Text = "Has won the Round!";
            }
            else if (Game.WinningTeam == 2)
            {
                TicketsLabel2.Text = "Has won the Round!";
            }
            else
            {
                TicketsLabel1.Text = "Remaining Tickets: " + Game.Team1Tickets;
                TicketsLabel2.Text = "Remaining Tickets: " + Game.Team2Tickets;
            }

            // Set window title text
            this.Text = String.Format("Game Result: {0} [{1}] - {2} UTC", Game.MapName, Game.Mod, Game.RoundEndDate.ToString());
            this.MapNameLabel.Text = Game.MapName + " (ID: " + Game.MapId + ")";
            this.ModLabel.Text = Game.Mod;
            this.KillsLabel.Text = Game.MapKills.ToString();
            this.DeathsLabel.Text = Game.MapDeaths.ToString();
            this.StartTimeLabel.Text = DateTime.UtcNow.FromUnixTimestamp(Game.RoundStartTime).ToLocalTime().ToString();
            this.EndTimeLabel.Text = DateTime.UtcNow.FromUnixTimestamp(Game.RoundEndTime).ToLocalTime().ToString();
            this.RoundTimeLabel.Text = Game.RoundTime.ToString();
            this.ServerNameLabel.Text = Game.ServerName;
            this.ServerPortLabel.Text = Game.ServerPort.ToString();
            this.TotalPlayersLabel.Text = Game.PlayersConnected.ToString();
            this.Team1PlayersLabel.Text = Game.Team1Players.ToString();
            this.Team2PlayersLabel.Text = Game.Team2Players.ToString();
            this.EorPlayers1Label.Text = Game.Team1PlayersEnd.ToString();
            this.EorPlayers2Label.Text = Game.Team2PlayersEnd.ToString();
            this.RoundProcLabel.Text = isProcessed ? "True" : "False";

            // Set Gamemode
            this.GameModeLabel.Text = GetGameModeText(Game.GameMode);
        }
Beispiel #17
0
 private void insertNewRowToolStripMenuItem_Click(object sender, EventArgs e)
 {
     int x = 0;
     indexOfInsertion = dataGridView1.CurrentRow.Index+1;
     DataGridViewRow dr = new DataGridViewRow();
     dr.CreateCells(dataGridView1, new string[] { "", "" });
     dr.SetValues(new string[] { "", "" });
     dataGridView1.Rows.InsertRange(indexOfInsertion, dr);
     //dataGridView1.Sort(dataGridView1.Columns[0], System.ComponentModel.ListSortDirection.Descending);
     newRow = true;
 }
 private void RowRefresh(DataGridViewRow r, SvnExternalItem ii)
 {
     r.SetValues(
         ii.Reference,
         null,
         ii.Revision.ToString(),
         null,
         ii.Target);
 }
Beispiel #19
0
 public void FillData(DataGridViewRow row, World world)
 {
     row.SetValues(
             AntName,
             DirectFactor,
             string.Format("{0}, {1}", AntPosition.X, AntPosition.Y),
             world.hiveSmell[AntPosition.X, AntPosition.Y],
             world.foodSmell[AntPosition.X, AntPosition.Y],
             Loaded,
             DistanceFromHive,
             LastDecision);
 }
 private void onRuleSave(IO2Rule o2SavedRule, DataGridViewRow currentRow)
 {
     if (currentRow!= null)
         currentRow.SetValues(getRowDataFromO2Fule(o2SavedRule));
     addRuleToChangedRulesList(o2SavedRule);
 }
Beispiel #21
0
        public DataGridViewRow getDataGridViewRow(DataGridView dg, KeeperTracker mt)
        {
            DataGridViewRow row = new DataGridViewRow();
            row.CreateCells(dg);

            string dgIdentifier = this.ident.ToString("X").PadLeft(8, '0') + "h";
            string dgRemoteRequest = (this.remote_request?"Yes":"No");
            string dgLength = this.data_length.ToString();
            string dgData = byteArrayToHexString(this.data, this.data_length);
            string dgPeriod = mt.getPeriod(this).ToString();
            string dgCount = mt.getCount(this).ToString();
            string dgTime = mt.getTime(this).ToLongTimeString();

            ArrayList a = new ArrayList();
            a.Add(dgIdentifier);
            a.Add(dgRemoteRequest);
            a.Add(dgLength);
            a.Add(dgData);
            a.Add(dgPeriod);
            a.Add(dgCount);
            a.Add(dgTime);
            a.Add(this.ident);
            a.Add(this);
            row.SetValues(a.ToArray());

            return row;
        }
Beispiel #22
0
        /// <summary>
        /// Load any maze data
        /// </summary>
        /// <param name="rows"></param>
        private void LoadGrid(int grid, string[] rows = null, int startRow = 0)
        {
            // Clear datagrid
            while (App.GetLevel(grid).Columns.Count > 0)
                App.GetLevel(grid).Columns.RemoveAt(0);

            // set columns
            int[] defaultRow = new int[Config.X_COUNT];
            for (int col = 0; col < Config.X_COUNT; col++)
            {
                DataGridViewCheckBoxColumn c = new DataGridViewCheckBoxColumn();
                c.ValueType = typeof(int);
                c.Width = 15;
                c.HeaderText = (col + 1).ToString();
                App.GetLevel(grid).Columns.Add(c);
                defaultRow[col] = 0;
            }

            // Remove extra column
            if (App.GetLevel(grid).Columns.Count == 1 + Config.X_COUNT)
                App.GetLevel(grid).Columns.RemoveAt(0);

            // Set rows
            for (int row = 0; row < Config.Y_COUNT; row++)
            {
                DataGridViewRow r = new DataGridViewRow();
                r.Height = 15;
                r.HeaderCell.Value = (row + 1).ToString();
                r.SetValues(defaultRow);
                App.GetLevel(grid).Rows.Add(r);

                // Set integer value for all cells
                for (int col = 0; col < Config.X_COUNT; col++)
                    Cell.SetValue(0, col, row, grid);
            }

            // Sets rows if none given
            if (rows == null) // From existing if no rows were given
                rows = Config.MAZEDATA;

            // Loads data to grid
            for (int row = 0; row < Config.Y_COUNT; row++)
            {
                if (rows.Count() > startRow + row && rows[startRow + row] != "") // Check if row contains data
                {
                    String[] rowValues = rows[startRow + row].Split(',');
                    for (int col = 0; col < Config.X_COUNT; col++)
                        Cell.SetValue(int.Parse(rowValues[col]), col, row, grid);
                }
            }
        }
        private void ClearQuestView()
        {
            QuestView.Rows.Clear();

            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells( QuestView );
                row.SetValues( null, null, null, "(未取得)", null );
                QuestView.Rows.Add( row );
            }
        }
Beispiel #24
0
        private void Button1_Click(object sender, EventArgs e)
        {
            ClaseConexion conn2 = new ClaseConexion();
            //DataGridView1.Rows.Add(ComboBox2.Text);
            DataGridViewRow row = new DataGridViewRow();
            row.SetValues(ComboBox2.Text);

            //for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
            //{
                //if (DataGridView1.Rows.SharedRow(i).Cells[0].Value.ToString() != ComboBox2.SelectedText)
                //{
                    //DataGridView1.Rows.Add(ComboBox2.Text);
               // }

               // }
                    List<String> datos = new List<string>();

                    for (int i = 0; i < DataGridView1.Rows.Count - 1; i++)
                    {
                        string dato;
                        dato = DataGridView1.Rows.SharedRow(i).Cells[0].Value.ToString();
                        //DataGridView1.Rows.Add(ComboBox2.Text);
                        //DataGridView1.DataSource
                        datos.Add(dato);
                    }
                    if (datos.Contains(ComboBox2.Text))
                    {
                        Console.WriteLine("repetido");
                    }
                    else {
                        //nuevos = new List<int>();
                        DataGridView1.Rows.Add(ComboBox2.Text);
                        string tipo = ComboBox2.SelectedValue.ToString();
                        SqlCommand consultan = new SqlCommand("SELECT TOP 1 [COD_ENC_DEDUCCION] FROM [Nomina].[dbo].[HRM_ENC_DEDUCCION] where HRM_ENC_DEDUCCION.TIPO_DEDUCCION like '%" + tipo + "%'", conn2.abrirconexion());
                        int encdeduccion = Convert.ToInt32(consultan.ExecuteScalar());
                        //int encdeduccion = ;//.Columns[0].ToString());
                        //Console.WriteLine(encdeduccion);
                        //listadetalles.Add(encdeduccion);
                        nuevos.Add(encdeduccion);
                        //Console.WriteLine("repetido");
                    }
        }
		public virtual void Insert (int rowIndex, params object[] values)
		{
			if (values == null)
				throw new ArgumentNullException ("Values is null.");
			if (dataGridView.VirtualMode || dataGridView.DataSource != null)
				throw new InvalidOperationException ();
			DataGridViewRow row = new DataGridViewRow ();
			row.SetValues (values);
			Insert (rowIndex, row);
		}
        private DataGridViewRow GetExpressionDetailViewRow( ExpressionData exp )
        {
            var row = new DataGridViewRow();
            row.CreateCells( ExpressionDetailView );

            row.SetValues(
                exp.Enabled,
                exp.LeftOperand,
                exp.RightOperand,
                exp.Operator
                );

            return row;
        }
        /// <summary>
        /// ShipView用の新しい行のインスタンスを作成します。
        /// </summary>
        /// <param name="ship">追加する艦娘データ。</param>
        private DataGridViewRow CreateShipViewRow( ShipData ship )
        {
            if ( ship == null ) return null;

            DataGridViewRow row = new DataGridViewRow();
            row.CreateCells( ShipView );

            row.SetValues(
                ship.MasterID,
                ship.MasterShip.ShipType,
                ship.MasterShip.Name,
                ship.Level,
                ship.ExpTotal,
                ship.ExpNext,
                ship.ExpNextRemodel,
                new Fraction( ship.HPCurrent, ship.HPMax ),
                ship.Condition,
                new Fraction( ship.Fuel, ship.FuelMax ),
                new Fraction( ship.Ammo, ship.AmmoMax ),
                GetEquipmentString( ship, 0 ),
                GetEquipmentString( ship, 1 ),
                GetEquipmentString( ship, 2 ),
                GetEquipmentString( ship, 3 ),
                GetEquipmentString( ship, 4 ),
                GetEquipmentString( ship, 5 ),		//補強スロット
                new Fraction( ship.Aircraft[0], ship.MasterShip.Aircraft[0] ),
                new Fraction( ship.Aircraft[1], ship.MasterShip.Aircraft[1] ),
                new Fraction( ship.Aircraft[2], ship.MasterShip.Aircraft[2] ),
                new Fraction( ship.Aircraft[3], ship.MasterShip.Aircraft[3] ),
                new Fraction( ship.Aircraft[4], ship.MasterShip.Aircraft[4] ),
                new Fraction( ship.AircraftTotal, ship.MasterShip.AircraftTotal ),
                ship.FleetWithIndex,
                ship.RepairingDockID == -1 ? ship.RepairTime : -1000 + ship.RepairingDockID,
                ship.RepairSteel,
                ship.RepairFuel,
                ship.FirepowerBase,
                ship.FirepowerRemain,
                ship.FirepowerTotal,
                ship.TorpedoBase,
                ship.TorpedoRemain,
                ship.TorpedoTotal,
                ship.AABase,
                ship.AARemain,
                ship.AATotal,
                ship.ArmorBase,
                ship.ArmorRemain,
                ship.ArmorTotal,
                ship.ASWBase,
                ship.ASWTotal,
                ship.EvasionBase,
                ship.EvasionTotal,
                ship.LOSBase,
                ship.LOSTotal,
                ship.LuckBase,
                ship.LuckRemain,
                ship.LuckTotal,
                ship.BomberTotal,
                ship.MasterShip.Speed,
                ship.Range,
                ship.AirBattlePower,
                ship.ShellingPower,
                ship.AircraftPower,
                ship.AntiSubmarinePower,
                ship.TorpedoPower,
                ship.NightBattlePower,
                ship.IsLocked ? 1 : ship.IsLockedByEquipment ? 2 : 0,
                ship.SallyArea
                );

            row.Cells[ShipView_Name.Index].Tag = ship.ShipID;
            //row.Cells[ShipView_Level.Index].Tag = ship.ExpTotal;

            {
                DataGridViewCellStyle cs;
                double hprate = ship.HPRate;
                if ( hprate <= 0.25 )
                    cs = CSRedRight;
                else if ( hprate <= 0.50 )
                    cs = CSOrangeRight;
                else if ( hprate <= 0.75 )
                    cs = CSYellowRight;
                else if ( hprate < 1.00 )
                    cs = CSGreenRight;
                else
                    cs = CSDefaultRight;

                row.Cells[ShipView_HP.Index].Style = cs;
            }
            {
                DataGridViewCellStyle cs;
                if ( ship.Condition < 20 )
                    cs = CSRedRight;
                else if ( ship.Condition < 30 )
                    cs = CSOrangeRight;
                else if ( ship.Condition < Utility.Configuration.Config.Control.ConditionBorder )
                    cs = CSYellowRight;
                else if ( ship.Condition < 50 )
                    cs = CSDefaultRight;
                else
                    cs = CSGreenRight;

                row.Cells[ShipView_Condition.Index].Style = cs;
            }
            row.Cells[ShipView_Fuel.Index].Style = ship.Fuel < ship.FuelMax ? CSYellowRight : CSDefaultRight;
            row.Cells[ShipView_Ammo.Index].Style = ship.Ammo < ship.AmmoMax ? CSYellowRight : CSDefaultRight;
            {
                var current = ship.Aircraft;
                var max = ship.MasterShip.Aircraft;
                row.Cells[ShipView_Aircraft1.Index].Style = ( max[0] > 0 && current[0] == 0 ) ? CSRedRight : ( current[0] < max[0] ) ? CSYellowRight : CSDefaultRight;
                row.Cells[ShipView_Aircraft2.Index].Style = ( max[1] > 0 && current[1] == 0 ) ? CSRedRight : ( current[1] < max[1] ) ? CSYellowRight : CSDefaultRight;
                row.Cells[ShipView_Aircraft3.Index].Style = ( max[2] > 0 && current[2] == 0 ) ? CSRedRight : ( current[2] < max[2] ) ? CSYellowRight : CSDefaultRight;
                row.Cells[ShipView_Aircraft4.Index].Style = ( max[3] > 0 && current[3] == 0 ) ? CSRedRight : ( current[3] < max[3] ) ? CSYellowRight : CSDefaultRight;
                row.Cells[ShipView_Aircraft5.Index].Style = ( max[4] > 0 && current[4] == 0 ) ? CSRedRight : ( current[4] < max[4] ) ? CSYellowRight : CSDefaultRight;
                row.Cells[ShipView_AircraftTotal.Index].Style = ( ship.MasterShip.AircraftTotal > 0 && ship.AircraftTotal == 0 ) ? CSRedRight : ( ship.AircraftTotal < ship.MasterShip.AircraftTotal ) ? CSYellowRight : CSDefaultRight;
            }
            {
                DataGridViewCellStyle cs;
                if ( ship.RepairTime == 0 )
                    cs = CSDefaultRight;
                else if ( ship.RepairTime < 1000 * 60 * 60 )
                    cs = CSYellowRight;
                else if ( ship.RepairTime < 1000 * 60 * 60 * 6 )
                    cs = CSOrangeRight;
                else
                    cs = CSRedRight;

                row.Cells[ShipView_RepairTime.Index].Style = cs;
            }
            row.Cells[ShipView_FirepowerRemain.Index].Style = ship.FirepowerRemain == 0 ? CSGrayRight : CSDefaultRight;
            row.Cells[ShipView_TorpedoRemain.Index].Style = ship.TorpedoRemain == 0 ? CSGrayRight : CSDefaultRight;
            row.Cells[ShipView_AARemain.Index].Style = ship.AARemain == 0 ? CSGrayRight : CSDefaultRight;
            row.Cells[ShipView_ArmorRemain.Index].Style = ship.ArmorRemain == 0 ? CSGrayRight : CSDefaultRight;
            row.Cells[ShipView_LuckRemain.Index].Style = ship.LuckRemain == 0 ? CSGrayRight : CSDefaultRight;

            row.Cells[ShipView_Locked.Index].Style = ship.IsLocked ? CSIsLocked : CSDefaultCenter;

            return row;
        }
        private DataGridViewRow GetExpressionViewRow( ExpressionList exp )
        {
            var row = new DataGridViewRow();
            row.CreateCells( ExpressionView );

            row.SetValues(
                exp.Enabled,
                exp.ExternalAnd,
                exp.Inverse,
                exp.InternalAnd,
                exp.ToString()
                );

            return row;
        }
        /// <summary>
        /// 一覧ビューを更新します。
        /// </summary>
        private void UpdateView()
        {
            var ships = KCDatabase.Instance.Ships.Values;
            var equipments = KCDatabase.Instance.Equipments.Values;
            var masterEquipments = KCDatabase.Instance.MasterEquipments;
            int masterCount = masterEquipments.Values.Count( eq => !eq.IsAbyssalEquipment );

            var allCount = new Dictionary<int, int>( masterCount );

            //全個数計算
            foreach ( var e in equipments ) {

                if ( !allCount.ContainsKey( e.EquipmentID ) ) {
                    allCount.Add( e.EquipmentID, 1 );

                } else {
                    allCount[e.EquipmentID]++;
                }

            }

            var remainCount = new Dictionary<int, int>( allCount );

            //剰余数計算
            foreach ( var ship in ships ) {

                foreach ( var eq in ship.AllSlotInstanceMaster ) {
                    if ( eq == null ) continue;
                    remainCount[eq.EquipmentID]--;
                }

            }

            //表示処理
            EquipmentView.SuspendLayout();

            EquipmentView.Enabled = false;
            EquipmentView.Rows.Clear();

            var rows = new List<DataGridViewRow>( allCount.Count );
            var ids = allCount.Keys;

            foreach ( int id in ids ) {

                var row = new DataGridViewRow();
                row.CreateCells( EquipmentView );
                row.SetValues(
                    id,
                    masterEquipments[id].IconType,
                    masterEquipments[id].Name,
                    allCount[id],
                    remainCount[id]
                    );

                rows.Add( row );
            }

            for ( int i = 0; i < rows.Count; i++ )
                rows[i].Tag = i;

            EquipmentView.Rows.AddRange( rows.ToArray() );

            EquipmentView.Sort( EquipmentView_Name, ListSortDirection.Ascending );

            EquipmentView.Enabled = true;
            EquipmentView.ResumeLayout();

            if ( EquipmentView.Rows.Count > 0 )
                EquipmentView.CurrentCell = EquipmentView[0, 0];
        }
Beispiel #30
0
 private void CargarDatosDeReceta()
 {
     txtNombreReceta.Text = receta.nombre;
     ValidateEmptyStringRule(txtNombreReceta);
     txtCostoReceta.Text = receta.costoReceta.ToString();
     listaInsumosReceta.Clear();
     for (int i = 0; i < receta.listaInsumos.Count; i++)
     {
         CommonUtils.Insumo insumo = ((CommonUtils.RecetaInsumo)receta.listaInsumos[i]).insumo;
         listaInsumosReceta.Add(insumo.idInsumo, insumo);
         DataGridViewRow row = new DataGridViewRow();
         row.CreateCells(dataGridViewListInsumoReceta);                
         row.SetValues(insumo.idInsumo, insumo.nombre, insumo.costoUnidad.ToString(), ((CommonUtils.RecetaInsumo)receta.listaInsumos[i]).cantidad.ToString(), insumo.unidad);
                      
         dataGridViewListInsumoReceta.Rows.Add(row);                
     }
     CargarListaInsumos();
 }