public ActivityBindForm(IServiceProvider serviceProvider, ITypeDescriptorContext context)
 {
     this.context = context;
     this.serviceProvider = serviceProvider;
     this.InitializeComponent();
     this.createProperty.Checked = true;
     this.helpTextBox.Multiline = true;
     IUIService service = (IUIService) this.serviceProvider.GetService(typeof(IUIService));
     if (service != null)
     {
         this.Font = (Font) service.Styles["DialogFont"];
     }
     ComponentResourceManager manager = new ComponentResourceManager(typeof(ActivityBindForm));
     this.ActivityBindDialogTitleFormat = manager.GetString("ActivityBindDialogTitleFormat");
     this.PropertyAssignableFormat = manager.GetString("PropertyAssignableFormat");
     this.DescriptionFormat = manager.GetString("DescriptionFormat");
     this.EditIndex = manager.GetString("EditIndex");
     this.PleaseSelectCorrectActivityProperty = manager.GetString("PleaseSelectCorrectActivityProperty");
     this.PleaseSelectActivityProperty = manager.GetString("PleaseSelectActivityProperty");
     this.IncorrectIndexChange = manager.GetString("IncorrectIndexChange");
     this.CreateNewMemberHelpFormat = manager.GetString("CreateNewMemberHelpFormat");
     this.memberTypes = new ImageList();
     this.memberTypes.ImageStream = (ImageListStreamer) manager.GetObject("memberTypes.ImageStream");
     this.memberTypes.TransparentColor = AmbientTheme.TransparentColor;
     this.properties = CustomActivityDesignerHelper.GetCustomProperties(context);
 }
Пример #2
0
 public AccessDatabaseLoginForm(IServiceProvider serviceProvider)
     : base(serviceProvider)
 {
     this.InitializeComponent();
     base.Icon = null;
     base.TaskGlyph = new Bitmap(typeof(AccessDatabaseLoginForm), "AccessProjectGlyph.bmp");
 }
		public DesignerSerializationService(IServiceProvider serviceProvider)
		{
			if (serviceProvider == null) {
				throw new ArgumentNullException("serviceProvider");
			}
			this.serviceProvider = serviceProvider;
		}
 public RenameRuleObjectDialog(IServiceProvider serviceProvider, string oldName, NameValidatorDelegate nameValidator, BasicBrowserDialog parent)
 {
     if (oldName == null)
     {
         throw new ArgumentNullException("oldName");
     }
     if (serviceProvider == null)
     {
         throw new ArgumentNullException("serviceProvider");
     }
     if (nameValidator == null)
     {
         throw new ArgumentNullException("nameValidator");
     }
     this.serviceProvider = serviceProvider;
     this.name = oldName;
     this.nameValidator = nameValidator;
     this.parent = parent;
     this.InitializeComponent();
     this.ruleNameTextBox.Text = oldName;
     this.Text = parent.RenameTitleText;
     this.newNamelabel.Text = parent.NewNameLabelText;
     base.Icon = null;
     IUIService service = (IUIService) this.serviceProvider.GetService(typeof(IUIService));
     if (service != null)
     {
         this.Font = (Font) service.Styles["DialogFont"];
     }
 }
Пример #5
0
        public static ServiceProvider CreateTestServices(
            IServiceProvider applicationServices,
            Project project,
            ReportingChannel channel)
        {
            var services = new ServiceProvider(applicationServices);

            var loggerFactory = new LoggerFactory();
            loggerFactory.AddProvider(new TestHostLoggerProvider(channel));
            services.Add(typeof(ILoggerFactory), loggerFactory);

            var libraryExporter = applicationServices.GetRequiredService<ILibraryExporter>();
            var export = libraryExporter.GetExport(project.Name);

            var projectReference = export.MetadataReferences
                .OfType<IMetadataProjectReference>()
                .Where(r => r.Name == project.Name)
                .FirstOrDefault();

            services.Add(
                typeof(ISourceInformationProvider),
                new SourceInformationProvider(projectReference, loggerFactory.CreateLogger<SourceInformationProvider>()));

            services.Add(typeof(ITestDiscoverySink), new TestDiscoverySink(channel));
            services.Add(typeof(ITestExecutionSink), new TestExecutionSink(channel));

            return services;
        }
Пример #6
0
        /// <summary>
        /// Edits the specified object's value using the editor style indicated by the
        /// <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> method.
        /// </summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that can be
        /// used to gain additional context information.</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"/> that this editor can use to
        /// obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// <returns>
        /// The new value of the object. If the value of the object has not changed, this should return the
        /// same object it was passed.
        /// </returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            var svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (svc != null)
            {
                using (var editorForm = new BodyInfoUITypeEditorForm(value))
                {
                    var pt = context.PropertyDescriptor.PropertyType;
                    if (svc.ShowDialog(editorForm) == DialogResult.OK)
                    {
                        if (pt == typeof(BodyID) || pt == typeof(BodyID?))
                            value = editorForm.SelectedItem.ID;
                        else if (pt == typeof(BodyInfo))
                            value = editorForm.SelectedItem;
                        else
                        {
                            const string errmsg =
                                "Don't know how to handle the source property type `{0}`. In value: {1}. Editor type: {2}";
                            if (log.IsErrorEnabled)
                                log.ErrorFormat(errmsg, pt, value, editorForm.GetType());
                            Debug.Fail(string.Format(errmsg, pt, value, editorForm.GetType()));
                        }
                    }
                    else
                    {
                        if (pt == typeof(BodyID?))
                            value = null;
                    }
                }
            }

            return value;
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     IntPtr focus = UnsafeNativeMethods.GetFocus();
     try
     {
         ICom2PropertyPageDisplayService service = (ICom2PropertyPageDisplayService) provider.GetService(typeof(ICom2PropertyPageDisplayService));
         if (service == null)
         {
             service = this;
         }
         object instance = context.Instance;
         if (!instance.GetType().IsArray)
         {
             instance = this.propDesc.TargetObject;
             if (instance is ICustomTypeDescriptor)
             {
                 instance = ((ICustomTypeDescriptor) instance).GetPropertyOwner(this.propDesc);
             }
         }
         service.ShowPropertyPage(this.propDesc.Name, instance, this.propDesc.DISPID, this.guid, focus);
     }
     catch (Exception exception)
     {
         if (provider != null)
         {
             IUIService service2 = (IUIService) provider.GetService(typeof(IUIService));
             if (service2 != null)
             {
                 service2.ShowError(exception, System.Windows.Forms.SR.GetString("ErrorTypeConverterFailed"));
             }
         }
     }
     return value;
 }
