Exemple #1
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));
                    }
                }
            }
        }
        public ApplicationEx()
        {
            singletonAppInstance = this;

            Application.Current.Exit += Application_Exit;

            if (!IsDesignMode)
            {
                LoadPreferences();

                FormMappings = new FormMappings();

                ServerApplicationService = new ServerApplicationService();
                ServerApplicationService.ServerRequest  += new MessageDelegate(ServerApplicationService_ServerRequest);
                ServerApplicationService.ServerResponse += new MessageDelegate(ServerApplicationService_ServerResponse);
#if WPF
                //EventManager.RegisterClassHandler(typeof(TreeViewItem), TreeViewItem.PreviewMouseRightButtonDownEvent, new RoutedEventHandler(TreeViewItem_PreviewMouseRightButtonDownEvent));
#endif
                InitialiseApplication();
            }
        }
Exemple #3
0
        partial void CreateActivityContainerInternal(string activity, string style, XElement xml, ActivityHarness sourceHarness)
        {
            string formFullName = FormMappings.GetFormFullName(activity, style);

            CreateActivityContainerInternal(formFullName, xml);
        }