Пример #1
0
        public void SetModelItemMSDeployExecutionTypeValue(System.Activities.Presentation.Model.ModelItem modelItem, string modelItemPropertyName, MSDeployExecutionType value)
        {
            var newExpression = new Microsoft.VisualBasic.Activities.VisualBasicValue <MSDeployExecutionType>(typeof(MSDeployExecutionType).FullName + "." + value.ToString());
            var newValue      = new InArgument <MSDeployExecutionType>(newExpression);

            modelItem.Properties[modelItemPropertyName].SetValue(newValue);
        }
Пример #2
0
 public static void SetModelItemExpressionTextValue(ModelItem modelItem, string modelItemPropertyName, string value)
 {
     if (value == null)
     {
         modelItem.Properties[modelItemPropertyName].SetValue(null);
     }
     else
     {
         var newExpression = new Microsoft.VisualBasic.Activities.VisualBasicValue <string>(value);
         var newValue      = new InArgument <string>(newExpression);
         modelItem.Properties[modelItemPropertyName].SetValue(newValue);
     }
 }
Пример #3
0
        public static void PickFile(ModelItem modelItem, string filter, string modelItemPropertyName, bool convertToRelativePath = true)
        {
            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
            openFileDialog.Filter = filter;
            var result = openFileDialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                var newExpression = new Microsoft.VisualBasic.Activities.VisualBasicValue <string>("\"" + openFileDialog.FileName + "\"");
                if (convertToRelativePath)
                {
                    newExpression.ExpressionText = DesignerHelper.ConvertFullPathToRelativePathExpressionText(newExpression.ExpressionText);
                }
                var newValue = new InArgument <string>(newExpression);
                modelItem.Properties[modelItemPropertyName].SetValue(newValue);
            }
        }
Пример #4
0
        public static void PickFolder(ModelItem modelItem, string modelItemPropertyName, bool convertToRelativePath = true)
        {
            FolderBrowserDialog browseFolderDialog = new FolderBrowserDialog();

            browseFolderDialog.ShowNewFolderButton = false;
            var result = browseFolderDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                var newExpression = new Microsoft.VisualBasic.Activities.VisualBasicValue <string>("\"" + browseFolderDialog.SelectedPath + "\"");
                if (convertToRelativePath)
                {
                    newExpression.ExpressionText = DesignerHelper.ConvertFullPathToRelativePathExpressionText(newExpression.ExpressionText);
                }
                var newValue = new InArgument <string>(newExpression);
                modelItem.Properties[modelItemPropertyName].SetValue(newValue);
            }
        }