Beispiel #1
0
        internal static Result RunGraph(UIApplication app, string dynamoJournal)
        {
            //toggle the graph to automatic. this is required for running Dynamo UI-Les
            DynamoUtils.SetToAutomatic(dynamoJournal);

            DynamoRevit dynamoRevit = new DynamoRevit();


            IDictionary <string, string> journalData = new Dictionary <string, string>
            {
                { JournalKeys.ShowUiKey, false.ToString() },
                { JournalKeys.AutomationModeKey, true.ToString() },
                { JournalKeys.DynPathKey, "" },
                { JournalKeys.DynPathExecuteKey, true.ToString() },
                { JournalKeys.ForceManualRunKey, false.ToString() },
                { JournalKeys.ModelShutDownKey, true.ToString() },
                { JournalKeys.ModelNodesInfo, false.ToString() },
            };
            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData
            {
                Application = app,
                JournalData = journalData
            };

            var result = dynamoRevit.ExecuteCommand(dynamoRevitCommandData);


            DynamoRevit.RevitDynamoModel.OpenFileFromPath(dynamoJournal, true);
            DynamoRevit.RevitDynamoModel.ForceRun();

            return(result);
        }
Beispiel #2
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            string dynamoJournal = Globals.CurrentGraphToRun;

            if (string.IsNullOrWhiteSpace(dynamoJournal))
            {
                return(Result.Failed);
            }

            //toggle the graph to automatic. this is required for running Dynamo UI-Les
            DynamoUtils.SetToAutomatic(dynamoJournal);

            DynamoRevit dynamoRevit = new DynamoRevit();

            IDictionary <string, string> journalData = new Dictionary <string, string>
            {
                { JournalKeys.ShowUiKey, false.ToString() },
                { JournalKeys.AutomationModeKey, true.ToString() },
                { JournalKeys.DynPathKey, dynamoJournal },
                { JournalKeys.DynPathExecuteKey, true.ToString() },
                { JournalKeys.ForceManualRunKey, false.ToString() },
                { JournalKeys.ModelShutDownKey, true.ToString() },
                { JournalKeys.ModelNodesInfo, false.ToString() },
            };
            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData
            {
                Application = commandData.Application, JournalData = journalData
            };

            return(dynamoRevit.ExecuteCommand(dynamoRevitCommandData));
        }
Beispiel #3
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            string dynamoJournal = Globals.CurrentGraphToRun;

            if (string.IsNullOrWhiteSpace(dynamoJournal))
            {
                return(Result.Failed);
            }

            //toggle the graph to automatic. this is required for running Dynamo UI-Les
            DynamoUtils.SetToAutomatic(dynamoJournal);

            //this is the UI stuff
            //if (File.Exists(Path.Combine(Globals.ExecutingPath, "Prlx.RelayUI.dll")))
            //{
            //    try
            //    {
            //        Prlx.RelayUI.UI.SampleWindow sample = Prlx.RelayUI.Utilities.BuildUI(dynamoJournal);
            //        sample.ShowDialog();
            //    }
            //    catch (Exception e)
            //    {
            //        string messages = e.Message;
            //        //suppress the warning something went wrong.
            //    }
            //}

            DynamoRevit dynamoRevit = new DynamoRevit();



            IDictionary <string, string> journalData = new Dictionary <string, string>
            {
                { JournalKeys.ShowUiKey, false.ToString() },
                { JournalKeys.AutomationModeKey, true.ToString() },
                { JournalKeys.DynPathKey, "" },
                { JournalKeys.DynPathExecuteKey, true.ToString() },
                { JournalKeys.ForceManualRunKey, false.ToString() },
                { JournalKeys.ModelShutDownKey, true.ToString() },
                { JournalKeys.ModelNodesInfo, false.ToString() },
            };
            DynamoRevitCommandData dynamoRevitCommandData = new DynamoRevitCommandData
            {
                Application = commandData.Application,
                JournalData = journalData
            };

            dynamoRevit.ExecuteCommand(dynamoRevitCommandData);


            DynamoRevit.RevitDynamoModel.OpenFileFromPath(dynamoJournal, true);
            DynamoRevit.RevitDynamoModel.ForceRun();

            return(Result.Succeeded);
        }
Beispiel #4
0
        private async Task UpdateTableAsync(IAmazonDynamoDB client, string authorizationTableName,
                                            List <GlobalSecondaryIndexUpdate> indexUpdates)
        {
            await client.UpdateTableAsync(new UpdateTableRequest
            {
                TableName = authorizationTableName,
                GlobalSecondaryIndexUpdates = indexUpdates
            });

            await DynamoUtils.WaitForActiveTableAsync(client, authorizationTableName);
        }
Beispiel #5
0
        private async Task CreateTableAsync(IAmazonDynamoDB client, string tokenTableName,
                                            ProvisionedThroughput provisionedThroughput, List <GlobalSecondaryIndex> globalSecondaryIndexes)
        {
            var response = await client.CreateTableAsync(new CreateTableRequest
            {
                TableName             = tokenTableName,
                ProvisionedThroughput = provisionedThroughput,
                KeySchema             = new List <KeySchemaElement>
                {
                    new KeySchemaElement
                    {
                        AttributeName = "Id",
                        KeyType       = KeyType.HASH
                    }
                },
                AttributeDefinitions = new List <AttributeDefinition>
                {
                    new AttributeDefinition
                    {
                        AttributeName = "Id",
                        AttributeType = ScalarAttributeType.S
                    },
                    new AttributeDefinition
                    {
                        AttributeName = "Subject",
                        AttributeType = ScalarAttributeType.S
                    },
                    new AttributeDefinition
                    {
                        AttributeName = "Application",
                        AttributeType = ScalarAttributeType.S
                    },
                    new AttributeDefinition
                    {
                        AttributeName = "Authorization",
                        AttributeType = ScalarAttributeType.S
                    }
                },
                GlobalSecondaryIndexes = globalSecondaryIndexes
            });

            if (response.HttpStatusCode != HttpStatusCode.OK)
            {
                throw new Exception($"Couldn't create table {tokenTableName}");
            }

            await DynamoUtils.WaitForActiveTableAsync(client, tokenTableName);
        }
        public CIQUser Get(string id)
        {
            var userExists = DynamoUtils.EntryExists <CIQUser>(id);

            if (userExists)
            {
                var user = DynamoUtils.GetById <CIQUser>(id);
                return(user);
            }
            else
            {
                var user         = createNewUser(id);
                var insertResult = user.Insert().Result;
                return(user);
            }
        }