当前位置: 首页>>代码示例>>C#>>正文


C# IView.GetType方法代码示例

本文整理汇总了C#中IView.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IView.GetType方法的具体用法?C# IView.GetType怎么用?C# IView.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IView的用法示例。


在下文中一共展示了IView.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReleaseView

		public void ReleaseView(ControllerContext controllerContext, IView view)
		{
			using (ProfilerResolver.Current.Profiler.Step(string.Format("{0}.ReleaseView, {1}", _name, view.GetType().Name)))
			{
				_inner.ReleaseView(controllerContext, view);
			}
		}
开发者ID:phaniarveti,项目名称:Experiments,代码行数:7,代码来源:ProfilingViewEngine.cs

示例2: RegisterReverseOrder

        /// <summary>
        /// Indicates whether the views are rendered in reverse order.
        /// If so, scripts & css should be executed also in reverse order.
        /// 
        /// We do this for Razor views only, based on the LayoutPath.
        /// </summary>
        /// <param name="container"></param>
        /// <param name="view"></param>
        /// <param name="viewPath"></param>
        /// <returns></returns>
        public static bool RegisterReverseOrder(this IViewDataContainer container, IView view, out string viewPath)
        {
            // yeah, I know this is kinda gay, but it's the only way to keep MVC 2 compatible
            Type razorViewAssignableFrom = new Func<Type>(() =>
                {
                    try
                    {
                        var mvcDll = AppDomain.CurrentDomain.GetAssemblies().Where(t => t.GetName().Name == "System.Web.Mvc");

                        var compiledView = mvcDll.First().GetType("System.Web.Mvc.RazorView");
                        if (compiledView.IsAssignableFrom(view.GetType())) return compiledView;

                        return null;
                    }
                    catch
                    {
                        return null;
                    }
                })();

            // not a Razor view? Then return false.
            if (razorViewAssignableFrom == null)
            {
                viewPath = null;
                return false;
            }

            viewPath = container.GetType().Name;
            return true;
        }
开发者ID:kijanawoodard,项目名称:Moth,代码行数:40,代码来源:MothEnabled.cs

示例3: WindowLogic

        /// <summary>
        /// Initializes a new instance of the <see cref="WindowLogic"/> class.
        /// </summary>
        /// <param name="targetWindow">The window this provider should take care of.</param>
        /// <param name="viewModelType">Type of the view model.</param>
        /// <param name="viewModel">The view model to inject.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="targetWindow"/> is <c>null</c>.</exception>
        public WindowLogic(IView targetWindow, Type viewModelType = null, IViewModel viewModel = null)
            : base(targetWindow, viewModelType, viewModel)
        {
            var targetWindowType = targetWindow.GetType();

            string eventName;

            var closedEvent = targetWindowType.GetEventEx("Closed");
            if (closedEvent != null)
            {
                eventName = "Closed";

                _dynamicEventListener = new DynamicEventListener(targetWindow, "Closed", this, "OnTargetWindowClosed");
            }
            else
            {
                eventName = "Unloaded";

                _dynamicEventListener = new DynamicEventListener(targetWindow, "Unloaded", this, "OnTargetWindowClosed");
            }

            _targetWindowClosedEventName = eventName;

            Log.Debug("Using '{0}.{1}' event to determine window closing", targetWindowType.FullName, eventName);
        }
开发者ID:Catel,项目名称:Catel,代码行数:32,代码来源:WindowLogic.cs

示例4: Create

        public IPresenter Create(Type presenterType, Type viewType, IView viewInstance)
        {
            // If a PresenterBinding attribute is applied directly to a view and the ViewType
            // property is not explicitly set, it will be defaulted to the view type. In a
            // user control example, this will be a type like ASP.usercontrols_mycontrol_ascx.
            // If we register it into the container using this type, and then try and resolve
            // a presenter like Presenter<IView> unity will throw an exception because it
            // doesn't use covariance when resolving dependencies. To get around this, we
            // look at the generic type argument on the presenter type (in this case, IView)
            // and register the view instance against that instead.
            if (viewType == viewInstance.GetType())
            {
                viewType = FindPresenterDescribedViewTypeCached(presenterType, viewInstance);
            }

            var presenterScopedContainer = container.CreateChildContainer();
            presenterScopedContainer.RegisterInstance(viewType, viewInstance);

            var presenter = (IPresenter)presenterScopedContainer.Resolve(presenterType);

            lock (presentersToContainersSyncLock)
            {
                presentersToContainers[presenter] = presenterScopedContainer;
            }

            return presenter;
        }
