コード例 #1
0
        /// <summary>
        /// Converts the given object to the reference type.
        /// </summary>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                string text = ((string)value).Trim();

                if (!string.Equals(text, s_none) && context != null)
                {
                    // Try the reference service first.
                    IReferenceService refSvc = (IReferenceService)context.GetService(typeof(IReferenceService));
                    if (refSvc != null)
                    {
                        object obj = refSvc.GetReference(text);
                        if (obj != null)
                        {
                            return(obj);
                        }
                    }

                    // Now try IContainer
                    IContainer cont = context.Container;
                    if (cont != null)
                    {
                        object obj = cont.Components[text];
                        if (obj != null)
                        {
                            return(obj);
                        }
                    }
                }
                return(null);
            }
            return(base.ConvertFrom(context, culture, value));
        }
コード例 #2
0
        /// <summary>Gets a collection of standard values for the reference data type.</summary>
        /// <returns>A <see cref="T:System.ComponentModel.TypeConverter.StandardValuesCollection" /> that holds a standard set of valid values, or null if the data type does not support a standard set of values.</returns>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context. </param>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList arrayList = new ArrayList();

            if (context != null)
            {
                IReferenceService referenceService = context.GetService(typeof(IReferenceService)) as IReferenceService;
                if (referenceService != null)
                {
                    object[] references = referenceService.GetReferences(reference_type);
                    foreach (object value in references)
                    {
                        if (IsValueAllowed(context, value))
                        {
                            arrayList.Add(value);
                        }
                    }
                }
                else if (context.Container != null && context.Container.Components != null)
                {
                    foreach (object component in context.Container.Components)
                    {
                        if (component != null && IsValueAllowed(context, component) && reference_type.IsInstanceOfType(component))
                        {
                            arrayList.Add(component);
                        }
                    }
                }
                arrayList.Add(null);
            }
            return(new StandardValuesCollection(arrayList));
        }
コード例 #3
0
        /// <summary>Converts the given value object to the reference type using the specified context and arguments.</summary>
        /// <returns>The converted object.</returns>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context. </param>
        /// <param name="culture">A <see cref="T:System.Globalization.CultureInfo" /> that specifies the culture used to represent the font. </param>
        /// <param name="value">The <see cref="T:System.Object" /> to convert. </param>
        /// <param name="destinationType">The type to convert the object to. </param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="destinationType" /> is null. </exception>
        /// <exception cref="T:System.NotSupportedException">The conversion cannot be performed. </exception>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType != typeof(string))
            {
                return(base.ConvertTo(context, culture, value, destinationType));
            }
            if (value == null)
            {
                return("(none)");
            }
            string text = string.Empty;

            if (context != null)
            {
                IReferenceService referenceService = context.GetService(typeof(IReferenceService)) as IReferenceService;
                if (referenceService != null)
                {
                    text = referenceService.GetName(value);
                }
                if ((text == null || text.Length == 0) && value is IComponent)
                {
                    IComponent component = (IComponent)value;
                    if (component.Site != null && component.Site.Name != null)
                    {
                        text = component.Site.Name;
                    }
                }
            }
            return(text);
        }
コード例 #4
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            string stringValue = value as string;

            if (stringValue != null)
            {
                try
                {
                    Debug.Assert(_actionList != null && _actionList.Actions != null);
                    if (string.IsNullOrEmpty(stringValue))
                    {
                        return(_actionList.Actions.Null);
                    }

                    IReferenceService rs = (IReferenceService)context.GetService(typeof(IReferenceService));
                    Debug.Assert(rs != null);
                    if (rs == null)
                    {
                        return(_actionList.Actions.Null);
                    }

                    return(rs.GetReference(stringValue));
                }
                catch
                {
                    throw new ArgumentException("Can not convert '" + stringValue + "' to type Object");
                }
            }
            return(base.ConvertFrom(context, culture, value));
        }