Пример #8
0
        public CSharpProjectShim(
            ICSharpProjectRoot projectRoot,
            VisualStudioProjectTracker projectTracker,
            Func<ProjectId, IVsReportExternalErrors> reportExternalErrorCreatorOpt,
            string projectSystemName,
            IVsHierarchy hierarchy,
            IServiceProvider serviceProvider,
            VisualStudioWorkspaceImpl visualStudioWorkspaceOpt,
            HostDiagnosticUpdateSource hostDiagnosticUpdateSourceOpt,
            ICommandLineParserService commandLineParserServiceOpt)
            : base(projectTracker,
                   reportExternalErrorCreatorOpt,
                   projectSystemName,
                   hierarchy,
                   LanguageNames.CSharp,
                   serviceProvider,
                   visualStudioWorkspaceOpt,
                   hostDiagnosticUpdateSourceOpt,
                   commandLineParserServiceOpt)
        {
            _projectRoot = projectRoot;
            _warningNumberArrayPointer = Marshal.AllocHGlobal(0);

            // Ensure the default options are set up
            ResetAllOptions();
            UpdateOptions();

            projectTracker.AddProject(this);
        }
Пример #9
0
        /// <summary>
        /// Get reference to IVsUIHierarchyWindow interface from guid persistence slot.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <param name="persistenceSlot">Unique identifier for a tool window created using IVsUIShell::CreateToolWindow. 
        /// The caller of this method can use predefined identifiers that map to tool windows if those tool windows 
        /// are known to the caller. </param>
        /// <returns>A reference to an IVsUIHierarchyWindow interface.</returns>
        public static IVsUIHierarchyWindow GetUIHierarchyWindow(IServiceProvider serviceProvider, Guid persistenceSlot)
        {
            if(serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            IVsUIShell shell = serviceProvider.GetService(typeof(SVsUIShell)) as IVsUIShell;

            Debug.Assert(shell != null, "Could not get the ui shell from the project");
            if(shell == null)
            {
                throw new InvalidOperationException();
            }

            object pvar = null;
            IVsWindowFrame frame = null;
            IVsUIHierarchyWindow uiHierarchyWindow = null;

            try
            {
                ErrorHandler.ThrowOnFailure(shell.FindToolWindow(0, ref persistenceSlot, out frame));
                ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out pvar));
            }
            finally
            {
                if(pvar != null)
                {
                    uiHierarchyWindow = (IVsUIHierarchyWindow)pvar;
                }
            }

            return uiHierarchyWindow;
        }
Пример #10
0
 public ModuleDefinitionLoader(IServiceProvider services, string filename, byte[]  bytes) : base(services, filename, bytes)
 {
     this.filename = filename;
     var rdr = new StreamReader(new MemoryStream(bytes));
     this.lexer = new Lexer(rdr);
     this.bufferedTok = null;
 }
        private static IInMemoryDataStore CreateStore(IServiceProvider serviceProvider, bool persist)
        {
            var optionsBuilder = new EntityOptionsBuilder();
            optionsBuilder.UseInMemoryStore(persist: persist);

            return InMemoryTestHelpers.Instance.CreateContextServices(serviceProvider, optionsBuilder.Options).GetRequiredService<IInMemoryDataStore>();
        }
Пример #12
0
        internal static IVsInteractiveWindow/*!*/ EnsureReplWindow(IServiceProvider serviceProvider, IPythonInterpreterFactory factory, PythonProjectNode project) {
            var compModel = serviceProvider.GetComponentModel();
            var provider = compModel.GetService<InteractiveWindowProvider>();

            string replId = PythonReplEvaluatorProvider.GetReplId(factory, project);
            var window = provider.FindReplWindow(replId);
            if (window == null) {
                window = provider.CreateInteractiveWindow(
                    serviceProvider.GetPythonContentType(),
                    factory.Description + " Interactive",
                    typeof(PythonLanguageInfo).GUID,
                    replId
                );

                var toolWindow = window as ToolWindowPane;
                if (toolWindow != null) {
                    toolWindow.BitmapImageMoniker = KnownMonikers.PYInteractiveWindow;
                }

                var pyService = serviceProvider.GetPythonToolsService();
                window.InteractiveWindow.SetSmartUpDown(pyService.GetInteractiveOptions(factory).ReplSmartHistory);
            }

            if (project != null && project.Interpreters.IsProjectSpecific(factory)) {
                project.AddActionOnClose(window, BasePythonReplEvaluator.CloseReplWindow);
            }

            return window;
        }
Пример #13
0
        public static ILoggerFactory AddOrchardLogging(
            this ILoggerFactory loggingFactory, 
            IServiceProvider serviceProvider)
        {
            /* TODO (ngm): Abstract this logger stuff outta here! */
            var loader = serviceProvider.GetRequiredService<IExtensionLoader>();
            var manager = serviceProvider.GetRequiredService<IExtensionManager>();

            var descriptor = manager.GetExtension("Orchard.Logging.Console");
            var entry = loader.Load(descriptor);
            var loggingInitiatorTypes = entry
                .Assembly
                .ExportedTypes
                .Where(et => typeof(ILoggingInitiator).IsAssignableFrom(et));

            IServiceCollection loggerCollection = new ServiceCollection();
            foreach (var initiatorType in loggingInitiatorTypes) {
                loggerCollection.AddScoped(typeof(ILoggingInitiator), initiatorType);
            }
            var moduleServiceProvider = serviceProvider.CreateChildContainer(loggerCollection).BuildServiceProvider();
            foreach (var service in moduleServiceProvider.GetServices<ILoggingInitiator>()) {
                service.Initialize(loggingFactory);
            }

            return loggingFactory;
        }
Пример #14
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     object result = base.EditValue(context, provider, value);
     TreeListView owner = this.Context.Instance as TreeListView;
     owner.Invalidate();
     return result;
 }
Пример #15
0
        /// <summary>
        /// <para>Edits the specified object's value using the editor style indicated by <see cref="GetEditStyle"/>. This should be a <see cref="DpapiSettings"/> object.</para>
        /// </summary>
        /// <param name="context"><para>An <see cref="ITypeDescriptorContext"/> that can be used to gain additional context information.</para></param>
        /// <param name="provider"><para>An <see cref="IServiceProvider"/> that this editor can use to obtain services.</para></param>
        /// <param name="value"><para>The object to edit. This should be a <see cref="Password"/> object.</para></param>
        /// <returns><para>The new value of the <see cref="Password"/> object.</para></returns>
        /// <seealso cref="UITypeEditor.EditValue(ITypeDescriptorContext, IServiceProvider, object)"/>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            Debug.Assert(provider != null, "No service provider; we cannot edit the value");
            if (provider != null)
            {
                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                Debug.Assert(edSvc != null, "No editor service; we cannot edit the value");
                if (edSvc != null)
                {
                    IWindowsFormsEditorService service =(IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                    using (PasswordEditorUI dialog = new PasswordEditorUI())
                    {
                        if (DialogResult.OK == service.ShowDialog(dialog))
                        {
                            return new Password(dialog.Password);
                        }
                        else
                        {
                            return value;
                        }
                    }
                }
            }
            return value;
        }
