コード例 #1
0
        private void frmSample49_Load(object sender, EventArgs e)
        {
            Employee emp1 = new Employee();
            emp1.Birthday = DateTime.Today.AddYears(-18);
            emp1.FirstName = "Peter";
            emp1.LastName = "Parker";
            emp1.Salary = 3500;
            mEmployeeList.Add(emp1);

            Employee emp2 = new Employee();
            emp2.Birthday = DateTime.Today.AddYears(-38);
            emp2.FirstName = "John";
            emp2.LastName = "Smith";
            emp2.Salary = 2800;
            mEmployeeList.Add(emp2);

            mBoundList = new DevAge.ComponentModel.BoundList<Employee>(mEmployeeList);
            mBoundList.ListChanged += new ListChangedEventHandler(mBoundList_ListChanged);

            dataGrid1.Columns.Add("FirstName", "FirstName", 
                                typeof(string)).Width = 100;
            dataGrid1.Columns.Add("LastName", "LastName",
                                typeof(string)).Width = 100;
            dataGrid1.Columns.Add("Salary", "Salary",
                                new SourceGrid.Cells.Editors.TextBoxCurrency(typeof(decimal))).Width = 100;
            dataGrid1.Columns.Add("Birthday", "Birthday",
                                typeof(DateTime)).Width = 100;

            dataGrid1.DataSource = mBoundList;
        }
コード例 #2
0
        private void frmSample49_Load(object sender, EventArgs e)
        {
            Employee emp1 = new Employee();

            emp1.Birthday  = DateTime.Today.AddYears(-18);
            emp1.FirstName = "Peter";
            emp1.LastName  = "Parker";
            emp1.Salary    = 3500;
            mEmployeeList.Add(emp1);

            Employee emp2 = new Employee();

            emp2.Birthday  = DateTime.Today.AddYears(-38);
            emp2.FirstName = "John";
            emp2.LastName  = "Smith";
            emp2.Salary    = 2800;
            mEmployeeList.Add(emp2);

            mBoundList              = new DevAge.ComponentModel.BoundList <Employee>(mEmployeeList);
            mBoundList.ListChanged += new ListChangedEventHandler(mBoundList_ListChanged);

            dataGrid1.Columns.Add("FirstName", "FirstName",
                                  typeof(string)).Width = 100;
            dataGrid1.Columns.Add("LastName", "LastName",
                                  typeof(string)).Width = 100;
            dataGrid1.Columns.Add("Salary", "Salary",
                                  new SourceGrid.Cells.Editors.TextBoxCurrency(typeof(decimal))).Width = 100;
            dataGrid1.Columns.Add("Birthday", "Birthday",
                                  typeof(DateTime)).Width = 100;

            dataGrid1.DataSource = mBoundList;
        }
コード例 #3
0
        private void btViewNewEntities_Click(object sender, EventArgs e)
        {
            DevAge.ComponentModel.BoundList <Employee> changedList =
                new DevAge.ComponentModel.BoundList <Employee>(mBoundList.AddedItems);

            changedList.AllowEdit   = false;
            changedList.AllowNew    = false;
            changedList.AllowDelete = false;

            gridChanges.DataSource = changedList;
        }
コード例 #4
0
        private static void TestBindingList()
        {
            List <Employee> list = new List <Employee>();
            Employee        emp1 = new Employee();

            emp1.Name    = "Peter";
            emp1.Address = "New York";
            list.Add(emp1);
            Employee emp2 = new Employee();

            emp2.Name    = "John";
            emp2.Address = "Boston";
            list.Add(emp2);


            DevAge.ComponentModel.BoundList <Employee> bd = new DevAge.ComponentModel.BoundList <Employee>(list);

            bd.ListChanged += delegate(object sender, System.ComponentModel.ListChangedEventArgs e)
            {
                System.Diagnostics.Debug.WriteLine("ListChanged " + list.Count);
            };

            System.ComponentModel.PropertyDescriptorCollection props = bd.GetItemProperties();

            int r;

            r = bd.BeginAddNew();

            bd.SetEditValue(props[0], "Pluto");
            bd.SetEditValue(props[1], "Via Tripoli");

            bd.EndEdit(true);


            r = bd.BeginAddNew();

            bd.SetEditValue(props[0], "Pluto");
            bd.SetEditValue(props[1], "Corso Orbassano");

            bd.EndEdit(false);


            bd.BeginEdit(0);

            bd.SetEditValue(props[0], "Davide");

            bd.EndEdit(true);
        }
コード例 #5
0
        private void InitCommandsGrid()
        {
            _mBoundList = new DevAge.ComponentModel.BoundList <QueryCommand>(_queryCommands);

            commandsDataGrid.Columns.Add("Created", "Date", typeof(DateTime)).Width   = 115;
            commandsDataGrid.Columns.Add("CommandText", "Text", typeof(string)).Width = 415;
            commandsDataGrid.Columns.Add("ResultRowsCount", "ResultRowsCount", typeof(string)).Width    = 100;
            commandsDataGrid.Columns.Add("QueryMiliseconds", "Query Miliseconds", typeof(string)).Width = 100;
            commandsDataGrid.Columns.Add("MethodName", "Method Name", typeof(string)).Width             = 150;
            commandsDataGrid.Columns.Add("ClassName", "Class Name", typeof(string)).Width = 200;
            commandsDataGrid.EnableSort = true;

            commandsDataGrid.Selection.FocusRowEntered += Selection_FocusRowEntered;
            commandsDataGrid.DataSource = _mBoundList;

            _mBoundList.AllowEdit        = _mBoundList.AllowDelete = _mBoundList.AllowNew = false;
            commandsDataGrid.BorderStyle = BorderStyle.FixedSingle;
        }
