Esempio n. 1
0
    /// <summary>
    /// Invokes the loose xaml
    /// </summary>
    /// <param name="resolutionOption">
    /// The resolution option.
    /// </param>
    /// <exception cref="ArgumentOutOfRangeException">
    /// The option is unknown
    /// </exception>
    public static void InvokeLooseXaml(XamlAssemblyResolutionOption resolutionOption)
    {
        Console.WriteLine();
        Console.WriteLine("Loose XAML");
        try
        {
            switch (resolutionOption)
            {
                case XamlAssemblyResolutionOption.VersionIndependent:
                    WorkflowInvoker.Invoke(ActivityXamlServices.Load("WorkflowLoose.xaml"));
                    break;
                case XamlAssemblyResolutionOption.FullName:

                    // This will ensure the correct assemblies are loaded prior to loading loose XAML
                    WorkflowInvoker.Invoke(
                        StrictXamlHelper.ActivityLoad("WorkflowLoose.xaml", GetWorkflowLooseReferencedAssemblies()));
                    break;
                default:
                    throw new ArgumentOutOfRangeException("resolutionOption");
            }
        }
        catch (XamlObjectWriterException ex)
        {
            Console.WriteLine("Error loading loose xaml {0}", ex.Message);
        }
        catch (FileNotFoundException fileNotFoundException)
        {
            Console.WriteLine("Could not find assembly {0}", fileNotFoundException.FileName);
        }
        catch (FileLoadException fileLoadException)
        {
            Console.WriteLine("Could not load assembly {0}", fileLoadException.FileName);
        }
    }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WorkflowCompiled"/> class.
 /// </summary>
 /// <param name="assemblyResolutionOption">
 /// The assembly resolution option.
 /// </param>
 public WorkflowCompiled(XamlAssemblyResolutionOption assemblyResolutionOption)
 {
     switch (assemblyResolutionOption)
     {
         case XamlAssemblyResolutionOption.VersionIndependent:
             this.InitializeComponent();
             break;
         case XamlAssemblyResolutionOption.FullName:
             StrictXamlHelper.InitializeComponent(this, this.FindResource(), ReferencedAssemblies);
             break;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WorkflowCompiled"/> class.
 /// </summary>
 /// <param name="assemblyResolutionOption">
 /// The assembly Resolution Option. 
 /// </param>
 /// <remarks>
 /// Provides a constructor overload that allows you to specify a <see cref="XamlAssemblyResolutionOption"/>
 /// </remarks>
 public WorkflowCompiled(XamlAssemblyResolutionOption assemblyResolutionOption)
 {
     switch (assemblyResolutionOption)
     {
         case XamlAssemblyResolutionOption.VersionIndependent:
             this.InitializeComponent();
             break;
         case XamlAssemblyResolutionOption.FullName:
             StrictXamlHelper.InitializeComponent(this, this.FindResource(), ReferencedAssemblies);
             break;
         default:
             throw new ArgumentOutOfRangeException("assemblyResolutionOption");
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Workflow"/> class.
        /// </summary>
        /// <param name="xamlAssemblyResolutionOption">
        /// The xaml assembly resolution option.
        /// </param>
        /// <param name="referencedAssemblies">
        /// The Referenced Assemblies.
        /// </param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// </exception>
        public Workflow(XamlAssemblyResolutionOption xamlAssemblyResolutionOption, IList<string> referencedAssemblies)
        {
            referencedAssemblies.Add(Assembly.GetExecutingAssembly().GetName().FullName);

            switch (xamlAssemblyResolutionOption)
            {
                case XamlAssemblyResolutionOption.FullName:
                    StrictXamlHelper.InitializeComponent(this, this.FindResource(), referencedAssemblies);
                    ShowAssemblies();
                    break;
                case XamlAssemblyResolutionOption.VersionIndependent:
                    this.InitializeComponent();
                    break;
                default:
                    throw new ArgumentOutOfRangeException("xamlAssemblyResolutionOption");
            }
        }