Пример #16
0
        /// <summary>
        /// Provides the Value for the first Binding as <see cref="System.String"/>
        /// </summary>
        /// <param name="serviceProvider">
        /// The <see cref="System.Windows.Markup.IProvideValueTarget"/> provided from the <see cref="MarkupExtension"/>
        /// </param>
        /// <returns>The founded item from the .resx directory or null if not founded</returns>
        /// <exception cref="System.InvalidOperationException">
        /// thrown if <paramref name="serviceProvider"/> is not type of <see cref="System.Windows.Markup.IProvideValueTarget"/>
        /// </exception>
        /// <exception cref="System.NotSupportedException">
        /// thrown if the founded object is not type of <see cref="System.String"/>
        /// </exception>
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            object obj = base.ProvideValue(serviceProvider);

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

            if (this.IsTypeOf(obj.GetType(), typeof(BaseLocalizeExtension<>)))
            {
                return obj;
            }

            if (obj.GetType().Equals(typeof(string)))
            {
                // dont call GetLocalizedText at this point, otherwise you will get prefix and suffix twice appended
                return obj;
            }

            throw new NotSupportedException(
                string.Format(
                    "ResourceKey '{0}' returns '{1}' which is not type of System.String",
                    this.Key,
                    obj.GetType().FullName));
        }
Пример #17
0
        public ImportWizard(IServiceProvider serviceProvider, string sourcePath, string projectPath) {
            var interpreterService = serviceProvider.GetComponentModel().GetService<IInterpreterOptionsService>();
            _site = serviceProvider;
            ImportSettings = new ImportSettings(serviceProvider, interpreterService);

            _pageSequence = new CollectionViewSource {
                Source = new ObservableCollection<Page>(new Page[] {
                    new FileSourcePage { DataContext = ImportSettings },
                    new InterpreterPage { DataContext = ImportSettings },
                    new SaveProjectPage { DataContext = ImportSettings }
                })
            };
            PageCount = _pageSequence.View.OfType<object>().Count();

            PageSequence = _pageSequence.View;
            PageSequence.CurrentChanged += PageSequence_CurrentChanged;
            PageSequence.MoveCurrentToFirst();

            if (!string.IsNullOrEmpty(sourcePath)) {
                ImportSettings.SetInitialSourcePath(sourcePath);
                Loaded += ImportWizard_Loaded;
            }
            if (!string.IsNullOrEmpty(projectPath)) {
                ImportSettings.SetInitialProjectPath(projectPath);
            }
            ImportSettings.UpdateIsValid();

            DataContext = this;

            InitializeComponent();
        }
        public object ProvideValue(IServiceProvider serviceProvider)
        {
            if (Source == null)
                return null;

            return ImageSource.FromResource(Source);
        }
Пример #19
0
		public TypeDescriptorFilterService (IServiceProvider serviceProvider)
		{
			if (serviceProvider == null)
				throw new ArgumentNullException ("serviceProvider");

			_serviceProvider = serviceProvider;
		}
        internal ImageAdornmentManager(IServiceProvider serviceProvider, IWpfTextView view, IEditorFormatMap editorFormatMap)
        {
            View = view;
            this.serviceProvider = serviceProvider;
            AdornmentLayer = View.GetAdornmentLayer(ImageAdornmentLayerName);

            ImagesAdornmentsRepository = new ImageAdornmentRepositoryService(view.TextBuffer);

            // Create the highlight line adornment
            HighlightLineAdornment = new HighlightLineAdornment(view, editorFormatMap);
            AdornmentLayer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, null, HighlightLineAdornment,
                                        HighlightLineAdornment.VisualElement, null);

            // Create the preview image adornment
            PreviewImageAdornment = new PreviewImageAdornment();
            AdornmentLayer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, null, this,
                                        PreviewImageAdornment.VisualElement, null);

            // Attach to the view events
            View.LayoutChanged += OnLayoutChanged;
            View.TextBuffer.Changed += OnBufferChanged;
            View.Closed += OnViewClosed;

            // Load and initialize the image adornments repository
            ImagesAdornmentsRepository.Load();
            ImagesAdornmentsRepository.Images.ToList().ForEach(image => InitializeImageAdornment(image));
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     IDesignerHost service = (IDesignerHost)context.GetService(typeof(IDesignerHost));
     DeluxeTree component = (DeluxeTree)context.Instance;
     ((DeluxeTreeItemsDesigner)service.GetDesigner(component)).InvokeMenuItemCollectionEditor();
     return value;
 }
        public void Initialize(ConnectionManager connectionManager, IServiceProvider serviceProvider)
        {
            this._connectionManager = connectionManager;
            this._serviceProvider = serviceProvider;

            ConfigureControlsFromConnectionManager();
        }
Пример #23
0
        public static async Task<int> Execute(
            IServiceProvider services, 
            Project project,
            string command,
            string[] args)
        {
            var environment = (IApplicationEnvironment)services.GetService(typeof(IApplicationEnvironment));
            var commandText = project.Commands[command];
            var replacementArgs = CommandGrammar.Process(
                commandText, 
                (key) => GetVariable(environment, key),
                preserveSurroundingQuotes: false)
                .ToArray();

            var entryPoint = replacementArgs[0];
            args = replacementArgs.Skip(1).Concat(args).ToArray();

            if (string.IsNullOrEmpty(entryPoint) ||
                string.Equals(entryPoint, "run", StringComparison.Ordinal))
            {
                entryPoint = project.EntryPoint ?? project.Name;
            }

            CallContextServiceLocator.Locator.ServiceProvider = services;
            return await ExecuteMain(services, entryPoint, args);
        }
Пример #24
0
        public void Initialize(Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            this.serviceProvider = serviceProvider;
              this.metaData = dtsComponentMetadata;

              this.connectionService = (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService));
        }