コード例 #5
0
 public AssociateController(
     IMembershipService membershipService,
     IMembershipService associateMembershipService,
     IAssociateService associateService,
     IDocumentService documentService,
     IReferenceService referenceService,
     IEmployeeService employeeService,
     IProspectService prospectService,
     IPrincipal user,
     IClientProjectSharedService clientProjectSharedService,
     IIndividualService individualService,
     IRoleService roleService,
     Admin.Services.IEmailService emailService)
     : base(membershipService, associateService, user)
 {
     this.associateService = associateService;
     this.documentService = documentService;
     this.referenceService = referenceService;
     this.employeeService = employeeService;
     this.prospectService = prospectService;
     this.associateMembershipService = associateMembershipService;
     this.clientProjectSharedService = clientProjectSharedService;
     this.individualService = individualService;
     this.roleService = roleService;
     this.emailService = emailService;
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReferencesController" /> class
 /// </summary>
 /// <param name="mapper"><see cref="IMapper"/></param>
 /// <param name="referenceService"><see cref="IReferenceService"/></param>
 public ReferencesController(
     IMapper mapper,
     IReferenceService referenceService)
 {
     this.mapper           = mapper;
     this.referenceService = referenceService;
 }
コード例 #7
0
 public void PopulateAvailableOptions(IReferenceService referenceService)
 {
     Occupations = referenceService.Get <RefOccupation>()
                   .Select(o => new SelectListItem {
         Text = o.Description, Value = o.Id.ToString()
     }).ToList();
 }
コード例 #8
0
 public AssessmentReferenceDataController(IOutputConverter outputConverter, IAssessmentScopeService scopeService, IAssessmentStatusService statusService, IAssessmentTypeService typeService, IReferenceService referenceService)
 {
     _scopeService     = scopeService;
     _statusService    = statusService;
     _typeService      = typeService;
     _referenceService = referenceService;
 }
コード例 #9
0
        public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
        {
            if (typeDescriptorContext == null)
            {
                throw new ArgumentNullException("typeDescriptorContext");
            }
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }
            object selectedName = o;

            this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
            if (this.editorService != null)
            {
                Activity          component = null;
                IReferenceService service   = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;
                if (service != null)
                {
                    component = service.GetComponent(typeDescriptorContext.Instance) as Activity;
                }
                string name = typeDescriptorContext.PropertyDescriptor.GetValue(typeDescriptorContext.Instance) as string;
                ConditionBrowserDialog dialog = new ConditionBrowserDialog(component, name);
                if (DialogResult.OK == this.editorService.ShowDialog(dialog))
                {
                    selectedName = dialog.SelectedName;
                }
            }
            return(selectedName);
        }
コード例 #10
0
        internal IFacadeUpdateResult <ReferenceData> SetPublish(object instanceId, bool status)
        {
            ArgumentValidator.IsNotNull("instanceId", instanceId);

            FacadeUpdateResult <ReferenceData> result = new FacadeUpdateResult <ReferenceData>();
            IReferenceService service = UnitOfWork.GetService <IReferenceService>();
            var query = service.Retrieve(instanceId);

            if (query.HasResult)
            {
                Reference instance = query.ToBo <Reference>();
                if (instance.IsPublished != status)
                {
                    instance.IsPublished = status;
                    var saveQuery = service.Save(instance);

                    result.AttachResult(instance.RetrieveData <ReferenceData>());
                    result.Merge(saveQuery);
                }
            }
            else
            {
                AddError(result.ValidationResult, "ReferenceCannotBeFound");
            }
            return(result);
        }
コード例 #11
0
        internal IFacadeUpdateResult <ReferenceData> SaveReferenceBasic(ReferenceData dto)
        {
            ArgumentValidator.IsNotNull("dto", dto);

            FacadeUpdateResult <ReferenceData> result = new FacadeUpdateResult <ReferenceData>();
            IReferenceService service  = UnitOfWork.GetService <IReferenceService>();
            Reference         instance = RetrieveOrNew <ReferenceData, Reference, IReferenceService>(result.ValidationResult, dto.Id);

            if (result.IsSuccessful)
            {
                instance.Slug         = dto.Slug;
                instance.Title        = dto.Title;
                instance.ThumbnailUrl = dto.ThumbnailUrl;
                instance.Description  = dto.Description;
                instance.Keywords     = dto.Keywords;
                instance.EnableAds    = dto.EnableAds;
                instance.EnableTopAd  = dto.EnableTopAd;
                instance.ModifiedDate = DateTime.Now;
                instance.LocationId   = dto.LocationId;

                var saveQuery = service.Save(instance);

                result.AttachResult(instance.RetrieveData <ReferenceData>());
                result.Merge(saveQuery);
            }

            return(result);
        }
