Beispiel #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));
            }
        }
Beispiel #2
0
 partial void CreateActivityContainerFromPath(string path, XElement xml)
 {
     NavigationCacheActivityXML = xml;
     ActivityHostFrame.Navigate(new Uri(path, UriKind.Relative));
 }
Beispiel #3
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.
            FormDefinition fd = FormMappings.GetFormDefinition(activity, style);

            if (fd == null)
            {
                DisplayMessageBox("No mapping found for " + activity + " (" + style + ")", "Create Activity Error");
                return;
            }

            if (fd.IsLocal)
            {
                string formFullName = FormMappings.GetFormFullName(fd);

                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 FormMapping.xml. Ensure the namespaces element matches your project's namespace and your activity elements are configured to map Server Activities to local Views.", formFullName));
                        }
                    }
                }
            }
            else//load 'loose'
            {
                object o = OpenNamedWindow(fd, xml, sourceHarness);
            }
        }