Пример #25
0
        /// <include file='doc\QueuePathEditor.uex' path='docs/doc[@for="QueuePathEditor.EditValue"]/*' />
        /// <devdoc>
        ///      Edits the given object value using the editor style provided by
        ///      GetEditorStyle.  A service provider is provided so that any
        ///      required editing services can be obtained.
        /// </devdoc>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (edSvc != null)
                {
                    QueuePathDialog dialog = new QueuePathDialog(provider);
                    MessageQueue queue = null;
                    if (value is MessageQueue)
                        queue = (MessageQueue)value;
                    else if (value is string)
                        queue = new MessageQueue((string)value);
                    else if (value != null)
                        return value;

                    if (queue != null)
                        dialog.SelectQueue(queue);

                    IDesignerHost host = (IDesignerHost)provider.GetService(typeof(IDesignerHost));
                    DesignerTransaction trans = null;
                    if (host != null)
                        trans = host.CreateTransaction();

                    try
                    {
                        if ((context == null || context.OnComponentChanging()) && edSvc.ShowDialog(dialog) == DialogResult.OK)
                        {
                            if (dialog.Path != String.Empty)
                            {
                                if (context.Instance is MessageQueue || context.Instance is MessageQueueInstaller)
                                    value = dialog.Path;
                                else
                                {
                                    value = MessageQueueConverter.GetFromCache(dialog.Path);
                                    if (value == null)
                                    {
                                        value = new MessageQueue(dialog.Path);
                                        MessageQueueConverter.AddToCache((MessageQueue)value);
                                        if (context != null)
                                            context.Container.Add((IComponent)value);
                                    }
                                }

                                context.OnComponentChanged();
                            }
                        }
                    }
                    finally
                    {
                        if (trans != null)
                        {
                            trans.Commit();
                        }
                    }
                }
            }

            return value;
        }
Пример #26
0
		public virtual object CreateInstance (IServiceProvider provider, Type objectType, Type[] argTypes, object[] args)
		{
			if (_parent != null)
				return _parent.CreateInstance (provider, objectType, argTypes, args);
			
			return System.Activator.CreateInstance (objectType, args);
		}
Пример #27
0
        public JsonRpcDispatcher(IService service, IServiceProvider serviceProvider)
        {
            if (service == null)
                throw new ArgumentNullException("service");

            _service = service;

            if (serviceProvider == null)
            {
                //
                // No service provider supplied so check if the RPC service
                // itself is our service provider.
                //

                serviceProvider = service as IServiceProvider;

                //
                // If no service provider found so far, then create a default
                // one.
                //

                if (serviceProvider == null)
                    serviceProvider = new ServiceContainer();
            }

            _serviceProvider = serviceProvider;
        }
        public ProjectBindingOperation(IServiceProvider serviceProvider, Project project, ISolutionRuleStore ruleStore)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            if (ruleStore == null)
            {
                throw new ArgumentNullException(nameof(ruleStore));
            }

            this.serviceProvider = serviceProvider;
            this.initializedProject = project;
            this.ruleStore = ruleStore;

            this.sourceControlledFileSystem = this.serviceProvider.GetService<ISourceControlledFileSystem>();
            this.sourceControlledFileSystem.AssertLocalServiceIsNotNull();

            this.ruleSetSerializer = this.serviceProvider.GetService<IRuleSetSerializer>();
            this.ruleSetSerializer.AssertLocalServiceIsNotNull();
        }
Пример #29
0
        /// <summary>
        /// This describes how to launch the form etc.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            _context = context;

            IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            SQLExpressionDialog dlgExpression = new SQLExpressionDialog();
            string original = (string)value;
            dlgExpression.Expression = (string)value;

            // Try to find the Table
            IFeatureCategory category = context.Instance as IFeatureCategory;
            if (category != null)
            {
                IFeatureScheme scheme = category.GetParentItem() as IFeatureScheme;
                if (scheme != null)
                {
                    IFeatureLayer layer = scheme.GetParentItem() as IFeatureLayer;
                    if (layer != null)
                    {
                        dlgExpression.Table = layer.DataSet.DataTable;
                    }
                }
                else
                {
                    IFeatureLayer layer = category.GetParentItem() as IFeatureLayer;
                    if (layer != null)
                    {
                        dlgExpression.Table = layer.DataSet.DataTable;
                    }
                }
            }

            dlgExpression.ChangesApplied += DlgExpressionChangesApplied;
            return dialogProvider.ShowDialog(dlgExpression) != DialogResult.OK ? original : dlgExpression.Expression;
        }
        /// <summary>
        /// This should launch an open file dialog instead of the usual thing.
        /// </summary>
        /// <param name="context">System.ComponentModel.ITypeDescriptorContext</param>
        /// <param name="provider">IServiceProvider</param>
        /// <param name="value">The object being displayed</param>
        /// <returns>A new version of the object if the dialog was ok.</returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            object _backup;
            ICloneable parent = value as ICloneable;
            if (parent != null)
            {
                _backup = parent.Clone();
            }
            else
            {
                _backup = value;
            }

            IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            PropertyDialog frm = new PropertyDialog(dialogProvider);
            frm.PropertyGrid.SelectedObject = value;
            if (dialogProvider.ShowDialog(frm) == System.Windows.Forms.DialogResult.OK)
            {
                return value;
            }
            else
            {
                return _backup;
            }
            
        }
Пример #31
0
        public static ProcessStartInfo CreateProcessStartInfo(IServiceProvider provider, LaunchConfiguration config)
        {
            var psi = new ProcessStartInfo {
                FileName  = config.GetInterpreterPath(),
                Arguments = string.Join(" ", new[] {
                    config.InterpreterArguments,
                    config.ScriptName == null ? "" : ProcessOutput.QuoteSingleArgument(config.ScriptName),
                    config.ScriptArguments
                }.Where(s => !string.IsNullOrEmpty(s))),
                WorkingDirectory = config.WorkingDirectory,
                UseShellExecute  = false
            };

            if (string.IsNullOrEmpty(psi.FileName))
            {
                throw new FileNotFoundException(Strings.DebugLaunchInterpreterMissing);
            }
            if (!File.Exists(psi.FileName))
            {
                throw new FileNotFoundException(Strings.DebugLaunchInterpreterMissing_Path.FormatUI(psi.FileName));
            }
            if (string.IsNullOrEmpty(psi.WorkingDirectory))
            {
                psi.WorkingDirectory = PathUtils.GetParent(config.ScriptName);
            }
            if (string.IsNullOrEmpty(psi.WorkingDirectory))
            {
                throw new DirectoryNotFoundException(Strings.DebugLaunchWorkingDirectoryMissing);
            }
            if (!Directory.Exists(psi.WorkingDirectory))
            {
                throw new DirectoryNotFoundException(Strings.DebugLaunchWorkingDirectoryMissing_Path.FormatUI(psi.FileName));
            }

            foreach (var kv in provider.GetPythonToolsService().GetFullEnvironment(config))
            {
                psi.Environment[kv.Key] = kv.Value;
            }

            var pyService = provider.GetPythonToolsService();
            // Pause if the user has requested it.
            string pauseCommand = null;

            if (config.GetLaunchOption(PythonConstants.NeverPauseOnExit).IsTrue())
            {
                // Do nothing
            }
            else if (pyService.DebuggerOptions.WaitOnAbnormalExit && pyService.DebuggerOptions.WaitOnNormalExit)
            {
                pauseCommand = "pause";
            }
            else if (pyService.DebuggerOptions.WaitOnAbnormalExit && !pyService.DebuggerOptions.WaitOnNormalExit)
            {
                pauseCommand = "if errorlevel 1 pause";
            }
            else if (pyService.DebuggerOptions.WaitOnNormalExit && !pyService.DebuggerOptions.WaitOnAbnormalExit)
            {
                pauseCommand = "if not errorlevel 1 pause";
            }

            if (!string.IsNullOrEmpty(pauseCommand))
            {
                psi.Arguments = string.Format("/c \"{0} {1}\" & {2}",
                                              ProcessOutput.QuoteSingleArgument(psi.FileName),
                                              psi.Arguments,
                                              pauseCommand
                                              );
                psi.FileName = Path.Combine(Environment.SystemDirectory, "cmd.exe");
            }

            return(psi);
        }
