Пример #1
0
 private static object WarmUpPropertyCacheByITypeId(object arg)
 {
     PropertyCacheHelper.DispatchArguments arguments = (PropertyCacheHelper.DispatchArguments)arg;
     if (arguments.ViewModel.Document != null)
     {
         ITypeResolver typeResolver = (ITypeResolver)arguments.ViewModel.ProjectContext;
         IType         type         = typeResolver.ResolveType(arguments.TypeList[arguments.Index]);
         if (!typeResolver.PlatformMetadata.IsNullType((ITypeId)type))
         {
             arguments.ViewModel.CreateSceneNode((ITypeId)type);
         }
         ++arguments.Index;
         if (arguments.Index < arguments.TypeList.Length)
         {
             if (PropertyCacheHelper.Synchronous)
             {
                 PropertyCacheHelper.WarmUpPropertyCacheByITypeId((object)arguments);
             }
             else
             {
                 UIThreadDispatcher.Instance.BeginInvoke <object>(DispatcherPriority.ApplicationIdle, (Func <object>)(() => PropertyCacheHelper.WarmUpPropertyCacheByITypeId((object)arguments)));
             }
         }
     }
     return((object)null);
 }
Пример #2
0
 public static void PopulateDocumentSpecificPropertyCache(SceneViewModel viewModel)
 {
     PropertyCacheHelper.DispatchArguments arguments = new PropertyCacheHelper.DispatchArguments();
     arguments.ViewModel = viewModel;
     if (viewModel.Document == null || DocumentContextHelper.GetDesignDataMode((IProject)viewModel.ProjectContext.GetService(typeof(IProject)), viewModel.Document.Path) != DesignDataMode.None)
     {
         return;
     }
     if (!viewModel.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf))
     {
         if (PropertyCacheHelper.InitializedSl)
         {
             return;
         }
         PropertyCacheHelper.InitializedSl = true;
         arguments.TypeList = new ITypeId[17]
         {
             PlatformTypes.Rectangle,
             PlatformTypes.Ellipse,
             PlatformTypes.Path,
             PlatformTypes.Grid,
             PlatformTypes.Canvas,
             PlatformTypes.StackPanel,
             PlatformTypes.ScrollViewer,
             PlatformTypes.Border,
             PlatformTypes.TextBox,
             PlatformTypes.TextBlock,
             PlatformTypes.PasswordBox,
             PlatformTypes.Button,
             PlatformTypes.CheckBox,
             PlatformTypes.ListBox,
             PlatformTypes.RadioButton,
             PlatformTypes.Slider,
             PlatformTypes.ScrollBar
         };
     }
     else
     {
         if (PropertyCacheHelper.InitializedWpf)
         {
             return;
         }
         PropertyCacheHelper.InitializedWpf = true;
         arguments.TypeList = new ITypeId[27]
         {
             PlatformTypes.Rectangle,
             PlatformTypes.Ellipse,
             PlatformTypes.Path,
             PlatformTypes.Grid,
             PlatformTypes.Canvas,
             PlatformTypes.StackPanel,
             ProjectNeutralTypes.WrapPanel,
             ProjectNeutralTypes.DockPanel,
             PlatformTypes.ScrollViewer,
             PlatformTypes.Border,
             ProjectNeutralTypes.Viewbox,
             PlatformTypes.TextBox,
             PlatformTypes.TextBlock,
             PlatformTypes.RichTextBox,
             PlatformTypes.PasswordBox,
             ProjectNeutralTypes.Label,
             PlatformTypes.FlowDocumentScrollViewer,
             PlatformTypes.Button,
             PlatformTypes.CheckBox,
             PlatformTypes.ComboBox,
             PlatformTypes.ListBox,
             PlatformTypes.RadioButton,
             PlatformTypes.Slider,
             ProjectNeutralTypes.TabControl,
             ProjectNeutralTypes.GridSplitter,
             PlatformTypes.ScrollBar,
             PlatformTypes.UniformGrid
         };
     }
     if (PropertyCacheHelper.Synchronous)
     {
         PropertyCacheHelper.WarmUpPropertyCacheByITypeId((object)arguments);
     }
     else
     {
         UIThreadDispatcher.Instance.BeginInvoke <object>(DispatcherPriority.ApplicationIdle, (Func <object>)(() => PropertyCacheHelper.WarmUpPropertyCacheByITypeId((object)arguments)));
     }
 }