Ejemplo n.º 1
0
        private void TbItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TextBlock tb = sender as TextBlock;

            if (tb.Tag is NavigateGroup)
            {
                NavigateGroup group = tb.Tag as NavigateGroup;

                DataEntityQuery <EAS.Explorer.Entities.Module> query = new DataEntityQuery <Explorer.Entities.Module>();
                var v = query.Where(p => p.Guid == group.WFModule);
                DataPortal <EAS.Explorer.Entities.Module> dp = new DataPortal <Explorer.Entities.Module>();
                dp.BeginExecuteSingleQuery(v).Completed +=
                    (s, e2) =>
                {
                    QueryTask <EAS.Explorer.Entities.Module> task = s as QueryTask <EAS.Explorer.Entities.Module>;
                    if (task.DataEntity != null)
                    {
                        try
                        {
                            System.Type T3    = EAS.Objects.ClassProvider.GetType(task.DataEntity.Assembly, task.DataEntity.Type);
                            object      addIn = System.Activator.CreateInstance(T3);
                            this.LoadModule(addIn);
                        }
                        catch (System.Exception exc)
                        {
                            MessageBox.Show("打开模块出错:" + exc.Message, "错误", MessageBoxButton.OK);
                        }
                    }
                };
            }
            else if (tb.Tag is NavigateModule)
            {
                NavigateModule module = tb.Tag as NavigateModule;

                try
                {
                    System.Type T2    = EAS.Objects.ClassProvider.GetType(module.Assembly, module.Type);
                    object      addIn = System.Activator.CreateInstance(T2);
                    this.LoadModule(addIn);
                }
                catch (System.Exception exc)
                {
                    MessageBox.Show("打开模块出错:" + exc.Message, "错误", MessageBoxButton.OK);
                }
            }
            else if (tb.Tag is Type)
            {
                System.Type T     = tb.Tag as Type;
                object      addIn = System.Activator.CreateInstance(T);
                this.LoadModule(addIn);
            }
        }