Ejemplo n.º 1
0
        protected bool FFreshData = false;         //flag is raised when DataChanged event is called
        #endregion

        public void Evaluate(int SpreadMax)
        {
            if (FPinInTable.SliceCount == 0)
            {
                FData = null;
                return;
            }
            if (FPinInTable[0] != FData)
            {
                if (FData != null)
                {
                    FData.DataChanged -= new SpreadTable.DataChangedHandler(FData_DataChanged);
                }
                FData = FPinInTable[0];
                if (FData != null)
                {
                    FData.DataChanged += new SpreadTable.DataChangedHandler(FData_DataChanged);
                }
                this.FData_Connected();
            }

            if (FData != null)
            {
                this.Evaluate2(SpreadMax);
            }
        }
Ejemplo n.º 2
0
		protected bool FFreshData = false; //flag is raised when DataChanged event is called
		#endregion

		public void Evaluate(int SpreadMax)
		{
			if (FPinInTable.SliceCount == 0)
			{
				FData = null;
				return;
			}
			if (FPinInTable[0] != FData)
			{
				if (FData != null)
				{
					FData.DataChanged -= new SpreadTable.DataChangedHandler(FData_DataChanged);
				}
				FData = FPinInTable[0];
				if (FData != null)
				{
					FData.DataChanged += new SpreadTable.DataChangedHandler(FData_DataChanged);
				}
				this.FData_Connected();
			}

			if (FData != null)
				this.Evaluate2(SpreadMax);
		}
        public void Evaluate(int SpreadMax)
        {
            if (FPinInTable[0] != FData)
            {
                if (FData != null)
                {
                    FData.DataChanged -= new SpreadTable.DataChangedHandler(FData_DataChanged);
                }
                FData = FPinInTable[0];
                if (FData != null)
                {
                    FData.DataChanged += new SpreadTable.DataChangedHandler(FData_DataChanged);
                }
                FDataGridView.DataSource = FData;
            }

            if (FData == null)
            {
                return;
            }

            if (FData.Rows.Count > 0)
            {
                bool moveRow     = false;
                int  selectedRow = 0;

                if (FDataGridView.SelectedCells.Count > 0)
                {
                    selectedRow = FDataGridView.SelectedCells[0].RowIndex;
                }
                else
                {
                    selectedRow = 0;
                }

                if (FUp[0])
                {
                    selectedRow++;
                    selectedRow %= FData.Rows.Count;
                    moveRow      = true;
                }

                if (FDown[0])
                {
                    selectedRow--;
                    if (selectedRow < 0)
                    {
                        selectedRow += FData.Rows.Count;
                    }
                    moveRow = true;
                }

                if (moveRow)
                {
                    FDataGridView.ClearSelection();
                    FDataGridView.Rows[selectedRow].Selected = true;
                }
            }

            if (FNeedsUpdate)
            {
                FDataGridView.Refresh();
                FNeedsUpdate = false;
            }

            if (FData.Rows.Count == 0)
            {
                FCurrentIndex.SliceCount = 1;
                FCurrentIndex[0]         = 0;
            }
            else
            {
                var rows = FDataGridView.SelectedRows;
                if (rows.Count > 0)
                {
                    FCurrentIndex.SliceCount = 0;
                    foreach (DataGridViewRow row in rows)
                    {
                        FCurrentIndex.Add(row.Index);
                    }
                }
                else
                {
                    int row = FDataGridView.CurrentCellAddress.Y;
                    FCurrentIndex.SliceCount = 1;
                    FCurrentIndex[0]         = row;
                }
            }
        }
		public void Evaluate(int SpreadMax)
		{
			if (FPinInTable[0] != FData)
			{
				if (FData != null)
				{
					FData.DataChanged -= new SpreadTable.DataChangedHandler(FData_DataChanged);
				}
				FData = FPinInTable[0];
				if (FData != null)
				{
					FData.DataChanged += new SpreadTable.DataChangedHandler(FData_DataChanged);
				}
				FDataGridView.DataSource = FData;
			}

			if (FData == null)
				return;

			if (FData.Rows.Count > 0)
			{
				bool moveRow = false;
				int selectedRow = 0;

				if (FDataGridView.SelectedCells.Count > 0)
					selectedRow = FDataGridView.SelectedCells[0].RowIndex;
				else
					selectedRow = 0;

				if (FUp[0])
				{
					selectedRow++;
					selectedRow %= FData.Rows.Count;
					moveRow = true;
				}

				if (FDown[0])
				{
					selectedRow--;
					if (selectedRow < 0)
						selectedRow += FData.Rows.Count;
					moveRow = true;
				}

				if (moveRow)
				{
					FDataGridView.ClearSelection();
					FDataGridView.Rows[selectedRow].Selected = true;
				}
			}

			if (FNeedsUpdate)
			{
				FDataGridView.Refresh();
				FNeedsUpdate = false;
			}

			if (FData.Rows.Count == 0)
			{
				FCurrentIndex.SliceCount = 1;
				FCurrentIndex[0] = 0;
			}
			else
			{
				var rows = FDataGridView.SelectedRows;
				if (rows.Count > 0)
				{
					FCurrentIndex.SliceCount = 0;
					foreach (DataGridViewRow row in rows)
					{
						FCurrentIndex.Add(row.Index);
					}
				}
				else
				{
					int row = FDataGridView.CurrentCellAddress.Y;
					FCurrentIndex.SliceCount = 1;
					FCurrentIndex[0] = row;
				}
			}
		}