Esempio n. 1
0
        private void ActivityDesigner_Loaded(object sender, RoutedEventArgs e)
        {
            Activities.MSDeploy modelItem = (Activities.MSDeploy)ModelItem.GetCurrentValue();

            bool?defaultBoolValue = (bool?)DesignerHelper.GetDefaultValueAttributeValue(modelItem, "UseVersion2x");

            if (modelItem.UseVersion2x == null && defaultBoolValue != null)
            {
                chkUserVersion2X.IsChecked = defaultBoolValue.Value;
            }

            defaultBoolValue = (bool?)DesignerHelper.GetDefaultValueAttributeValue(modelItem, "DoNotDeleteFiles");

            if (modelItem.DoNotDeleteFiles == null && defaultBoolValue != null)
            {
                chkDoNotDeleteFiles.IsChecked = defaultBoolValue.Value;
            }

            defaultBoolValue = (bool?)DesignerHelper.GetDefaultValueAttributeValue(modelItem, "AllowUntrustedSSLConnection");

            if (modelItem.AllowUntrustedSSLConnection == null && defaultBoolValue != null)
            {
                chkAllowUntrusted.IsChecked = defaultBoolValue.Value;
            }

            defaultBoolValue = (bool?)DesignerHelper.GetDefaultValueAttributeValue(modelItem, "Test");

            if (modelItem.Test == null && defaultBoolValue != null)
            {
                chkTest.IsChecked = defaultBoolValue.Value;
            }

            MSDeployExecutionType?executionTypeDefaultValue = (MSDeployExecutionType?)DesignerHelper.GetDefaultValueAttributeValue(modelItem, "ExecutionType");

            if (modelItem.ExecutionType == null)
            {
                if (executionTypeDefaultValue != null)
                {
                    if (executionTypeDefaultValue.Value == MSDeployExecutionType.Cmd)
                    {
                        rdoCmd.IsChecked = true;
                    }
                    else
                    {
                        rdoExe.IsChecked = true;
                    }
                }
            }
            else
            {
                MSDeployExecutionType?executionType = GetModelItemMSDeployExecutionTypeValue(ModelItem, "ExecutionType");
                if (executionType == MSDeployExecutionType.Cmd)
                {
                    rdoCmd.IsChecked = true;
                }
                else
                {
                    rdoExe.IsChecked = true;
                }
            }

            int?versionDefaultValue = (int?)DesignerHelper.GetDefaultValueAttributeValue(modelItem, "UseVersion");

            if (modelItem.UseVersion == null)
            {
                if (versionDefaultValue != null)
                {
                    cmbVersion.SelectedIndex = versionDefaultValue.Value - 1;
                }
            }
            else
            {
                cmbVersion.SelectedIndex = DesignerHelper.GetInArgumentModelItemIntValue(ModelItem, "UseVersion").Value - 1;
            }
        }