Пример #32
0
 public XbeLoader(IServiceProvider services, string filename, byte[] rawImage)
     : base(services, filename, rawImage)
 {
     rdr = new LeImageReader(rawImage);
 }
Пример #33
0
 public LayoutPartSettingsDisplayDriver(IContentManager contentManager, IServiceProvider serviceProvider)
 {
     _contentManager  = contentManager;
     _serviceProvider = serviceProvider;
 }
 public MockVsEditorAdaptersFactoryService([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }
Пример #35
0
 public FakeMessageContext(IServiceProvider serviceProvider)
     : base(serviceProvider)
 {
 }
Пример #36
0
        public static unsafe DebugTargetInfo CreateDebugTargetInfo(IServiceProvider provider, LaunchConfiguration config)
        {
            var pyService = provider.GetPythonToolsService();
            var dti       = new DebugTargetInfo(provider);

            try {
                dti.Info.dlo        = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess;
                dti.Info.bstrExe    = config.GetInterpreterPath();
                dti.Info.bstrCurDir = config.WorkingDirectory;
                if (string.IsNullOrEmpty(dti.Info.bstrCurDir))
                {
                    dti.Info.bstrCurDir = PathUtils.GetParent(config.ScriptName);
                }

                dti.Info.bstrRemoteMachine         = null;
                dti.Info.fSendStdoutToOutputWindow = 0;

                bool nativeDebug = config.GetLaunchOption(PythonConstants.EnableNativeCodeDebugging).IsTrue();
                if (!nativeDebug)
                {
                    dti.Info.bstrOptions = string.Join(";",
                                                       GetGlobalDebuggerOptions(pyService)
                                                       .Concat(GetLaunchConfigurationOptions(config))
                                                       .Where(s => !string.IsNullOrEmpty(s))
                                                       .Select(s => s.Replace(";", ";;"))
                                                       );
                }

                // Environment variables should be passed as a
                // null-terminated block of null-terminated strings.
                // Each string is in the following form:name=value\0
                var buf = new StringBuilder();
                foreach (var kv in provider.GetPythonToolsService().GetFullEnvironment(config))
                {
                    buf.AppendFormat("{0}={1}\0", kv.Key, kv.Value);
                }
                if (buf.Length > 0)
                {
                    buf.Append("\0");
                    dti.Info.bstrEnv = buf.ToString();
                }

                var args = string.Join(" ", new[] {
                    config.InterpreterArguments,
                    config.ScriptName == null ? "" : ProcessOutput.QuoteSingleArgument(config.ScriptName),
                    config.ScriptArguments
                }.Where(s => !string.IsNullOrEmpty(s)));

                if (config.Environment != null)
                {
                    args = DoSubstitutions(config.Environment, args);
                }
                dti.Info.bstrArg = args;

                if (nativeDebug)
                {
                    dti.Info.dwClsidCount = 2;
                    dti.Info.pClsidList   = Marshal.AllocCoTaskMem(sizeof(Guid) * 2);
                    var engineGuids = (Guid *)dti.Info.pClsidList;
                    engineGuids[0] = dti.Info.clsidCustom = DkmEngineId.NativeEng;
                    engineGuids[1] = AD7Engine.DebugEngineGuid;
                }
                else
                {
                    // Set the Python debugger
                    dti.Info.clsidCustom = new Guid(AD7Engine.DebugEngineId);
                    dti.Info.grfLaunch   = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_StopDebuggingOnEnd;
                }

                // Null out dti so that it is not disposed before we return.
                var result = dti;
                dti = null;
                return(result);
            } finally {
                if (dti != null)
                {
                    dti.Dispose();
                }
            }
        }
Пример #37
0
 public DebugTargetInfo(IServiceProvider provider)
 {
     _provider   = provider;
     Info        = new VsDebugTargetInfo();
     Info.cbSize = (uint)Marshal.SizeOf(Info);
 }
Пример #38
0
 public Output(IServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }
Пример #39
0
 public static T GetRequiredService <T>(this IServiceProvider provider)
 {
     return((T)provider.GetRequiredService(typeof(T)));
 }
Пример #40
0
        public LearnerFacetController(IServiceProvider serviceProvider) : base(serviceProvider)
        {

        }
Пример #41
0
        public override void Configure(IApplicationBuilder app, IRouteBuilder routes, IServiceProvider serviceProvider)
        {
            //((AccApplicationLifetime)app.ApplicationServices.GetService<IApplicationLifetime>()).OnTenantStarted();

            app.UseCors("acc_cors");

            //app.UseSignalR(cfg =>
            //{
            //    cfg.MapHub<TestHub>("/chatHub");
            //});
        }
Пример #42
0
        /// <inheritdoc />
        public IEnumerable <IDocument> Execute(IReadOnlyList <IDocument> inputs, IExecutionContext context)
        {
            // Register all the MVC and Razor services
            // In the future, if DI is implemented for all Wyam, the IExecutionContext would be registered as a service
            // and the IHostingEnviornment would be registered as transient with the execution context provided in ctor
            IServiceCollection serviceCollection = new ServiceCollection();
            IMvcCoreBuilder    builder           = serviceCollection
                                                   .AddMvcCore()
                                                   .AddRazorViewEngine();

            builder.PartManager.FeatureProviders.Add(new MetadataReferenceFeatureProvider(context));
            serviceCollection.Configure <RazorViewEngineOptions>(options =>
            {
                options.ViewLocationExpanders.Add(new ViewLocationExpander());
            });
            serviceCollection
            .AddSingleton <ILoggerFactory, TraceLoggerFactory>()
            .AddSingleton <DiagnosticSource, SilentDiagnosticSource>()
            .AddSingleton <IHostingEnvironment, HostingEnvironment>()
            .AddSingleton <ObjectPoolProvider, DefaultObjectPoolProvider>()
            .AddSingleton <IExecutionContext>(context)
            .AddSingleton <IBasePageTypeProvider>(new BasePageTypeProvider(_basePageType ?? typeof(WyamRazorPage <>)))
            .AddScoped <IMvcRazorHost, RazorHost>();
            IServiceProvider services = serviceCollection.BuildServiceProvider();

            // Eliminate input documents that we shouldn't process
            List <IDocument> validInputs = inputs
                                           .Where(context, x => _ignorePrefix == null ||
                                                  !x.ContainsKey(Keys.SourceFileName) ||
                                                  !x.FilePath(Keys.SourceFileName).FullPath.StartsWith(_ignorePrefix))
                                           .ToList();

            if (validInputs.Count < inputs.Count)
            {
                Trace.Information($"Ignoring {inputs.Count - validInputs.Count} inputs due to source file name prefix");
            }

            // Compile and evaluate the pages in parallel
            IServiceScopeFactory scopeFactory = services.GetRequiredService <IServiceScopeFactory>();

            return(validInputs.AsParallel().Select(context, input =>
            {
                Trace.Verbose("Processing Razor for {0}", input.SourceString());
                using (IServiceScope scope = scopeFactory.CreateScope())
                {
                    // Get services
                    IRazorViewEngine viewEngine = scope.ServiceProvider.GetRequiredService <IRazorViewEngine>();
                    IRazorPageActivator pageActivator = scope.ServiceProvider.GetRequiredService <IRazorPageActivator>();
                    HtmlEncoder htmlEncoder = scope.ServiceProvider.GetRequiredService <HtmlEncoder>();
                    IRazorPageFactoryProvider pageFactoryProvider = scope.ServiceProvider.GetRequiredService <IRazorPageFactoryProvider>();
                    IRazorCompilationService razorCompilationService = scope.ServiceProvider.GetRequiredService <IRazorCompilationService>();
                    IHostingEnvironment hostingEnviornment = scope.ServiceProvider.GetRequiredService <IHostingEnvironment>();

                    // Compile the view
                    string relativePath = GetRelativePath(input, context);
                    FilePath viewStartLocationPath = _viewStartPath?.Invoke <FilePath>(input, context);
                    string viewStartLocation = viewStartLocationPath != null ? GetRelativePath(viewStartLocationPath, context) : null;
                    string layoutLocation = _layoutPath?.Invoke <FilePath>(input, context)?.FullPath;
                    IView view;
                    using (Stream stream = input.GetStream())
                    {
                        view = GetViewFromStream(
                            relativePath,
                            stream,
                            viewStartLocation,
                            layoutLocation,
                            viewEngine,
                            pageActivator,
                            htmlEncoder,
                            pageFactoryProvider,
                            hostingEnviornment.WebRootFileProvider,
                            razorCompilationService);
                    }

                    // Render the view
                    object model = _model == null ? input : _model.Invoke(input, context);
                    Stream contentStream = context.GetContentStream();
                    using (StreamWriter writer = contentStream.GetWriter())
                    {
                        Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext =
                            GetViewContext(scope.ServiceProvider, view, model, input, context, writer);
                        viewContext.View.RenderAsync(viewContext).GetAwaiter().GetResult();
                        writer.Flush();
                    }
                    return context.GetDocument(input, contentStream);
                }
            }));
        }
Пример #43
0
 public UserController(IServiceProvider serviceProvider)
 {
     ServiceProvider = serviceProvider;
 }
Пример #44
0
        private static RpcClient.Client BuildTransmissionRpcClient(IServiceProvider sp)
        {
            var settings = sp.GetRequiredService <IOptions <TorrentClientSettings> >().Value;

            return(TransmissionRcpClientHelper.CreateTransmissionRpcClient(settings));
        }
Пример #45
0
 public UnitService(IServiceProvider serviceProvider) : base(serviceProvider)
 {
 }
        static MassTransitHubLifetimeManager <THub> GetMassTransitHubLifetimeManager <THub>(IServiceProvider provider, HubLifetimeManagerOptions <THub> options)
            where THub : Hub
        {
            var scopeProvider = provider.GetRequiredService <IHubLifetimeScopeProvider>();
            var resolver      = provider.GetRequiredService <IHubProtocolResolver>();

            return(new MassTransitHubLifetimeManager <THub>(options, scopeProvider, resolver));
        }
        public override Task <PreconditionResult> CheckPermissionsAsync(ICommandContext context, ParameterInfo parameter, object value, IServiceProvider services)
        {
            var user = value is IUser ? (IUser)value : null;

            if ((user != null) && (context.User.Id == user.Id))
            {
                return(Task.FromResult(PreconditionResult.FromError("User used this command on himself.")));
            }

            return(Task.FromResult(PreconditionResult.FromSuccess()));
        }
Пример #48
0
        public static void EnsureSeedData(IServiceProvider serviceProvider)
        {
            using (var scope = serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                var context = scope.ServiceProvider.GetService <IdentityServerDb>();
                context.Database.Migrate(); //Todo: Comment out if you don't want latest migration, delete and manualy make migration if misbehaving
                var userManager = scope.ServiceProvider.GetRequiredService <UserManager <ApplicationUser> >();
                var roleManager = scope.ServiceProvider.GetRequiredService <RoleManager <IdentityRole> >();


                foreach (var roleType in Enum.GetValues(typeof(AdminTypeEnum)))
                {
                    var roleName = roleType.ToString();
                    var role     = roleManager.FindByNameAsync(roleName).Result;
                    if (role == null)
                    {
                        var result = roleManager.CreateAsync(new IdentityRole(roleName)).Result;
                    }
                }

                var mk = userManager.FindByEmailAsync("*****@*****.**").Result;
                if (mk == null)
                {
                    mk = new ApplicationUser
                    {
                        UserName = "******",
                        Email    = "*****@*****.**"
                    };
                    var result = userManager.CreateAsync(mk, "Martin123").Result;
                    if (!result.Succeeded)
                    {
                        throw new Exception(result.Errors.First().Description);
                    }

                    var type = Enum.GetName(typeof(AdminTypeEnum), AdminTypeEnum.Global);
                    if (!userManager.IsInRoleAsync(mk, type).Result)
                    {
                        result = userManager.AddToRoleAsync(mk, type).Result;
                        if (!result.Succeeded)
                        {
                            throw new Exception(result.Errors.First().Description);
                        }
                    }

                    result = userManager.AddClaimsAsync(mk, new Claim[] {
                        new Claim(JwtClaimTypes.Name, "Martin Krisko"),
                        new Claim(JwtClaimTypes.GivenName, "Martin"),
                        new Claim(JwtClaimTypes.FamilyName, "Krisko"),
                        new Claim(JwtClaimTypes.Email, "*****@*****.**"),
                        new Claim(JwtClaimTypes.EmailVerified, "true", ClaimValueTypes.Boolean),
                        new Claim(JwtClaimTypes.Address,
                                  @"{ 'street_address': 'CLaus Cortens Gade 5', 'locality': 'Horsens', 'postal_code': 8700, 'country': 'Denmark' }",
                                  IdentityServer4.IdentityServerConstants.ClaimValueTypes.Json),
                        new Claim("location", "Horsens"),
                    }).Result;
                    if (!result.Succeeded)
                    {
                        throw new Exception(result.Errors.First().Description);
                    }

                    Console.WriteLine("user [email protected] created");
                }
                else
                {
                    Console.WriteLine("user with e-mail [email protected] already exists");
                }

                var dk = userManager.FindByEmailAsync("*****@*****.**").Result;
                if (dk == null)
                {
                    dk = new ApplicationUser
                    {
                        UserName = "******",
                        Email    = "*****@*****.**"
                    };
                    var result = userManager.CreateAsync(dk, "David123").Result;
                    if (!result.Succeeded)
                    {
                        throw new Exception(result.Errors.First().Description);
                    }

                    var type = Enum.GetName(typeof(AdminTypeEnum), AdminTypeEnum.Global);
                    if (!userManager.IsInRoleAsync(dk, type).Result)
                    {
                        result = userManager.AddToRoleAsync(dk, type).Result;
                        if (!result.Succeeded)
                        {
                            throw new Exception(result.Errors.First().Description);
                        }
                    }
                    result = userManager.AddClaimsAsync(dk, new Claim[] {
                        new Claim(JwtClaimTypes.Name, "David Kuts"),
                        new Claim(JwtClaimTypes.GivenName, "David"),
                        new Claim(JwtClaimTypes.FamilyName, "Kuts"),
                        new Claim(JwtClaimTypes.Email, "*****@*****.**"),
                        new Claim(JwtClaimTypes.EmailVerified, "true", ClaimValueTypes.Boolean),
                        new Claim(JwtClaimTypes.Address,
                                  @"{ 'street_address': 'Chr M Østergaards Vej 1A', 'locality': 'Horsens', 'postal_code': 8700, 'country': 'Denmark' }",
                                  IdentityServer4.IdentityServerConstants.ClaimValueTypes.Json),
                        new Claim("location", "Horsens"),
                    }).Result;
                    if (!result.Succeeded)
                    {
                        throw new Exception(result.Errors.First().Description);
                    }
                    Console.WriteLine("user dk created");
                }
                else
                {
                    Console.WriteLine("user with e-mail [email protected] already exists");
                }
            }
        }
Пример #49
0
 public ApplicationIdentityUserManager(IUserStore <ApplicationUser> store, IOptions <IdentityOptions> optionsAccessor,
                                       IPasswordHasher <ApplicationUser> passwordHasher, IEnumerable <IUserValidator <ApplicationUser> > userValidators,
                                       IEnumerable <IPasswordValidator <ApplicationUser> > passwordValidators, ILookupNormalizer keyNormalizer,
                                       IdentityErrorDescriber errors, IServiceProvider services, ILogger <UserManager <ApplicationUser> > logger) : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
 {
 }
 public SearchServiceClientFactory(IServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }
Пример #51
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();

            //Add database context
            services.AddDbContext <DatabaseContext>(x =>
                                                    x.UseNpgsql(Configuration["ConnectionStrings:ConnectionToDb"],
                                                                assemb => assemb.MigrationsAssembly("AliHotel.Web")));

            //Services for user authentication and password validation
            services.AddScoped <IHashProvider, Md5HashService>();
            services.AddScoped <IPasswordHasher <User>, Md5PasswordHasher>();


            //Add authentication
            services.AddIdentity <User, Role>(options =>
            {
                options.User.RequireUniqueEmail = true;
            })
            .AddRoleStore <RoleStore>()
            .AddUserStore <IdentityStore>()
            .AddPasswordValidator <Md5PasswordValidator>()
            //.AddEntityFrameworkStores<DatabaseContext>()
            .AddDefaultTokenProviders();

            //Configure authentication
            services.Configure <IdentityOptions>(options =>
            {
                // Password settings
                options.Password.RequireDigit           = false;
                options.Password.RequiredLength         = 5;
                options.Password.RequireNonAlphanumeric = false;
                options.Password.RequireUppercase       = false;
                options.Password.RequireLowercase       = false;
                options.Password.RequiredUniqueChars    = 1;

                // Lockout settings
                options.Lockout.DefaultLockoutTimeSpan  = TimeSpan.FromMinutes(30);
                options.Lockout.MaxFailedAccessAttempts = 10;
                options.Lockout.AllowedForNewUsers      = true;

                // User settings
                options.User.RequireUniqueEmail = true;
            });

            services.ConfigureApplicationCookie(options =>
            {
                options.Events.OnRedirectToLogin = context =>
                {
                    context.Response.StatusCode = 401;
                    return(Task.CompletedTask);
                };
            });

            //Add swagger for documenting API
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "AliHotel API", Version = "v1"
                });

                c.IncludeXmlComments(System.AppDomain.CurrentDomain.BaseDirectory + @"AliHotel.Web.xml");
            });

            services.AddDomainServices();

            ServiceProvider = services.BuildServiceProvider();
            return(ServiceProvider);
        }
 public InfobarService(IServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }
