public CustomerPresenter(IView view, IBankAccount bankaccount) { View = view; Account = bankaccount; AccountConcrete = bankaccount as BankAccount; IsViewInjected = true; }
/// <summary> /// 向UI窗口里插入一个可智能查询的View /// </summary> /// <param name="dockableManager"></param> /// <param name="plugin"></param> /// <param name="model"></param> /// <param name="bindingAction"></param> public static object AddCusomView(IDockableManager dockableManager, string pluginName, IView model) { if (dockableManager == null || model == null) return null; object view1 = model.UserControl; FrmState frm; frm = model.FrmState; XFrmWorkAttribute first = PluginProvider.GetFirstPlugin(typeof(ICustomView), pluginName); if (first != null) { var view2 = PluginProvider.GetObjectInstance(first.MyType) as ICustomView; if (view2 != null) { view1 = view2; frm = view2.FrmState; } } if (view1 == null) return null; XFrmWorkAttribute attr = PluginProvider.GetPluginAttribute(model.GetType()); dockableManager.AddDockAbleContent( frm, view1, new[] { pluginName, attr.LogoURL, attr.Description }); dockableManager.ViewDictionary.Last().Model = model; return view1; }
public void ReleaseView(ControllerContext controllerContext, IView view) { IDisposable disposable = view as IDisposable; if (disposable == null) return; disposable.Dispose(); }
public PlayGame(Game game, IView view) { a_game = game; a_view = view; a_game.AddSubscribers(this); }
// tunnelX, tunnelZ is the coordinate of tunnel crown // h is the height of tunnel // public static List<Result> StrataOnTunnel(double tunnelX, double tunnelZ, double h, IView profileView, string stLayerID, Setting setting) { IGraphicsLayer gLayerSt = profileView.getLayer(stLayerID); if (gLayerSt == null) return null; List<Result> results = new List<Result>(); Project prj = Globals.project; Domain geology = prj.getDomain(DomainType.Geology); DGObjectsCollection stratum = geology.getObjects("Stratum"); var stratumList = stratum.merge(); foreach (DGObject obj in stratumList) { Stratum strata = obj as Stratum; IGraphicCollection gc = gLayerSt.getGraphics(strata); if (gc == null) continue; Result result = StratumOnTunnel(tunnelX, tunnelZ, h, gc, profileView.spatialReference); if (result != null) { result.StratumObj = gLayerSt.getObject(gc[0]); if (result.Depth > 0 || setting.AllStrata) results.Add(result); } } return results; }
public bool CanAccept(ILayout layout, IView view) { IEnumerable<string> acceptableViewNames = (IEnumerable<string>)acceptableViewNamesPerLayout[layout.Name]; if (acceptableViewNames == null) return layout.Name == view.Name; return acceptableViewNames.Contains(view.Name); }
public UpdateContentItemAction(IView view, IController con, ContentItem item, PropertyDescriptor property, object previousValue) { _view = view; _con = con; _state = ContentItemState.Get(item); var name = property.Name; var value = previousValue; if (name == "Importer") { name = "ImporterName"; value = ((ImporterTypeDescription)value).TypeName; } if (name == "Processor") { name = "ProcessorName"; value = ((ProcessorTypeDescription)value).TypeName; } var field = _state.GetType().GetMember(name).SingleOrDefault() as FieldInfo; if (field == null) { if (!_state.ProcessorParams.ContainsKey(name)) throw new Exception(); _state.ProcessorParams[name] = value; } else { field.SetValue(_state, value); } }
/// <summary> /// Creates a new instance of the specific presenter type, for the specified /// view type and instance. /// </summary> /// <param name="presenterType">The type of presenter to create.</param> /// <param name="viewType">The type of the view as defined by the binding that matched.</param> /// <param name="viewInstance">The view instance to bind this presenter to.</param> /// <returns>An instantitated presenter.</returns> public IPresenter Create(Type presenterType, Type viewType, IView viewInstance) { if (presenterType == null) throw new ArgumentNullException("presenterType"); if (viewType == null) throw new ArgumentNullException("viewType"); if (viewInstance == null) throw new ArgumentNullException("viewInstance"); var buildMethod = GetBuildMethod(presenterType, viewType); try { return (IPresenter)buildMethod.Invoke(null, new[] { viewInstance }); } catch (Exception ex) { var originalException = ex; if (ex is TargetInvocationException && ex.InnerException != null) originalException = ex.InnerException; throw new InvalidOperationException ( string.Format( CultureInfo.InvariantCulture, "An exception was thrown whilst trying to create an instance of {0}. Check the InnerException for more information.", presenterType.FullName), originalException ); } }
public WinFormsMvp.IPresenter Create(Type presenterType, Type viewType, IView viewInstance) { using (var scope = ObjectHost.Host.BeginLifetimeScope()) { return scope.Resolve(presenterType, new NamedParameter("view", viewInstance)) as IPresenter; } }
protected string GetViewKey(IView view) { foreach (var pair in _views) if (pair.Value == view) return pair.Key; return null; }
public Presenter(IView view,ILogger log) { _view = view; _log = log; this._view.Loaded += OnLoaded; this._view.ErrorOccured += OnError; }
public Presenter(IStabilityModel model, IView view) { _model = model; _view = view; _view.ViewUpdated += ViewOnViewUpdated; _view.DeviceCmdEvent += ViewOnDeviceCmdEvent; }
public ViewModel(IView view) { _view = view; StartCmd = new RelayCommand(Start, () => _subscription == null); StopCmd = new RelayCommand(Stop, () => _subscription != null); }
public IPresenter Create(Type presenterType, Type viewType, IView viewInstance) { if (presenterType == null) throw new ArgumentNullException("presenterType"); if (viewType == null) throw new ArgumentNullException("viewType"); if (viewInstance == null) throw new ArgumentNullException("viewInstance"); if (!container.Model.HasImplementationsFor(presenterType)) { lock (registerLock) { if (!container.Model.HasImplementationsFor(presenterType)) { container.Configure(x => x.For(presenterType).HybridHttpOrThreadLocalScoped().Use(presenterType).Named(presenterType.Name)); } } } var args = new ExplicitArguments(); args.Set("view"); args.SetArg("view", viewInstance); return (IPresenter)container.GetInstance(presenterType, args); }
/// <summary> /// Creates the specified Presenter type. Called by the Web Forms MVP Framework. /// </summary> /// <param name="presenterType">Type of the presenter. Must be of type EPiPresenter<TView, TPageDataType> and the type arguments must be of the same type as the View and View Page Data Type, respectively.</param> /// <param name="viewType">Type of the view. Must be a subclass of EPiView.</param> /// <param name="viewInstance">The view instance. Must be a child of EPiView.</param> /// <returns></returns> public IPresenter Create(Type presenterType, Type viewType, IView viewInstance) { // Validate the View if (!typeof(IEPiView).IsAssignableFrom(viewType)) throw new InvalidCastException("This kernel can (and should) only create a presenter if the View implements IEPiView. Got " + viewType); var epiView = viewInstance as IEPiView; // Unchecked cast is ok sicne we check it above. if (epiView.CurrentPage == null) throw new NullReferenceException("CurrentPage property of the viewInstance was null. The presenter needs a proper page data to render. "); Type pageDataType = GetPageDataType(epiView); Type genericPresenterViewType = GetGenericPresenterViewType(viewType); // Validate and check the Presenter type. var pageDataPresenterType = typeof(EPiPageDataPresenter<,>).MakeGenericType(new Type[] { genericPresenterViewType, pageDataType }); if (presenterType.IsSubclassOf(pageDataPresenterType)) { // Check if the Presenter has a usable constructor. if (!CanCreatePageDataPresenterInstance(viewType, pageDataType, presenterType)) throw new NullReferenceException("Did not find a suitable constructor on the presenter of type " + presenterType + ". " + "The presenter constructor requires two parameters, the FIRST one accepting a " + viewType + " and a the SECOND one a " + pageDataType + "."); return (IPresenter) CreatePageDataPresenterInstance(presenterType, (TypedPageData) epiView.CurrentPage, viewType, epiView); } return (IPresenter)CreatePresenterInstance(presenterType, viewType, epiView); }
private static ViewComponentContext GetViewComponentContext(IView view, Stream stream) { var actionContext = new ActionContext(GetHttpContext(), new RouteData(), new ActionDescriptor()); var viewData = new ViewDataDictionary(new EmptyModelMetadataProvider()); var viewContext = new ViewContext( actionContext, view, viewData, Mock.Of<ITempDataDictionary>(), TextWriter.Null, new HtmlHelperOptions()); var writer = new StreamWriter(stream) { AutoFlush = true }; var viewComponentDescriptor = new ViewComponentDescriptor() { Type = typeof(object), }; var viewComponentContext = new ViewComponentContext( viewComponentDescriptor, new Dictionary<string, object>(), new HtmlTestEncoder(), viewContext, writer); return viewComponentContext; }
public BackupForm(IBackupPresenter presenter, IView mainview) : base(mainview) { InitializeComponent(); this.presenter = presenter; }
/*============================================================================*/ /* Private Functions */ /*============================================================================*/ private void HandleRemoveView (IView view) { if (_viewRemoved != null) { _viewRemoved(view); } }
public BoxEntry(IView view) { if (view == null) throw new ArgumentNullException("view"); this.view = view; dataAccess = new SqlDataAccess(ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString); }
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; }
public Presenter(IModel model, IView view) { this.model = model; this.view = view; RegisterEventListeners(); }
public ViewContext(ControllerContext controllerContext, IView view, ViewDataDictionary viewData, TempDataDictionary tempData) : base(controllerContext) { if (controllerContext == null) { throw new ArgumentNullException("controllerContext"); } if (view == null) { throw new ArgumentNullException("view"); } if (viewData == null) { throw new ArgumentNullException("viewData"); } if (tempData == null) { throw new ArgumentNullException("tempData"); } View = view; ViewData = viewData; TempData = tempData; // propagate FormContext, e.g. inside a template ViewContext originalViewContext = controllerContext as ViewContext; if (originalViewContext != null) { FormContext = originalViewContext.FormContext; } }
public UpdateProjectAction(IView view, IController con, PipelineProject item, PropertyDescriptor property, object previousValue) { _view = view; _con = con; _state = ProjectState.Get(item); switch (property.Name) { case "OutputDir": _state.OutputDir = (string)previousValue; break; case "IntermediateDir": _state.IntermediateDir = (string)previousValue; break; case "References": _state.References = new List<string>((List<string>)previousValue); _referencesChanged = true; break; case "Platform": _state.Platform = (TargetPlatform)previousValue; break; case "Profile": _state.Profile = (GraphicsProfile)previousValue; break; case "Config": _state.Config = (string)previousValue; break; case "OriginalPath": _state.OriginalPath = (string)previousValue; break; } }
public void AttributeBasedPresenterDiscoveryStrategy_GetBindings_MultipleViewsWithNoAttributes() { // Arrange var strategy = new AttributeBasedPresenterDiscoveryStrategy(); var hosts = new object[0]; var view1 = new View1(); var view2 = new View2(); var views = new IView[] { view1, view2 }; // Act var results = strategy.GetBindings(hosts, views).ToArray(); // Assert CollectionAssert.AreEqual(new[] { new PresenterDiscoveryResult ( new[] {view1}, @"AttributeBasedPresenterDiscoveryStrategy: - could not find a [PresenterBinding] attribute on view instance WebFormsMvp.UnitTests.Binder.AttributeBasedPresenterDiscoveryStrategyTests.GetBindings_MultipleViewsWithNoAttributes+View1", new PresenterBinding[0] ), new PresenterDiscoveryResult ( new[] {view2}, @"AttributeBasedPresenterDiscoveryStrategy: - could not find a [PresenterBinding] attribute on view instance WebFormsMvp.UnitTests.Binder.AttributeBasedPresenterDiscoveryStrategyTests.GetBindings_MultipleViewsWithNoAttributes+View2", new PresenterBinding[0] ) }, results ); }
public ResolvedUrls(IView view) { if(view == null) throw new ArgumentNullException("view"); this._view = view; }
public CommandServicePresenter(IView view, IService service, ICommandExecutor executor) { _view = view; _service = service; _executor = executor; }
public ViewModel(IView view) { model = new Model(); this.view = view; view.btnPressed += btnPressed; view.onBtnPressed += onBtnPressed; }
/// <summary> /// 注册消息 /// </summary> /// <param name="view"></param> /// <param name="messages"></param> protected void RegisterMessage(IView view, List<string> messages) { if (messages == null || messages.Count == 0) return; Controller.Instance.RegisterViewCommand(view, messages.ToArray()); }
protected override IView[] GetViews(IView view) { MonoBehaviour mono = view as MonoBehaviour; Component[] components = mono.GetComponentsInChildren (typeof(IView), true); IView[] views = components.Cast<IView>().ToArray(); return views; }
/// <summary>Constructor.</summary> /// <param name="divHost">The control host DIV.</param> /// <param name="control">The logical IView control (null if not available).</param> /// <param name="htmlElement">The control content (supplied by the test class. This is the control that is under test).</param> /// <param name="displayMode">The sizing strategy to use for the control.</param> /// <param name="allViews">The Collection of all controls.</param> public ControlWrapperView( jQueryObject divHost, IView control, jQueryObject htmlElement, ControlDisplayMode displayMode, IEnumerable allViews) : base(divHost) { // Setup initial conditions. this.control = control; this.htmlElement = htmlElement; this.displayMode = displayMode; this.allViews = allViews; index = divHost.Children().Length; // Store the order position of the control in the host. events = Common.Events; // Create the wrapper DIV. divRoot = Html.CreateDiv(); divRoot.CSS(Css.Position, Css.Absolute); divRoot.AppendTo(divHost); // Insert the content. htmlElement.CSS(Css.Position, Css.Absolute); htmlElement.AppendTo(divRoot); // Wire up events. events.ControlHostSizeChanged += OnHostResized; // Finish up. UpdateLayout(); }
protected override IPresenter Create(IView view) { return(new AssessmentFactorPresenter(view)); }
public TicTacToePresenter(IView <TicTacToeBoard> view) : base(view) { }
public Controller(IView theView, Model theModel) { myView = theView; myModel = theModel; myDeck = myModel.AssignDeck(); }
IVisualElementRenderer CreateRenderer(IView view) { return(Internals.Registrar.Registered.GetHandlerForObject <IVisualElementRenderer>(view) ?? new DefaultRenderer()); }
private void RenderCurrentView() { this.CurrentView = this.CurrentController.GetView(this.Username); this.currentOptionIndex = DEFAULT_INDEX; this.forumViewer.RenderView(this.CurrentView); }
private void RaiseUnloaded(IView view) { // Yes, invoke events right after each other InvokeViewLoadEvent(view, ViewLoadStateEvent.Unloading); InvokeViewLoadEvent(view, ViewLoadStateEvent.Unloaded); }
protected override IPresenter Create(IView view, IPresentationEntity presentationEntity) { return(new AssessmentFactorPresenter(view, presentationEntity)); }
/// <summary> /// Initializes a new instance of the <see cref="ViewStack" /> class. /// </summary> /// <param name="view">The view.</param> /// <param name="isViewLoaded">if set to <c>true</c>, the view is loaded.</param> public ViewStack(IView view, bool isViewLoaded) : this(view, isViewLoaded, null) { }
internal void RegisterView(IView view) { measureToViewMap.RegisterView(view, clock); }
/// <summary> /// Initializes a new instance of the <see cref="WeakViewInfo"/> class. /// </summary> /// <param name="view">The view.</param> /// <param name="isViewLoaded">if set to <c>true</c>, the view is already loaded.</param> /// <exception cref="ArgumentNullException">The <paramref name="view"/> is <c>null</c>.</exception> public WeakViewInfo(IView view, bool isViewLoaded = false) { Argument.IsNotNull("view", view); Initialize(view, isViewLoaded); }
protected override void PresentOnMainThread <TInput, TOutput>(ViewModel <TInput, TOutput> viewModel, IView sourceView) { UIViewController viewController = ViewControllerLocator.GetViewController(viewModel); viewController.ModalPresentationStyle = UIModalPresentationStyle.Custom; viewController.TransitioningDelegate = fromBottomTransitionDelegate; UIViewController topmostViewController = FindPresentedViewController(); topmostViewController.PresentViewController(viewController, true, null); }
//命令执行,带有业务相关的Clear逻辑 public void Execute(object parameter) { IView view = parameter as IView; view?.Clear(); }
public override void AddSubItemView(ISubPresenterItem subPresenterItem, IView viewToAdd) { UpdateEditControl(viewToAdd); }
public override void RegisterView(IView view) { this.statsManager.RegisterView(view); }
public void UpdateChartControl(IView view) { splitter.Panel2.FillWith(view); }
public SelectProjectViewModel(IView view) : base(view) { this.projects = new CollectionView(ProjectService.GetAllProjects()); this.selectCommand = new DelegateCommand(this.SelectCommandHandler); }
protected override bool HasMediator(IView view, Type mediatorType) { MonoBehaviour mono = view as MonoBehaviour; return(mono.GetComponent(mediatorType) != null); }
public void UpdateEditControl(IView view) { splitter.Panel1.FillWith(view); }
protected override void OnSetView(IView view) { mainWindow = (IMainWindow)view; }
/// Create a new Mediator object based on the mediatorType on the provided view protected override object CreateMediator(IView view, Type mediatorType) { MonoBehaviour mono = view as MonoBehaviour; return(mono.gameObject.AddComponent(mediatorType)); }
public MqttPropertyGrid(XmlNode dataModel, IView view) { _node = dataModel; this.view = view; type = "MQTT"; }
public EmailListViewModel(IView view, List <EmailItem> emailList, int dealerID) { _view = view; Init(emailList, dealerID); view.SetDataContext(this); }
public HttpPutPropertyGrid(XmlNode dataModel, IView view) { _node = dataModel; this.view = view; }
public MainWindowViewModel(IView view) : base(null) { SetView(view); ChemicalAnalysis.CreateParamtersDictionary(); Initialize(); }
public static void UpdateAutomationId(this FrameworkElement platformView, IView view) => AutomationProperties.SetAutomationId(platformView, view.AutomationId);
public LoadInjectorGridBase GetConfigGrid(XmlNode dataModel, IView view) { return(new MqttPropertyGrid(dataModel, view)); }
public static void UpdateOpacity(this FrameworkElement platformView, IView view) { platformView.Opacity = view.Visibility == Visibility.Hidden ? 0 : view.Opacity; }
public static void UpdateIsEnabled(this FrameworkElement platformView, IView view) => (platformView as Control)?.UpdateIsEnabled(view.IsEnabled);
/// <summary>在线用户连接监测 从视图(多表)内获取本表</summary> public static A8OnlineUserConstr FromIView(IView view) { return((A8OnlineUserConstr)IView.GetITable(view, "A8OnlineUserConstr")); }
public static void UpdateBackground(this FrameworkElement platformView, IView view) { platformView?.UpdatePlatformViewBackground(view); }