예제 #1
0
        /// <summary>
        /// Opens a dialog to let the user choose a type references from the specified assembly.
        /// </summary>
        /// <param name="assembly">the assembly to choose from</param>
        protected void ChooseTypeRefFromAssembly(Zetbox.App.Base.Assembly assembly)
        {
            var regenerateCmd = ViewModelFactory.CreateViewModel <RegenerateTypeRefsCommand.Factory>().Invoke(DataContext, Parent, this);
            var selectionTask = ViewModelFactory.CreateViewModel <DataObjectSelectionTaskViewModel.Factory>().Invoke(
                DataContext,
                Parent,
                typeof(TypeRef).GetObjectClass(FrozenContext),
                () => DataContext.GetQuery <Zetbox.App.Base.TypeRef>(),
                (chosen) =>
            {
                if (chosen != null)
                {
                    this.ParentType.Value = chosen.FirstOrDefault();
                }
            },
                new List <CommandViewModel>()
            {
                regenerateCmd
            }
                );

            //var filter = selectionTask.ListViewModel.Filter.Single(i => i.Property.ExportGuid == new Guid("885BFA97-3D43-48BB-A0AA-1049298714FF"));
            //filter.Value = filter.PossibleValues
            //    .Cast<KeyValuePair<DataObjectViewModel, string>>()
            //    .Where(m => m.Key != null)
            //    .FirstOrDefault(m => m.Key.Object == assembly)
            //    .Key;
            regenerateCmd.ListModel = selectionTask.ListViewModel;
            ViewModelFactory.ShowDialog(selectionTask);
        }
예제 #2
0
 /// <summary>
 /// Loads a <see cref="System.Reflection.Assembly"/> from the specified <see cref="Zetbox.App.Base.Assembly"/>.
 /// </summary>
 /// <param name="zetboxAssembly">the assembly to load</param>
 /// <returns>a system assembly loaded in the reflection only application context.</returns>
 protected System.Reflection.Assembly ReflectionFromRef(Zetbox.App.Base.Assembly zetboxAssembly)
 {
     return(System.Reflection.Assembly.ReflectionOnlyLoad(zetboxAssembly.Name));
 }