Пример #53
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new ApplicationDbContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <ApplicationDbContext> >()))
            {
                if (context.Skills.Any())
                {
                    return;
                }

                context.Skills.AddRange(
                    new Skill
                {
                    SkillNo  = 1,
                    Name     = "Organising yourself and your time",
                    Category = SkillCategories.Learning,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 2,
                    Name     = " Note taking",
                    Category = SkillCategories.Learning,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 3,
                    Name     = "Gathering information from journals/books",
                    Category = SkillCategories.Learning,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 4,
                    Name     = "Gathering information from Internet/databases",
                    Category = SkillCategories.Learning,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 5,
                    Name     = "Making judgements about accuracy and relevance of any information found",
                    Category = SkillCategories.Learning,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 6,
                    Name     = "Revising and examination techniques",
                    Category = SkillCategories.Learning,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 7,
                    Name     = "Writing, using the correct grammar, punctuation and spelling",
                    Category = SkillCategories.Communication,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 8,
                    Name     = " Structuring reports and essays",
                    Category = SkillCategories.Communication,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 9,
                    Name     = "Using the Harvard referencing systems",
                    Category = SkillCategories.Communication,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 10,
                    Name     = " Making a presentation",
                    Category = SkillCategories.Communication,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 11,
                    Name     = "Working with others in a group",
                    Category = SkillCategories.Teamwork,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 12,
                    Name     = " Taking part in discussions",
                    Category = SkillCategories.Teamwork,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 13,
                    Name     = "Negotiating and assertiveness",
                    Category = SkillCategories.Teamwork,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 14,
                    Name     = " Storing/copying files on a computer",
                    Category = SkillCategories.IT,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 15,
                    Name     = "Producing documents using Word",
                    Category = SkillCategories.IT,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 16,
                    Name     = "Producing slides using Powerpoint",
                    Category = SkillCategories.IT,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 17,
                    Name     = "Using email",
                    Category = SkillCategories.IT,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 18,
                    Name     = "Understanding numbers, measurements and units",
                    Category = SkillCategories.Numeracy,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 19,
                    Name     = "Doing calculations and routine mathematics",
                    Category = SkillCategories.Numeracy,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 20,
                    Name     = "Problem Solving",
                    Category = SkillCategories.ProblemSolving,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                },
                    new Skill
                {
                    SkillNo  = 21,
                    Name     = "Coping with pressure",
                    Category = SkillCategories.ProblemSolving,
                    Level    = SkillLevels.High,
                    Priority = SkillLevels.Low
                });

                context.SaveChanges();
            }
        }
 public DependencyResolver(IServiceProvider provider)
 {
     this.provider = provider;
 }