コード例 #12
0
        internal IFacadeUpdateResult <ReferenceData> SaveReferenceKeywords(object referenceId, IList <ReferenceKeywordData> referenceKeywords)
        {
            ArgumentValidator.IsNotNull("referenceId", referenceId);
            ArgumentValidator.IsNotNull("referenceKeywords", referenceKeywords);

            FacadeUpdateResult <ReferenceData> result = new FacadeUpdateResult <ReferenceData>();
            IReferenceService service  = UnitOfWork.GetService <IReferenceService>();
            Reference         instance = RetrieveOrNew <ReferenceData, Reference, IReferenceService>(result.ValidationResult, referenceId);

            if (result.IsSuccessful)
            {
                instance.ModifiedDate = DateTime.Now;
                // Remove all existing ReferenceKeywords
                instance.ReferenceKeywords.Clear();
                // Keywords
                foreach (ReferenceKeywordData item in referenceKeywords)
                {
                    ReferenceKeyword child = instance.ReferenceKeywords.AddNewBo();
                    child.KeywordId = item.KeywordId;
                    child.Sort      = item.Sort;
                }

                var saveQuery = service.Save(instance);

                result.AttachResult(instance.RetrieveData <ReferenceData>());
                result.Merge(saveQuery);
            }

            return(result);
        }
コード例 #13
0
        internal IFacadeUpdateResult <ReferenceData> SaveReferenceLanguageBasic(ReferenceData dto, object languageId)
        {
            ArgumentValidator.IsNotNull("dto", dto);
            ArgumentValidator.IsNotNull("languageId", languageId);

            FacadeUpdateResult <ReferenceData> result = new FacadeUpdateResult <ReferenceData>();
            IReferenceService service  = UnitOfWork.GetService <IReferenceService>();
            Reference         instance = RetrieveOrNew <ReferenceData, Reference, IReferenceService>(result.ValidationResult, dto.Id);

            if (result.IsSuccessful)
            {
                instance.ModifiedDate = DateTime.Now;

                // Check existence of current language
                ReferenceLanguage referenceLanguage = instance.ReferenceLanguages.FirstOrDefault(o => object.Equals(o.LanguageId, languageId));
                if (referenceLanguage == null)
                {
                    referenceLanguage            = instance.ReferenceLanguages.AddNewBo();
                    referenceLanguage.LanguageId = languageId;
                }
                referenceLanguage.Title       = dto.Title;
                referenceLanguage.Description = dto.Description;
                referenceLanguage.Keywords    = dto.Keywords;

                var saveQuery = service.Save(instance);

                result.AttachResult(instance.RetrieveData <ReferenceData>());
                result.Merge(saveQuery);
            }

            return(result);
        }
