public void CopyFrom(ActivityHarness ah) { _activityStamp = ah.ActivityStamp; IsActivityOwner = ah.IsActivityOwner; if (ah.FixedContext != null) { this.FixedContext = ah.FixedContext; } ApplicationEx.Instance.GetSchema(this); Schema = XDocument.Parse(ApplicationEx.Instance.ServerApplicationService.Response.ToString()); XElement act = (XElement)Schema.Document.Root.FirstNode; PublishResponse(act); if (_customSchemaControls != null) { IEnumerator <ICustomSchemaPublisher> e = CustomSchemaControls.GetEnumerator(); while (e.MoveNext()) { e.Current.CustomPublishSchema(act, this.FixedContext); } } this._duplicateIndex = ApplicationEx.Instance.RegisterActivityCopy(this._container); }
internal void GetSchema(ActivityHarness harness) { XElement xml = new XElement(Common.Requests.PublishSchema); //Request.CreateElement(Common.Requests.PublishSchema); xml.SetAttributeValue(Common.ActivityHandle, harness.ActivityStamp); harness.AppendDataPublicationsToActivityRequest(xml); //_dontAutoPublishResponse = true; ServerApplicationService.SendRequestToServerPortal(xml, null); //_dontAutoPublishResponse = false; }
internal object OpenNamedWindow(FormDefinition formDef, XElement xml, ActivityHarness sourceHarness) { string url = FormsURL + formDef.Path; object o = null; try { System.Xml.XmlTextReader rdr = UrlAsXmlTextReader(url); o = XamlReader.Load(rdr); } catch (Exception ex) { ApplicationEx.DebugException(ex, url); return(null); } if (o is WindowEx) { WindowEx w = (WindowEx)o; if (sourceHarness == null) { w.Initialise(xml); } else { w.InitialiseCopy(sourceHarness); } w.Show(); } else if (o is TabItem) { TabItem ti = (TabItem)o; if (ti is TabItemEx) { TabItemEx ati = (TabItemEx)ti; ati.IsDynamic = true; if (sourceHarness == null) { ati.Initialise(xml); } else { ati.InitialiseCopy(sourceHarness); ati.Harness.IsActivityOwner = false; } } //homeTabControl.Items.Add(ti); //homeTabControl.SelectedItem = ti; } return(o); }
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); } }
public void CopyFrom(ActivityHarness ah) { _activityStamp = ah.ActivityStamp; IsActivityOwner = ah.IsActivityOwner; if (ah.FixedContext != null) this.FixedContext = ah.FixedContext; ApplicationEx.Instance.GetSchema(this); Schema = XDocument.Parse(ApplicationEx.Instance.ServerApplicationService.Response.ToString()); XElement act = (XElement)Schema.Document.Root.FirstNode; PublishResponse(act); if (_customSchemaControls != null) { IEnumerator<ICustomSchemaPublisher> e = CustomSchemaControls.GetEnumerator(); while (e.MoveNext()) { e.Current.CustomPublishSchema(act, this.FixedContext); } } this._duplicateIndex = ApplicationEx.Instance.RegisterActivityCopy(this._container); }
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)); } } } }
partial void CreateActivityContainerInternal(string activity, string style, XElement xml, ActivityHarness sourceHarness);
public void CreateActivityContainer(string activity, string style, XElement xml, ActivityHarness sourceHarness) { CreateActivityContainerInternal(activity, style, xml, sourceHarness); }
partial void CreateActivityContainerInternal(string activity, string style, XElement xml, ActivityHarness sourceHarness) { string formFullName = FormMappings.GetFormFullName(activity, style); CreateActivityContainerInternal(formFullName, xml); }
internal object OpenNamedWindow(FormDefinition formDef, XElement xml, ActivityHarness sourceHarness) { string url = FormsURL + formDef.Path; object o = null; try { System.Xml.XmlTextReader rdr = UrlAsXmlTextReader(url); o = XamlReader.Load(rdr); } catch (Exception ex) { ApplicationEx.DebugException(ex, url); return null; } if (o is WindowEx) { WindowEx w = (WindowEx)o; if (sourceHarness == null) { w.Initialise(xml); } else { w.InitialiseCopy(sourceHarness); } w.Show(); } else if (o is TabItem) { TabItem ti = (TabItem)o; if (ti is TabItemEx) { TabItemEx ati = (TabItemEx)ti; ati.IsDynamic = true; if (sourceHarness == null) { ati.Initialise(xml); } else { ati.InitialiseCopy(sourceHarness); ati.Harness.IsActivityOwner = false; } } //homeTabControl.Items.Add(ti); //homeTabControl.SelectedItem = ti; } return o; }