Example #1
0
        public XOTable(XOApplication XOApplication, XOPTable XOPTable, XWPTable XWPTable, XSPTable XSPTable)
        {
            _xoApplication = XOApplication;

            _xopTable = XOPTable;

            _xwpTable = XWPTable;

            _xspTable = XSPTable;

            _fields = XopTable.Fields.Fields.Select(p => new XOField(this, p,
                XWPTable != null ? XWPTable.Fields.Fields.FirstOrDefault(s => s.FieldName == p.Name) : null,
                XSPTable != null ? XSPTable.Fields.FirstOrDefault(s => s.FieldName == p.Name) : null)).ToArray();

            if (XoApplication.XopDataSet.Relations != null)
            {
                _childrenRelations = XoApplication.XopDataSet.Relations.Relations.Where(p => p.ParentTable == this.Name)
                    .Select(p => new XORelation(
                        this, p, GetXwpRelation(p.Name))
                        ).ToArray();
            }
            else
            {
                _childrenRelations = new XORelation[] { };
            }
        }
        public static XOApplication InitializeFromAppConfig()
        {
            StartupBunch sttpBunch = AppConfigHandler.Initialize();

            _appConfig = SelectApp(sttpBunch);

            if (AppConfig == null) return null;

            SplashScreen.ShowSplashScreen(AppConfig.FullImgSplashFileName);

            DataAvail.Serialization.FileSerializationStream.DeafaultDirectory = AppConfig.FullXmlFolderPath;

            XElement Model; 
            XElement View;
            XElement Security;

            LoadModel(out Model, out View, out Security);

            if(Model == null)
            {
                throw new AppShellInitializerException("Can't reach the model, without it project can't be started.");
            }

            XOApplication.xmlReaderLog = AppShellLog.Log;

            XOApplication app = new XOApplication(Model, View, Security,
                new XOApplicationConfigParams() { pluginsDirectory = AppConfig.FullPluginsFolderPath, sharedPluginsDirectory = sttpBunch.SharedPluginsFolder });

            InitializeDbContext(AppConfig.FullModelFileName, app.XopDataSet);

            System.Data.DataSet dataSet = DataAvail.DataSetParser.DataSetBuilder.Build(AppConfig.FullModelFileName);

            FillStorage(app, dataSet);

            Controller.controllerContext = new ControllerContext(new XtraBindingControllerProvider(dataSet, LoadCalculatorManager()));

            InitializeControllerContext(app);

            if (app.XwpApplication != null)
                InitializeAppApperance(app.XwpApplication.AppView);

            return app;
        }
            internal AppShellInitializerResult(XOApplication XOApplication, IEnumerable<Controller> Controllers)
            {
                application = XOApplication;

                controllers = Controllers;
            }
 private static void InitializeControllersContext(XOApplication XOApplication)
 {
     foreach (XOTableContext appItemContext in XOApplication.MenuTables)
     {
         DataAvail.XtraBinding.Controllers.Controller.controllerContext.AddController(appItemContext);
     }
 }
 private static void FillStorage(System.Data.DataSet DataSet, XtraBindingControllerProvider ControllerProvider, XOApplication XOApplication)
 {
     foreach (XOTableContext xop in XOApplication.AutoFillTables)
     {
         ControllerProvider.GetDataAdapter(xop).Fill(DataSet.Tables[xop.Name], null);
     }
 }
 private static void FillStorage(XOApplication XOApplication, System.Data.DataSet DataSet)
 {
     foreach (XOTableContext appItemContext in XOApplication.AutoFillTables)
     {
         DataAvail.Data.DbContext.DbContext.CurrentContext.DataAdapter.Fill(DataSet.Tables[appItemContext.Name], null);
     } 
 }
 private static void InitializeControllerContext(XOApplication XOApplication)
 {
     foreach (XOTableContext appItemContext in XOApplication.MenuTables)
     {
         Controller.controllerContext.AddController(appItemContext);
     }
 }