Ejemplo n.º 1
0
        private void olvDataCubeTree_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            var dv = olvDataCubeTree.SelectedObject as DataRowView;

            if (dv != null)
            {
                var dr     = dv.Row;
                var parent = int.Parse(dr["ParentID"].ToString());
                if (parent != 9999)
                {
                    _selectedDc = dr["DataCubeObject"] as IDataCubeObject;
                    _selectedDc.SelectedVariableIndex = int.Parse(dr["ID"].ToString());
                    if (_selectedDc.IsAllocated(_selectedDc.SelectedVariableIndex))
                    {
                        listBox_timeline.DataSource    = _selectedDc.DateTimes;
                        listBox_timeline.SelectedIndex = 0;
                    }
                    else
                    {
                        listBox_timeline.DataSource = null;
                        listBox_timeline.Items.Clear();
                    }
                }
            }
            else
            {
                listBox_timeline.DataSource = null;
                listBox_timeline.Items.Clear();
            }
        }
Ejemplo n.º 2
0
 public void ClearContent()
 {
     _WorkSpace.DataSources.Clear();
     olvDataCubeTree.Clear();
     listBox_timeline.Items.Clear();
     _selectedDc = null;
 }
Ejemplo n.º 3
0
        private void UpdateVariableView(IDataCubeObject mat)
        {
            if (mat == null)
            {
                _TVMataList.Clear();
            }
            else
            {
                _TVMataList.Clear();

                int ntime = mat.Size[0];
                for (int i = 0; i < ntime; i++)
                {
                    _TVMataList.Add(new DCVarientMeta()
                    {
                        TimeIndex  = i,
                        Behavior   = mat.Flags[i, 0],
                        Multiplier = mat.Multipliers[i, 0],
                        Constant   = mat.Constants[i, 0],
                        Owner      = mat
                    });
                }
            }
            olvVariableName.SetObjects(_TVMataList);
        }
Ejemplo n.º 4
0
        public void Bind(IParameter[] paras)
        {
            _Parameters = paras;
            _DataTable  = new DataTable();
            foreach (var pa in paras)
            {
                DataColumn dc = new DataColumn(pa.Name, pa.GetVariableType());
                _DataTable.Columns.Add(dc);
            }
            int nrow = paras[0].ValueCount;

            for (int i = 0; i < nrow; i++)
            {
                DataRow dr = _DataTable.NewRow();
                for (int j = 0; j < paras.Length; j++)
                {
                    dr[j] = paras[j].ArrayObject.GetValue(i);
                }
                _DataTable.Rows.Add(dr);
            }
            this.bindingSource1.DataSource = _DataTable;
            this.dataGridView1.DataSource  = bindingSource1;
            EnableControls(false);
            btnSave.Enabled   = true;
            btnImport.Enabled = true;
            _DataCubeObject   = null;
        }
Ejemplo n.º 5
0
        protected override void AttributeTable_Clicked(object sender, EventArgs e)
        {
            var item = ExplorerItem as StaticVariableItem;

            _ShellService.SelectPanel(DockPanelNames.DataGridPanel);
            IDataCubeObject binding = _Package.GetType().GetProperty(_Item.PropertyInfo.Name).GetValue(_Package) as IDataCubeObject;

            binding.SelectedVariableIndex = item.VariableIndex;
            _ShellService.SelectPanel(DockPanelNames.DataGridPanel);
            _ShellService.DataGridView.Bind(binding);
        }
Ejemplo n.º 6
0
        public void Add(IDataCubeObject mat)
        {
            if (TypeConverterEx.IsNull(mat.Name))
            {
                mat.Name = GetName();
            }
            var buf = from mm in DataSources where mm.Name == mat.Name select mm;

            if (buf.Any())
            {
                Remove(mat.Name);
            }
            DataSources.Add(mat);
            OnDataSourceCollectionChanged();
        }
Ejemplo n.º 7
0
        private void ShowDataGrid()
        {
            Array           array = null;
            IDataCubeObject dc    = null;

            if (_SelectedDCVarientMeta != null)
            {
                dc = _SelectedDCVarientMeta.Owner;
                if (tsDataViewMode.SelectedIndex == 0)
                {
                    array = dc.GetSerialArrayByTime(_SelectedDCVarientMeta.TimeIndex, 0);
                }
                else
                {
                    array = dc.GetRegularlArrayByTime(_SelectedDCVarientMeta.TimeIndex, 0);
                }
            }
            else
            {
                dc = _SelectedDataCubeMeta.Mat;
                if (dc.Topology != null)
                {
                    if (tsDataViewMode.SelectedIndex == 0)
                    {
                        array = dc.GetSerialArrayByTime(0, 0);
                    }
                    else
                    {
                        array = dc.GetRegularlArrayByTime(0, 0);
                    }
                }
                else
                {
                    array = dc.GetSerialArrayByTime(0, 0);
                }
            }

            arrayGrid.DataSource = array;
            var ncol = array.GetLength(1);

            arrayGrid.Columns.Clear();
            for (int i = 0; i < ncol + 1; i++)
            {
                var col = new SourceGrid.ColumnInfo(arrayGrid);
                col.MinimalWidth = 50;
                arrayGrid.Columns.Add(col);
            }
        }
Ejemplo n.º 8
0
 public void Bind(IDataCubeObject dc)
 {
     _need_refresh_pages = true;
     _DataCubeObject     = dc;
     if (dc.SelectedVariableIndex < 0)
     {
         DataObjectName = dc.Name;
         EnableControls(true);
         cmb_PrimaryKey.SelectedIndex = 0;
         if (_need_refresh_pages)
         {
             cmb_PrimaryKey_SelectedIndexChanged(cmb_PrimaryKey, EventArgs.Empty);
         }
         _Parameters = null;
     }
     else
     {
         if (dc.IsAllocated(dc.SelectedVariableIndex))
         {
             DataObjectName = string.Format("{0}[{1}]", dc.Name, dc.Variables[dc.SelectedVariableIndex]);
             EnableControls(true);
             cmb_PrimaryKey.SelectedIndex = 0;
             if (_need_refresh_pages)
             {
                 cmb_PrimaryKey_SelectedIndexChanged(cmb_PrimaryKey, EventArgs.Empty);
             }
             _Parameters = null;
             //_DataTable = dc.ToDataTableByTime(dc.SelectedVariableIndex, 0);
             //this.bindingSource1.DataSource = _DataTable;
             //this.dataGridView1.DataSource = bindingSource1;
         }
         else
         {
             this.bindingSource1.DataSource = null;
             this.dataGridView1.DataSource  = bindingSource1;
             EnableControls(false);
             _Parameters = null;
         }
     }
 }