开发者ID:phiree,项目名称:dzdocs,代码行数:27,代码来源:UnityPresenterFactory.cs

示例5: ProfilingView

		public ProfilingView(IView inner)
		{
			_inner = inner;
			_name = inner.GetType().Name;
			var razorView = inner as RazorView;
			_viewPath = razorView != null ? razorView.ViewPath : "Unknown";
		}
开发者ID:phaniarveti,项目名称:Experiments,代码行数:7,代码来源:ProfilingView.cs

示例6: BindView

        public static string BindView(IView view)
        {
            var viewType = view.GetType();
            if (!File.Exists(RootFolder + viewType.Name + ".txt"))
                throw new TemplateViewNotFoundViewException(viewType.Name, RootFolder + viewType.Name + ".txt");

            return MatchViewRootProperties(view, MatchViewProperties(view, viewType.Name));

        }
开发者ID:vilhena,项目名称:PROMPT11-01-VMEssentials.vilhena,代码行数:9,代码来源:ViewBinder.cs

示例7: Controller

 /// <summary>
 /// Initializes a new instance of the System.Moblie.Mvc.Controller class with the IView.
 /// </summary>
 /// <param name="view">The instance of the view</param>
 public Controller(IView view)
 {
     this.name = this.GetType().Name;
     this.view = view;
     this.view.ViewStateChanged += new StateChangedEventHandler(view_StateChanged);
     this.controllerMethods = this.GetMethods(this.GetType());
     this.viewMethods = this.GetMethods(view.GetType());
     this.HookEvents(view, this, this.controllerMethods);
     this.HookEvents(this, view, this.viewMethods);
 }
开发者ID:xorkrus,项目名称:vk_wm,代码行数:14,代码来源:Controller.cs

示例8: TryInjectViewModel

        private void TryInjectViewModel(IView view)
        {
            var viewType = view.GetType();
            var viewModelType = GetViewModelType(viewType);

            if (viewModelType != null)
            {
                var viewModel = typeFactory.Create(viewModelType);
                view.SetViewModel(viewModel);
            }
        }
开发者ID:modulexcite,项目名称:OmniXAML,代码行数:11,代码来源:ViewFactory.cs

示例9: ViewInterceptor

        public ViewInterceptor(object view)
        {
            if (!(view is Page) || !(view is IView))
            {
                throw new ArgumentException("view");
            }

            this.page = view as Page;
            this.view = view as IView;
            this.page.Loaded += OnLoaded;
            this.interfaceType = view.GetType().GetTypeInfo().ImplementedInterfaces.FirstOrDefault(i => i.Name == typeof (IView<>).Name);
            this.isGeneric = this.interfaceType != null;
        }
开发者ID:fernandoescolar,项目名称:myweather,代码行数:13,代码来源:ViewInterceptor.cs

示例10: GetBinding

        internal static PresenterDiscoveryResult GetBinding(IView viewInstance, IBuildManager buildManager, IEnumerable<string> viewInstanceSuffixes, IEnumerable<string> presenterTypeFullNameFormats)
        {
            var viewType = viewInstance.GetType();

            var searchResult = viewTypeToPresenterTypeCache.GetOrCreateValue(viewType.TypeHandle, () =>
                PerformSearch(viewInstance, viewInstanceSuffixes, presenterTypeFullNameFormats, buildManager));

            return new PresenterDiscoveryResult(
                new[] {viewInstance},
                searchResult.Message,
                searchResult.PresenterType == null
                    ? new PresenterBinding[0]
                    : new [] { new PresenterBinding(searchResult.PresenterType, viewType, BindingMode.Default, new[] { viewInstance }) }
            );
        }
开发者ID:unochild,项目名称:webformsmvp,代码行数:15,代码来源:ConventionBasedPresenterDiscoveryStrategy.cs

示例11: AutoWireViewModelChanged

        /// <summary>
        /// Automatically looks up the viewmodel that corresponds to the current view, using two strategies:
        /// It first looks to see if there is a mapping registered for that view, if not it will fallback to the convention based approach.
        /// </summary>
        /// <param name="view">The dependency object, typically a view.</param>
        /// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        public static void AutoWireViewModelChanged(IView view)
        {
            // Try mappings first
            object viewModel = GetViewModelForView(view);
            // Fallback to convention based
            if (viewModel == null)
            {
                var viewModelType = defaultViewTypeToViewModelTypeResolver(view.GetType());
                if (viewModelType == null) return;

                // Really need Container or Factories here to deal with injecting dependencies on construction
                viewModel = defaultViewModelFactory(viewModelType);
            }
            
            view.DataContext = viewModel;
        }