コード例 #6
0
        private void AddADataRow(int AIndex,
                                 String AAccountCode,
                                 string ACurrencyValue,
                                 decimal AExchangeRate,
                                 DateTime AdateEffectiveFrom,
                                 Boolean ADoRevaluation)
        {
            CurrencyExchange ce = new CurrencyExchange(AAccountCode, ACurrencyValue, AExchangeRate, AdateEffectiveFrom, ADoRevaluation);

            FcurrencyExchangeList.Add(ce);
            FBoundList = new DevAge.ComponentModel.BoundList <CurrencyExchange>
                             (FcurrencyExchangeList);
            grdDetails.DataSource = FBoundList;

            FBoundList.AllowNew    = false;
            FBoundList.AllowDelete = false;

            FlinkController.SetDataList(FcurrencyExchangeList);
        }
コード例 #7
0
        private void AddADataRow(int AIndex, string ACurrencyValue, decimal AExchangeRate)
        {
            CurrencyExchange ce = new CurrencyExchange(ACurrencyValue, AExchangeRate);

            FcurrencyExchangeList.Add(ce);
            FBoundList = new DevAge.ComponentModel.BoundList <CurrencyExchange>
                             (FcurrencyExchangeList);
            grdDetails.DataSource = FBoundList;

            FBoundList.AllowNew    = false;
            FBoundList.AllowDelete = false;

            for (Int32 column = 1; column <= 3; column++)
            {
                grdDetails.Columns[column].GetDataCell(AIndex).Editor.EnableEdit = false;
            }

            linkClickDelete.SetDataList(FcurrencyExchangeList);
        }
コード例 #8
0
        private void AddADataRow(int AIndex, string ACurrencyValue, decimal AExchangeRate)
        {
            CurrencyExchange ce = new CurrencyExchange(ACurrencyValue, AExchangeRate);

            FcurrencyExchangeList.Add(ce);
            FBoundList = new DevAge.ComponentModel.BoundList <CurrencyExchange>
                             (FcurrencyExchangeList);
            grdDetails.DataSource = FBoundList;

            FBoundList.AllowNew = false;
            FBoundList.AllowDelete = false;

            for (Int32 column = 1; column <= 3; column++)
            {
                grdDetails.Columns[column].GetDataCell(AIndex).Editor.EnableEdit = false;
            }

            linkClickDelete.SetDataList(FcurrencyExchangeList);
        }
コード例 #9
0
        private void btViewNewEntities_Click(object sender, EventArgs e)
        {
            DevAge.ComponentModel.BoundList<Employee> changedList =
                    new DevAge.ComponentModel.BoundList<Employee>(mBoundList.AddedItems);

            changedList.AllowEdit = false;
            changedList.AllowNew = false;
            changedList.AllowDelete = false;

            gridChanges.DataSource = changedList;
        }
コード例 #10
0
        private void AddADataRow(int AIndex,
            String AAccountCode,
            string ACurrencyValue,
            decimal AExchangeRate,
            DateTime AdateEffectiveFrom,
            Boolean ADoRevaluation)
        {
            CurrencyExchange ce = new CurrencyExchange(AAccountCode, ACurrencyValue, AExchangeRate, AdateEffectiveFrom, ADoRevaluation);

            FcurrencyExchangeList.Add(ce);
            FBoundList = new DevAge.ComponentModel.BoundList <CurrencyExchange>
                             (FcurrencyExchangeList);
            grdDetails.DataSource = FBoundList;

            FBoundList.AllowNew = false;
            FBoundList.AllowDelete = false;

            FlinkController.SetDataList(FcurrencyExchangeList);
        }
コード例 #11
0
ファイル: GenericTest.cs プロジェクト: wsrf2009/KnxUiEditor
        private static void TestBindingList()
        {
            List<Employee> list = new List<Employee>();
            Employee emp1 = new Employee();
            emp1.Name = "Peter";
            emp1.Address = "New York";
            list.Add(emp1);
            Employee emp2 = new Employee();
            emp2.Name = "John";
            emp2.Address = "Boston";
            list.Add(emp2);


            DevAge.ComponentModel.BoundList<Employee> bd = new DevAge.ComponentModel.BoundList<Employee>(list);

            bd.ListChanged += delegate(object sender, System.ComponentModel.ListChangedEventArgs e)
            {
                System.Diagnostics.Debug.WriteLine("ListChanged " + list.Count);
            };

            System.ComponentModel.PropertyDescriptorCollection props = bd.GetItemProperties();

            int r;

            r = bd.BeginAddNew();

            bd.SetEditValue(props[0], "Pluto");
            bd.SetEditValue(props[1], "Via Tripoli");

            bd.EndEdit(true);


            r = bd.BeginAddNew();

            bd.SetEditValue(props[0], "Pluto");
            bd.SetEditValue(props[1], "Corso Orbassano");

            bd.EndEdit(false);


            bd.BeginEdit(0);

            bd.SetEditValue(props[0], "Davide");

            bd.EndEdit(true);
        }