示例#1
0
 public override void SaveElement(FamilyTemplate element)
 {
     element.EndEdit();
     FamFactoryDataSet.SaveTableChangesToDatbase(SQLiteConnection, InternalDataView.Table);
     FamFactoryDataSet.SaveTableChangesToDatbase(SQLiteConnection, SelectedElement.FamilyTemplateReferencePlanes.InternalDataView.Table);
     FamFactoryDataSet.SaveTableChangesToDatbase(SQLiteConnection, SelectedElement.FamilyTemplateParameters.InternalDataView.Table);
     FamFactoryDataSet.SaveTableChangesToDatbase(SQLiteConnection, SelectedElement.FamilyTemplateGeometries.InternalDataView.Table);
     RefreshCollections();
 }
        public FamFactoryApplication()
        {
            System.Data.SQLite.SQLiteConnection conn = FamFactoryDataSet.GetSQlteConnection(@"c:\temp\famFactoryDatabase.db");
            //famFactoryViewModel = new FamFactoryViewModel(set, conn);
            //famFactoryViewModel.LogIn(famFactoryViewModel.UserItems.InternalCollection[0]);


            User user = FamFactoryDataSet.AuthenticateUser("Admin", "Password", conn);

            famFactoryViewModel = new FamFactoryViewModel(set, conn, user);
        }
示例#3
0
        private void ControlledApplication_ApplicationInitialized(object sender, Autodesk.Revit.DB.Events.ApplicationInitializedEventArgs e)
        {
            RevitApplicationService = sender as Autodesk.Revit.ApplicationServices.Application;
            sQLiteConnection        = FamFactoryDataSet.GetSQlteConnection(@"c:\temp\famFactoryDatabase.db");
            famFactoryDataSet       = new DataSet("famFactoryDatabase");

            string file = @"c:\temp\famFactoryDatabase.db";

            if (!System.IO.File.Exists(file))
            {
                FamFactoryDataSet.CreateSQliteDataBase(file, Resources.FamFactoryDBTables, famFactoryDataSet);
                FamFactoryDataSet.InstallRequierments(sQLiteConnection, famFactoryDataSet);
            }
            else
            {
                FamFactoryDataSet.InitilizeDataSet(famFactoryDataSet);
            }


            // Authenticate with username and pass to get User object.
            // Create FamfactoryObject with authenticated User.
            User user = FamFactoryDataSet.AuthenticateUser("Admin", "Password", sQLiteConnection);

            famFactoryManager = new FamFactoryViewModel(famFactoryDataSet, sQLiteConnection, user, RevitApplicationService);


            //installationConfiguration = new DataProvidor.Installation.InstallationConfiguration();
            //installationConfiguration.Load("config.xml");
            //famFactoryDBContext = ModBox.FamFactory.DataProvidor.FamFactoryDBContext.Instance(installationConfiguration.connectionData);
            //famFactoryViewModel = new ObjectControls.FamFactoryViewModel(famFactoryDBContext);

            //if (string.IsNullOrEmpty(ReadWriteProperteis.AuthenticationKey) || string.IsNullOrEmpty(ReadWriteProperteis.UserName))
            //{
            //    LogIn(famFactoryDBContext, true);
            //}
            //else
            //{
            //    activeUser = famFactoryDBContext.AuthenticateUser(ReadWriteProperteis.UserName, ReadWriteProperteis.AuthenticationKey);
            //    TaskDialog taskDialog = new TaskDialog("Logged In");
            //    if (activeUser != null && activeUser.IsAuthenticated == true)
            //    {
            //        activeUser.LogIn();
            //        taskDialog.Show();
            //    }
            //}
        }
示例#4
0
        private void StartApplication(User user)
        {
            try
            {
                FamFactoryDataSet.UpdateDataSetFromDataSource(SQLiteConnection, InternalDataSet);
                _UsersViewModel           = new UsersViewModel(InternalDataSet, SQLiteConnection, user);
                _FamilyTemplatesViewModel = new FamilyTemplatesViewModel(InternalDataSet, SQLiteConnection, user, ADSKApplciation);
                _FamilyComponentViewModel = new FamFactoryComponentViewModel(InternalDataSet, SQLiteConnection, user, ADSKApplciation);

                Pages.SystemConfigurationView systemConfigurationView = new Pages.SystemConfigurationView(this);
                Pages.UsersView           usersView           = new Pages.UsersView(this);
                Pages.FamilyTemplatesView FamTempView         = new Pages.FamilyTemplatesView(this);
                Pages.FamilyComponentView familyComponentView = new Pages.FamilyComponentView(this);

                AddElement(usersView);
                AddElement(systemConfigurationView);
                AddElement(FamTempView, true);
                AddElement(familyComponentView);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
 public override void SaveElement(FamilyTemplateComponent element)
 {
     FamFactoryDataSet.SaveTableChangesToDatbase(SQLiteConnection, InternalDataView.Table);
     RefreshCollections();
 }