コード例 #1
0
        public MainPage()
        {
            InitializeComponent();
            XPOServiceHelper.SetupXpoLayer(new UnitOfWork());
            Collection = new XPInstantFeedbackSource(typeof(Items));
            Collection.ResolveSession += OnCollectionResolveSession;
            Collection.DismissSession += OnCollectionDismissSession;

            helper.XPObjectType     = typeof(Items);
            helper.CollectionSource = Collection;
            helper.ServiceHelper    = new ServiceHelper(helper, new Uri("http://localhost:54177/WcfDataService.svc/"), Dispatcher);
        }
コード例 #2
0
ファイル: CustomerListViewModel.cs プロジェクト: zjxstjg/XPO
        private void ReloadCore()
        {
            IDisposable old = (IDisposable)Customers;

            Customers = new XPInstantFeedbackSource(typeof(Customer), "Oid;ContactName", null,
                                                    e => e.Session = new Session(),
                                                    e => e.Session.Session.Dispose());
            if (old != null)
            {
                old.Dispose();
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: vladimir56r/SQLite2Excel
        private void loadDB()
        {
            string connectionString = $@"Data Source={DBFileName}";

            System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection(connectionString);
            System.Data.SQLite.SQLiteCommand    cmd  = new System.Data.SQLite.SQLiteCommand("select * from test limit 1");
            cmd.Connection = conn;

            conn.Open();
            cmd.ExecuteScalar();
            System.Data.SQLite.SQLiteDataAdapter da = new System.Data.SQLite.SQLiteDataAdapter(cmd);
            System.Data.DataSet ds = new System.Data.DataSet();

            da.Fill(ds);
            var table = ds.Tables[0];

            minColWidth = new int[table.Columns.Count];
            for (var colIndex = 0; colIndex < minColWidth.Length; colIndex++)
            {
                minColWidth[colIndex] = minWidth;
            }
            foreach (DataRow row in table.Rows)
            {
                for (var colIndex = 0; colIndex < minColWidth.Length; colIndex++)
                {
                    minColWidth[colIndex] = Math.Max(minColWidth[colIndex], TextRenderer.MeasureText(row[colIndex].ToString(), gridControl1.Font).Width);
                }
            }
            ReflectionDictionary dict = new ReflectionDictionary();

            XpoDefault.Dictionary = dict;
            XPClassInfo   classInfo = new XPDataObjectClassInfo(dict, "Test", new Attribute[] { new OptimisticLockingAttribute(false), new DeferredDeletionAttribute(false) });
            List <string> colNames  = new List <string>();

            foreach (DataColumn col in table.Columns)
            {
                colNames.Add(col.ColumnName);
                classInfo.CreateMember(col.ColumnName, col.DataType);
            }
            classInfo.GetMember("id").AddAttribute(new KeyAttribute());

            XPInstantFeedbackSource instantDS = new XPInstantFeedbackSource(classInfo);

            instantDS.ResolveSession += instantDS_ResolveSession;
            instantDS.DismissSession += instantDS_DismissSession;
            gridView.Columns.Clear();
            gridControl1.DataSource = instantDS;
            gridControl1.Refresh();
            btnBestFirColumns.PerformClick();
        }
コード例 #4
0
        public MainWindow()
        {
            InitDAL();
            // Generates test data - 100,000 records.
            GenerateTestData(100000);
            InitializeComponent();

            // Creates and initializes the data source which activates the Instant Feedback UI Mode.
            XPInstantFeedbackSource instantDS = new XPInstantFeedbackSource(typeof(TestObject));

            instantDS.ResolveSession += new EventHandler <ResolveSessionEventArgs>(instantDS_ResolveSession);
            instantDS.DismissSession += new EventHandler <ResolveSessionEventArgs>(instantDS_DismissSession);

            // Bind the grid.
            grid.ItemsSource = instantDS;
        }