Example #1
0
        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);
        }
        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();
            }
        }