コード例 #14
0
        protected virtual void ResetReferenceName()
        {
            IReferenceService svc = GetService(typeof(IReferenceService)) as IReferenceService;

            if (svc != null)
            {
                FieldInfo fi = svc.GetType().GetField("referenceList", BindingFlags.GetField | (BindingFlags.NonPublic | BindingFlags.Instance));
                if (fi != null)
                {
                    ArrayList values = fi.GetValue(svc) as ArrayList;
                    if (values != null)
                    {
                        foreach (object val in values)
                        {
                            PropertyInfo pi = val.GetType().GetProperty("SitedComponent", BindingFlags.GetProperty | (BindingFlags.Public | BindingFlags.Instance));
                            if (pi != null)
                            {
                                object obj = pi.GetValue(val, null);
                                if (obj == Editor)
                                {
                                    MethodInfo mi = val.GetType().GetMethod("ResetName", BindingFlags.InvokeMethod | (BindingFlags.NonPublic | BindingFlags.Instance));
                                    if (mi != null)
                                    {
                                        mi.Invoke(val, null);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #15
0
ファイル: ListViewWidget.cs プロジェクト: wuqiyou/betterslice
        public override void Populate(ReferenceInfoDto referenceInfo)
        {
            int  pageSize       = 0;
            bool showPagination = false;

            if (referenceInfo.ValuesDic.ContainsKey(BlockRegister.ListViewWidget.PageSize))
            {
                DucValueDto value = referenceInfo.ValuesDic[BlockRegister.ListViewWidget.PageSize];
                if (value.ValueInt.HasValue)
                {
                    pageSize = value.ValueInt.Value;
                }
                showPagination = pageSize > 0;
            }
            if (pageSize == 0)
            {
                pageSize = WebContext.Current.MaxPageSize;
            }

            int currentPage = PageIndex.HasValue && showPagination ? PageIndex.Value : 1;

            object            languageId = CurrentLanguage != null ? CurrentLanguage.Id : null;
            IReferenceService service    = ServiceLocator.Current.GetInstance <IReferenceService>();

            Items = service.GetAttachedSubjects(referenceInfo.ReferenceId,
                                                BlockRegister.ListViewWidget.ReferenceList,
                                                currentPage, pageSize, languageId);
            int totalCount = Items.Any() ? Items.First <SubjectInfoDto>().TotalCount : 0;

            PaginationViewModel           = new PaginationViewModel(totalCount, currentPage, pageSize, WebContext.Current.PagerWindowSize);
            PaginationViewModel.ShowTotal = false;
        }
コード例 #16
0
        public override object ConvertFrom(ITypeDescriptorContext context,
                                           CultureInfo culture,
                                           object value)
        {
            if (!(value is string))
            {
                return(base.ConvertFrom(context, culture, value));
            }


            if (context != null)
            {
                object reference = null;
                // try 1 - IReferenceService
                IReferenceService referenceService = context.GetService(typeof(IReferenceService)) as IReferenceService;
                if (referenceService != null)
                {
                    reference = referenceService.GetReference((string)value);
                }

                // try 2 - Component by name
                if (reference == null)
                {
                    if (context.Container != null && context.Container.Components != null)
                    {
                        reference = context.Container.Components[(string)value];
                    }
                }

                return(reference);
            }

            return(null);
        }
コード例 #17
0
 public static TypeConverter.StandardValuesCollection GetReferences(
     IServiceProvider context,
     Type type)
 {
     if (context != null)
     {
         ArrayList         arrayList = new ArrayList();
         IReferenceService service   = (IReferenceService)context.GetService(typeof(IReferenceService));
         if (service != null)
         {
             object[] references = service.GetReferences(type);
             int      length     = references.Length;
             for (int index = 0; index < length; ++index)
             {
                 IComponent component = references[index] as IComponent;
                 if (component != null && component.Site != null && component.Site.DesignMode)
                 {
                     arrayList.Add(references[index]);
                 }
             }
             return(new TypeConverter.StandardValuesCollection((ICollection)arrayList.ToArray()));
         }
     }
     return((TypeConverter.StandardValuesCollection)null);
 }
コード例 #18
0
 public ItSystemUsageService(
     IGenericRepository <ItSystemUsage> usageRepository,
     IAuthorizationContext authorizationContext,
     IItSystemRepository systemRepository,
     IItContractRepository contractRepository,
     IOptionsService <SystemRelation, RelationFrequencyType> frequencyService,
     IGenericRepository <SystemRelation> relationRepository,
     IGenericRepository <ItInterface> interfaceRepository,
     IReferenceService referenceService,
     ITransactionManager transactionManager,
     IDomainEvents domainEvents,
     ILogger logger,
     IGenericRepository <ItSystemUsageSensitiveDataLevel> sensitiveDataLevelRepository)
 {
     _usageRepository      = usageRepository;
     _authorizationContext = authorizationContext;
     _systemRepository     = systemRepository;
     _contractRepository   = contractRepository;
     _frequencyService     = frequencyService;
     _transactionManager   = transactionManager;
     _domainEvents         = domainEvents;
     _relationRepository   = relationRepository;
     _interfaceRepository  = interfaceRepository;
     _referenceService     = referenceService;
     _logger = logger;
     _sensitiveDataLevelRepository = sensitiveDataLevelRepository;
 }
コード例 #19
0
ファイル: PawningController.cs プロジェクト: marky3heat/iPOS
 public PawningController()
 {
     _pawningService   = new PawningService(new UnitOfWorkFactory());
     _appraisalService = new AppraisalService(new UnitOfWorkFactory());
     _customerService  = new CustomerService(new UnitOfWorkFactory());
     _referenceService = new ReferenceService(new UnitOfWorkFactory());
 }
コード例 #20
0
 private void OnComponentChanged(object source, ComponentChangedEventArgs ce)
 {
     if (this.cache != null)
     {
         if (ce.Component != null)
         {
             this.RemoveEntry(ce.Component);
             if (!(ce.Component is IComponent) && (this.serManager != null))
             {
                 IReferenceService service = this.serManager.GetService(typeof(IReferenceService)) as IReferenceService;
                 if (service != null)
                 {
                     IComponent component = service.GetComponent(ce.Component);
                     if (component != null)
                     {
                         this.RemoveEntry(component);
                     }
                     else
                     {
                         this.cache.Clear();
                     }
                 }
             }
         }
         else
         {
             this.cache.Clear();
         }
     }
 }
コード例 #21
0
        /// <summary>
        /// Converts the given value object to the specified type, using the specified context and culture information.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that provides a format context.</param>
        /// <param name="culture">A CultureInfo object. If a null reference (Nothing in Visual Basic) is passed, the current culture is assumed.</param>
        /// <param name="value">The Object to convert.</param>
        /// <param name="destinationType">The Type to convert the value parameter to.</param>
        /// <returns>An Object that represents the converted value.</returns>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (destinationType == typeof(string) && context != null)
            {
                IReferenceService rs = (IReferenceService)context.GetService(typeof(IReferenceService));
                //Debug.Assert(rs != null);
                Action a = (Action)value;
                if (a != null)
                {
                    // here's the hack for getting a reference to the associated collection
                    _actionList = a.Parent;

                    //Debug.Assert(_actionList != null && _actionList.Actions != null);
                    if (a == _actionList.Actions.Null)
                    {
                        return("");
                    }
                    return(rs.GetName(a));
                }
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
コード例 #22
0
        public override object ConvertFrom(
            ITypeDescriptorContext context,
            CultureInfo culture,
            object value)
        {
            if (!(value is string))
            {
                return(base.ConvertFrom(context, culture, value));
            }
            string index = ((string)value).Trim();

            if (!string.Equals(index, CommandBaseConverter.none) && context != null)
            {
                IReferenceService service = (IReferenceService)context.GetService(typeof(IReferenceService));
                if (service != null)
                {
                    object reference = service.GetReference(index);
                    if (reference != null)
                    {
                        return(reference);
                    }
                }
                IContainer container = context.Container;
                if (container != null)
                {
                    object component = (object)container.Components[index];
                    if (component != null)
                    {
                        return(component);
                    }
                }
            }
            return((object)null);
        }
コード例 #23
0
ファイル: MapperInfoConverter.cs プロジェクト: publicwmh/eas
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            MapperInfo info = (MapperInfo)context.Instance;

            //if (!info.DataUIMapper.DisplayMember)
            //{
            //    string[] sv = new string[] { string.Empty };
            //    return new StandardValuesCollection(sv);
            //}

            IDesignerHost     host = (IDesignerHost)context.GetService(typeof(IDesignerHost));
            IReferenceService svc  = (IReferenceService)host.GetService(typeof(IReferenceService));

            if (svc == null)
            {
                return(null);
            }

            object ctl = svc.GetReference(info.ControlID);

            if (ctl == null)
            {
                throw new ArgumentException("当前容器中未发现名称为 '" + info.ControlID + "' 的控件。");
            }
            else
            {
                return(new StandardValuesCollection(MemberHelper.GetControlProperties(ctl)));
            }
        }
コード例 #24
0
 public AssessmentController(IDiscoveryCache discoveryCache, ProdDbContext dbContext, IReferenceService referenceService, IHubContext <MessageHub> hubContext) : base(discoveryCache, dbContext)
     //public AssessmentController(IDiscoveryCache discoveryCache, ProdDbContext dbContext, IReferenceService referenceService) : base(discoveryCache, dbContext)
 {
     _dbContext        = dbContext;
     _referenceService = referenceService;
     _hubContext       = hubContext;
 }
コード例 #25
0
        public override object EditValue(ITypeDescriptorContext typeDescriptorContext, IServiceProvider serviceProvider, object o)
        {
            if (typeDescriptorContext == null)
            {
                throw new ArgumentNullException("typeDescriptorContext");
            }
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }
            object obj2 = o;

            this.editorService = (IWindowsFormsEditorService)serviceProvider.GetService(typeof(IWindowsFormsEditorService));
            if (this.editorService != null)
            {
                Activity          component = null;
                IReferenceService service   = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;
                if (service != null)
                {
                    component = service.GetComponent(typeDescriptorContext.Instance) as Activity;
                }
                string           name      = null;
                RuleSetReference reference = typeDescriptorContext.PropertyDescriptor.GetValue(typeDescriptorContext.Instance) as RuleSetReference;
                if (reference != null)
                {
                    name = reference.RuleSetName;
                }
                RuleSetBrowserDialog dialog = new RuleSetBrowserDialog(component, name);
                if (DialogResult.OK == this.editorService.ShowDialog(dialog))
                {
                    obj2 = typeDescriptorContext.PropertyDescriptor.Converter.ConvertFrom(typeDescriptorContext, CultureInfo.CurrentUICulture, dialog.SelectedName);
                }
            }
            return(obj2);
        }
コード例 #26
0
        internal string GetName(object obj, bool generateNew)
        {
            string name = null;

            if (obj != null)
            {
                IReferenceService service = this.GetService(typeof(IReferenceService)) as IReferenceService;
                if (service != null)
                {
                    name = service.GetName(obj);
                }
                else
                {
                    IComponent component = obj as IComponent;
                    if (component != null)
                    {
                        ISite site = component.Site;
                        if (site != null)
                        {
                            name = site.Name;
                        }
                    }
                }
            }
            if ((name != null) || !generateNew)
            {
                return(name);
            }
            if (obj == null)
            {
                return("(null)");
            }
            return(obj.GetType().Name);
        }
コード例 #27
0
        internal static ISite GetSite(IServiceProvider serviceProvider, object component)
        {
            ISite site = null;

            if (component != null)
            {
                if ((component is IComponent) && (((IComponent)component).Site != null))
                {
                    site = ((IComponent)component).Site;
                }
                if (((site == null) && component.GetType().IsArray) && (((component as object[]).Length > 0) && ((component as object[])[0] is IComponent)))
                {
                    site = ((IComponent)(component as object[])[0]).Site;
                }
                if ((site == null) && (serviceProvider != null))
                {
                    IReferenceService service = serviceProvider.GetService(typeof(IReferenceService)) as IReferenceService;
                    if (service != null)
                    {
                        IComponent component2 = service.GetComponent(component);
                        if (component2 != null)
                        {
                            site = component2.Site;
                        }
                    }
                }
            }
            if (site == null)
            {
                site = serviceProvider as ISite;
            }
            return(site);
        }
コード例 #28
0
 public DataErrorsController(IUserService usrSvc, IEmployeeService empSvc, IDataErrorService deSvc, IReferenceService refSvc)
 {
     _userService      = usrSvc;
     _employeeService  = empSvc;
     _dataErrorService = deSvc;
     _referenceService = refSvc;
 }
コード例 #29
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (!(value is string))
            {
                return(base.ConvertFrom(context, culture, value));
            }
            string a = ((string)value).Trim();

            if (!string.Equals(a, none) && (context != null))
            {
                IReferenceService service = (IReferenceService)context.GetService(typeof(IReferenceService));
                if (service != null)
                {
                    object reference = service.GetReference(a);
                    if (reference != null)
                    {
                        return(reference);
                    }
                }
                IContainer container = context.Container;
                if (container != null)
                {
                    object obj3 = container.Components[a];
                    if (obj3 != null)
                    {
                        return(obj3);
                    }
                }
            }
            return(null);
        }
コード例 #30
0
 public ReferenceController(IReferenceService referenceService,
                            IHttpContextAccessor httpContextAccessor,
                            IUserService userService) : base(httpContextAccessor, userService)
 {
     _referenceService = referenceService;
     _userService      = userService;
 }
コード例 #31
0
        protected RuleDefinitions GetRuleDefinitions(object component)
        {
            IReferenceService service = (IReferenceService)base.ServiceProvider.GetService(typeof(IReferenceService));

            if (service == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Messages.MissingService, new object[] { typeof(IReferenceService).FullName }));
            }
            Activity activity = service.GetComponent(component) as Activity;

            if (activity == null)
            {
                return(null);
            }
            Activity rootActivity = Helpers.GetRootActivity(activity);

            if (rootActivity == null)
            {
                return(null);
            }
            Activity declaringActivity = Helpers.GetDeclaringActivity(activity);

            if ((declaringActivity != rootActivity) && (declaringActivity != null))
            {
                return(ConditionHelper.GetRuleDefinitionsFromManifest(declaringActivity.GetType()));
            }
            return(ConditionHelper.Load_Rules_DT(base.ServiceProvider, rootActivity));
        }
コード例 #32
0
 public void Dispose()
 {
     IDisposable d;
     if (this.designerLoader != null)
     {
         try
         {
             this.designerLoader.Flush();
         }
         catch (Exception e1)
         {
             Debug.Fail("Designer loader '" + this.designerLoader.GetType().Name + "' threw during Flush: " + e1.ToString());
             e1 = null;
         }
         try
         {
             this.designerLoader.Dispose();
         }
         catch (Exception e2)
         {
             Debug.Fail("Designer loader '" + this.designerLoader.GetType().Name + "' threw during Dispose: " + e2.ToString());
             e2 = null;
         }
         this.designerLoader = null;
     }
     this.UnloadDocument();
     this.serviceContainer = null;
     if (this.menuEditorService != null)
     {
         d = this.menuEditorService as IDisposable;
         if (d != null)
         {
             d.Dispose();
         }
         this.menuEditorService = null;
     }
     if (this.selectionService != null)
     {
         d = this.selectionService as IDisposable;
         if (d != null)
         {
             d.Dispose();
         }
         this.selectionService = null;
     }
     if (this.menuCommandService != null)
     {
         d = this.menuCommandService as IDisposable;
         if (d != null)
         {
             d.Dispose();
         }
         this.menuCommandService = null;
     }
     if (this.toolboxService != null)
     {
         d = this.toolboxService as IDisposable;
         if (d != null)
         {
             d.Dispose();
         }
         this.toolboxService = null;
     }
     if (this.helpService != null)
     {
         d = this.helpService as IDisposable;
         if (d != null)
         {
             d.Dispose();
         }
         this.helpService = null;
     }
     if (this.referenceService != null)
     {
         d = this.referenceService as IDisposable;
         if (d != null)
         {
             d.Dispose();
         }
         this.referenceService = null;
     }
     if (this.documentWindow != null)
     {
         this.documentWindow.Dispose();
         this.documentWindow = null;
     }
 }
コード例 #33
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="referenceService"></param>
 /// <param name="todoService"></param>
 public TodoController(IReferenceService referenceService, ITodoService todoService)
     : base(referenceService)
 {
     _todoService = todoService;
 }
コード例 #34
0
 public ActivityCodeDomReferenceService(IReferenceService referenceService)
 {
     this.refService = referenceService;
 }
コード例 #35
0
			public TestTypeDescriptorContext (IReferenceService referenceService)
			{
				reference_service = referenceService;
			}
コード例 #36
0
        //****
        //****
        //**** IDisposable Implementation
        //****
        //****

        ///     Disposes of the DesignContainer.  This cleans up any objects we may be holding
        ///     and removes any services that we created.
        public void Dispose() {
        
            // Dispose the loader before destroying the designer.  Otherwise, the
            // act of destroying all the components on the designer surface will
            // be reflected in the loader, deleting the user's file.
            if (designerLoader != null) {
                try 
                {
                    designerLoader.Flush();
                }
                catch (Exception e1) 
                {
                    Debug.Fail("Designer loader '" + designerLoader.GetType().Name + "' threw during Flush: " + e1.ToString());
                    e1 = null;
                }

                try {
                    designerLoader.Dispose();
                }
                catch (Exception e2) {
                    Debug.Fail("Designer loader '" + designerLoader.GetType().Name + "' threw during Dispose: " + e2.ToString());
                    e2 = null;
                }
                designerLoader = null;
            }

            // Unload the document.
            UnloadDocument();

            // No services after this!
            serviceContainer = null;

            // Now tear down all of our services.
            if (menuEditorService != null) {
                IDisposable d = menuEditorService as IDisposable;
                if (d != null) d.Dispose();
                menuEditorService = null ;
            }

            if (selectionService != null) {
                IDisposable d = selectionService as IDisposable;
                if (d != null) d.Dispose();
                selectionService = null;
            }

            if (menuCommandService != null) {
                IDisposable d = menuCommandService as IDisposable;
                if (d != null) d.Dispose();
                menuCommandService = null;
            }

			if (toolboxService != null) 
			{
				IDisposable d = toolboxService as IDisposable;
				if (d != null) d.Dispose();
				toolboxService = null;
			}

            if (helpService != null) {
                IDisposable d = helpService as IDisposable;
                if (d != null) d.Dispose();
                helpService = null;
            }

            if (referenceService != null) {
                IDisposable d = referenceService as IDisposable;
                if (d != null) d.Dispose();
                referenceService = null;
            }

            // Destroy our document window.
            if (documentWindow != null) {
                documentWindow.Dispose();
                documentWindow = null;
            }
        }
コード例 #37
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="referenceService"></param>
 public BaseController(IReferenceService referenceService)
 {
     _referenceService = referenceService;
 }