开发者ID:selvendiranj,项目名称:compositewpf-copy,代码行数:22,代码来源:ViewModelLocationProvider.cs

示例12: DockForm

    public DockForm(IView view, bool allowContextMenu) {
      InitializeComponent();
      this.view = view;
      this.allowContextMenu = allowContextMenu;

      if (view != null) {
        if (view is UserControl) {
          switch (((UserControl)view).Dock) {
            case DockStyle.Left:
              this.ShowHint = DockState.DockLeft;
              break;
            case DockStyle.Right:
              this.ShowHint = DockState.DockRight;
              break;
            case DockStyle.Top:
              this.ShowHint = DockState.DockTop;
              break;
            case DockStyle.Bottom:
              this.ShowHint = DockState.DockBottom;
              break;
          }
          Sidebar sidebar = view as Sidebar;
          if (sidebar != null) {
            if (sidebar.Collapsed)
              this.ShowHint = DockState.DockLeftAutoHide;
            else
              this.ShowHint = DockState.DockLeft;
            this.DockAreas = DockAreas.DockLeft | DockAreas.DockRight;
          }

          Type viewType = view.GetType();
          Control control = (Control)view;
          control.Dock = DockStyle.Fill;
          this.view.CaptionChanged += new EventHandler(View_CaptionChanged);
          UpdateText();
          viewPanel.Controls.Add(control);
        }
      } else {
        Label errorLabel = new Label();
        errorLabel.Name = "errorLabel";
        errorLabel.Text = "No view available";
        errorLabel.AutoSize = false;
        errorLabel.Dock = DockStyle.Fill;
        viewPanel.Controls.Add(errorLabel);
      }
    }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:46,代码来源:DockForm.cs

示例13: DocumentForm

 public DocumentForm(IView view)
   : this() {
   this.view = view;
   if (view != null) {
     Type viewType = view.GetType();
     Control control = (Control)view;
     control.Dock = DockStyle.Fill;
     view.CaptionChanged += new EventHandler(View_CaptionChanged);
     UpdateText();
     viewPanel.Controls.Add(control);
   } else {
     Label errorLabel = new Label();
     errorLabel.Name = "errorLabel";
     errorLabel.Text = "No view available";
     errorLabel.AutoSize = false;
     errorLabel.Dock = DockStyle.Fill;
     viewPanel.Controls.Add(errorLabel);
   }
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:19,代码来源:DocumentForm.cs

示例14: RegisterView

        /// <summary>
        /// Registers a view so it can be linked to a view model instance.
        /// </summary>
        /// <param name="view">The view to register.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="view"/> is <c>null</c>.</exception>
        public virtual void RegisterView(IView view)
        {
            Argument.IsNotNull("view", view);

            var viewType = view.GetType().FullName;

            Log.Debug("Registering view '{0}'", viewType);

            lock (_syncObj)
            {
                if (_registeredViews.ContainsKey(view))
                {
                    Log.Warning("View '{0}' is already registered", viewType);
                    return;
                }

                view.ViewModelChanged += OnViewModelChanged;

                SyncViewModelOfView(view);
            }

            Log.Debug("Registered view '{0}'", viewType);
        }
开发者ID:matthijskoopman,项目名称:Catel,代码行数:28,代码来源:ViewManager.cs

示例15: UnregisterView

        /// <summary>
        /// Unregisters a view so it can no longer be linked to a view model instance.
        /// </summary>
        /// <param name="view">The view to unregister.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="view"/> is <c>null</c>.</exception>
        public void UnregisterView(IView view)
        {
            Argument.IsNotNull("view", view);

            var viewType = view.GetType().FullName;

            Log.Debug("Unregistering view '{0}'", viewType);

            lock (_syncObj)
            {
                if (!_registeredViews.ContainsKey(view))
                {
                    Log.Warning("View '{0}' is not registered", viewType);
                    return;
                }

                view.ViewModelChanged -= OnViewModelChanged;

                _registeredViews.Remove(view);
            }

            Log.Debug("Unregistered view '{0}'", viewType);
        }
开发者ID:pars87,项目名称:Catel,代码行数:28,代码来源:ViewManager.cs


注:本文中的IView.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。