示例#1
0
        partial void CreateActivityContainerInternal(string form, XElement xml)
        {
            if (XamlFileDetailsCollection.ContainsKey(form))
            {
                NavigationCacheActivityXML = xml;
                XAMLFileDetails fileDetails = XamlFileDetailsCollection[form];

                string xamlFileName = fileDetails.FileName;
                ActivityHostFrame.Navigate(new Uri("/" + xamlFileName, UriKind.Relative));
            }
            else
            {
                throw new Exception(String.Format("Activity '{0}' could not be created. Check your FormMapping.xml. Ensure the namespaces element matches your project's namespace and your activity elements are configured to map Server Activities to local Views.", form));
            }
        }
示例#2
0
        partial void CreateActivityContainerInternal(string activity, string style, XElement xml, ActivityHarness sourceHarness)
        {
            // If the container is a Page, navigate to it. If it is a ChildWindow, display it.
            string formFullName = FormMappings.GetFormFullName(activity, style);

            Assembly assembly = Assembly.GetCallingAssembly();
            //var wex = assembly.CreateInstance(formFullName) as IActivityContainer;
            Type type = assembly.GetType(formFullName);

            if (type == null)
            {
                assembly = Application.Current.GetType().Assembly;
                //wex = assembly.CreateInstance(formFullName) as IActivityContainer;
                type = assembly.GetType(formFullName);
            }

            if (type != null)
            {
                if (type.IsSubclassOf(typeof(Page)) && XamlFileDetailsCollection.ContainsKey(formFullName))
                {
                    // This is a Page, so navigate to the view
                    NavigationCacheActivityXML = xml;
                    XAMLFileDetails fileDetails = XamlFileDetailsCollection[formFullName];

                    string xamlFileName = fileDetails.FileName;
                    ActivityHostFrame.Navigate(new Uri("/" + xamlFileName, UriKind.Relative));
                }
                else
                {
                    var view = assembly.CreateInstance(formFullName) as IActivityContainer;

                    if (view != null)
                    {
                        view.ActivityName  = activity;
                        view.ActivityStyle = style;
                        view.Initialise(xml);

                        ShowActivityContainer(view);
                    }
                    else
                    {
                        throw new Exception(String.Format("Activity '{0}' could not be created. Check your form mapping file. Ensure the namespaces element matches your project's namespace and your activity elements are configured to map Server Activities to local Views.", formFullName));
                    }
                }
            }
        }