Пример #55
0
        public DefaultUserResolver(IServiceProvider serviceProvider)
        {
            Guard.NotNull(serviceProvider, nameof(serviceProvider));

            this.serviceProvider = serviceProvider;
        }
Пример #56
0
        public void TestInitialize()
        {
            new Grand.Services.Tests.ServiceTest().PluginInitializator();

            _workContext          = new Mock <IWorkContext>().Object;
            _stateProvinceService = new Mock <IStateProvinceService>().Object;

            _store = new Store {
                Id = "1"
            };
            var tempStoreContext = new Mock <IStoreContext>();

            {
                tempStoreContext.Setup(x => x.CurrentStore).Returns(_store);
                _storeContext = tempStoreContext.Object;
            }

            _productService = new Mock <IProductService>().Object;
            var tempEventPublisher = new Mock <IMediator>();
            {
                //tempEventPublisher.Setup(x => x.PublishAsync(It.IsAny<object>()));
                _eventPublisher = tempEventPublisher.Object;
            }

            var pluginFinder = new PluginFinder(_serviceProvider);
            var cacheManager = new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher);

            _discountService        = new Mock <IDiscountService>().Object;
            _categoryService        = new Mock <ICategoryService>().Object;
            _manufacturerService    = new Mock <IManufacturerService>().Object;
            _productAttributeParser = new Mock <IProductAttributeParser>().Object;
            _vendorService          = new Mock <IVendorService>().Object;
            _currencyService        = new Mock <ICurrencyService>().Object;
            _serviceProvider        = new Mock <IServiceProvider>().Object;

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();
            _customerService      = new Mock <ICustomerService>().Object;

            _priceCalcService = new PriceCalculationService(_workContext, _storeContext,
                                                            _discountService, _categoryService,
                                                            _manufacturerService, _productAttributeParser, _productService, _customerService,
                                                            _vendorService, _currencyService,
                                                            _shoppingCartSettings, _catalogSettings);


            _localizationService = new Mock <ILocalizationService>().Object;

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >().Object;
            _deliveryDateRepository   = new Mock <IRepository <DeliveryDate> >().Object;
            _warehouseRepository      = new Mock <IRepository <Warehouse> >().Object;
            _logger                  = new NullLogger();
            _paymentService          = new Mock <IPaymentService>().Object;
            _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>().Object;
            _giftCardService         = new Mock <IGiftCardService>().Object;
            _genericAttributeService = new Mock <IGenericAttributeService>().Object;
            _geoLookupService        = new Mock <IGeoLookupService>().Object;
            _countryService          = new Mock <ICountryService>().Object;
            _customerSettings        = new CustomerSettings();
            _addressSettings         = new AddressSettings();

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = "10";

            _shippingService = new ShippingService(_shippingMethodRepository,
                                                   _deliveryDateRepository,
                                                   _warehouseRepository,
                                                   null,
                                                   _logger,
                                                   _productService,
                                                   _productAttributeParser,
                                                   _checkoutAttributeParser,
                                                   _localizationService,
                                                   _addressService,
                                                   _countryService,
                                                   _stateProvinceService,
                                                   pluginFinder,
                                                   _storeContext,
                                                   _eventPublisher,
                                                   _currencyService,
                                                   cacheManager,
                                                   null,
                                                   _shoppingCartSettings,
                                                   _shippingSettings);



            var tempAddressService = new Mock <IAddressService>();

            {
                tempAddressService.Setup(x => x.GetAddressByIdSettings(_taxSettings.DefaultTaxAddressId))
                .ReturnsAsync(new Address {
                    Id = _taxSettings.DefaultTaxAddressId
                });
                _addressService = tempAddressService.Object;
            }

            _taxService = new TaxService(_addressService, _workContext, _taxSettings,
                                         pluginFinder, _geoLookupService, _countryService, _serviceProvider, _logger, _customerSettings, _addressSettings);

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      null, _productService, _currencyService, _taxSettings, _rewardPointsSettings,
                                                                      _shippingSettings, _shoppingCartSettings, _catalogSettings);
        }
Пример #57
0
 public DataAnnotationsValidator(IServiceProvider serviceProvider)
 {
     _serviceProvider = serviceProvider;
 }
 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     return(this);
 }
Пример #59
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Executor"/> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="serverAddresses">The server addresses.</param>
 /// <param name="api">The API.</param>
 /// <param name="serviceProvider">The service provider.</param>
 public Executor(IConfiguration configuration, IServerAddressesFeature serverAddresses, IApiDescriptionGroupCollectionProvider api, IServiceProvider serviceProvider)
 {
     this.serverAddresses = serverAddresses;
     this.api             = api;
     this.serviceProvider = serviceProvider;
     this.configuration   = configuration;
 }
Пример #60
0
 public void ConfigureServices(IServiceProvider serviceProvider)
 {
     serviceProvider.Add <IUserServices, UserServices>();
 }