Пример #1
0
            public Task <InteractiveHostPlatformInfo.Data> InitializeAsync(
                string replServiceProviderTypeName,
                string cultureName
                )
            {
                // TODO (tomat): we should share the copied files with the host
                var metadataFileProvider = new MetadataShadowCopyProvider(
                    Path.Combine(Path.GetTempPath(), "InteractiveHostShadow"),
                    noShadowCopyDirectories: s_systemNoShadowCopyDirectories,
                    documentationCommentsCulture: new CultureInfo(cultureName)
                    );

                var assemblyLoader          = new InteractiveAssemblyLoader(metadataFileProvider);
                var replServiceProviderType = Type.GetType(replServiceProviderTypeName);
                var replServiceProvider     = (ReplServiceProvider)Activator.CreateInstance(
                    replServiceProviderType
                    );
                var globals = new InteractiveScriptGlobals(
                    Console.Out,
                    replServiceProvider.ObjectFormatter
                    );

                _serviceState = new ServiceState(
                    assemblyLoader,
                    metadataFileProvider,
                    replServiceProvider,
                    globals
                    );

                return(Task.FromResult(s_currentPlatformInfo.Serialize()));
            }
Пример #2
0
            public Task InitializeAsync(string replServiceProviderTypeName, string cultureName)
            {
                Debug.Assert(cultureName != null);
                using (var resetEvent = new ManualResetEventSlim(false))
                {
                    var uiThread = new Thread(() =>
                    {
                        s_control = new Control();
                        s_control.CreateControl();
                        resetEvent.Set();
                        Application.Run();
                    });
                    uiThread.SetApartmentState(ApartmentState.STA);
                    uiThread.IsBackground = true;
                    uiThread.Start();
                    resetEvent.Wait();
                }
                // TODO (tomat): we should share the copied files with the host
                var metadataFileProvider = new MetadataShadowCopyProvider(
                    Path.Combine(Path.GetTempPath(), "InteractiveHostShadow"),
                    noShadowCopyDirectories: s_systemNoShadowCopyDirectories,
                    documentationCommentsCulture: new CultureInfo(cultureName));

                var assemblyLoader          = new InteractiveAssemblyLoader(metadataFileProvider);
                var replServiceProviderType = Type.GetType(replServiceProviderTypeName);
                var replServiceProvider     = (ReplServiceProvider)Activator.CreateInstance(replServiceProviderType);
                var globals = new InteractiveScriptGlobals(Console.Out, replServiceProvider.ObjectFormatter);

                _serviceState = new ServiceState(assemblyLoader, metadataFileProvider, replServiceProvider, globals);

                return(Task.CompletedTask);
            }
Пример #3
0
            public void Initialize(Type replServiceProviderType, string cultureName)
            {
                Contract.ThrowIfFalse(_serviceState == null, "Service already initialized");

                // TODO (tomat): we should share the copied files with the host
                var metadataFileProvider = new MetadataShadowCopyProvider(
                    Path.Combine(Path.GetTempPath(), "InteractiveHostShadow"),
                    noShadowCopyDirectories: s_systemNoShadowCopyDirectories,
                    documentationCommentsCulture: new CultureInfo(cultureName));

                var assemblyLoader      = new InteractiveAssemblyLoader(metadataFileProvider);
                var replServiceProvider = (ReplServiceProvider)Activator.CreateInstance(replServiceProviderType);
                var globals             = new InteractiveScriptGlobals(Console.Out, replServiceProvider.ObjectFormatter);

                _serviceState = new ServiceState(assemblyLoader, metadataFileProvider, replServiceProvider, globals);
            }
Пример #4
0
        private Task <ServiceState> WaitForStates(ServiceState?state, IEnumerable <ServiceState>?states, CancellationToken?cancellationToken = null)
        {
            cancellationToken ??= CancellationToken.None;

            return(Task.Run(async() =>
            {
                while (true)
                {
                    Refresh();

                    if ((state.HasValue && State == state) ||
                        (states != null && states.Contains(State)))
                    {
                        return State;
                    }

                    await Task.Delay(250, cancellationToken.Value).ConfigureAwait(false);
                }
            }));
        }
Пример #5
0
 /// <summary>
 /// Get an existing Service resource's state with the given name, ID, and optional extra
 /// properties used to qualify the lookup.
 /// </summary>
 ///
 /// <param name="name">The unique name of the resulting resource.</param>
 /// <param name="id">The unique provider ID of the resource to lookup.</param>
 /// <param name="state">Any extra arguments used during the lookup.</param>
 /// <param name="options">A bag of options that control this resource's behavior</param>
 public static Service Get(string name, Input <string> id, ServiceState?state = null, CustomResourceOptions?options = null)
 {
     return(new Service(name, id, state, options));
 }
Пример #6
0
 private Service(string name, Input <string> id, ServiceState?state = null, CustomResourceOptions?options = null)
     : base("azure:signalr/service:Service", name, state, MakeResourceOptions(options, id))
 {
 }
Пример #7
0
 public void Dispose()
 {
     _serviceState?.Dispose();
     _serviceState = null;
 }
Пример #8
0
 private Service(string name, Input <string> id, ServiceState?state = null, CustomResourceOptions?options = null)
     : base("opsgenie:index/service:Service", name, state, MakeResourceOptions(options, id))
 {
 }
Пример #9
0
 private Service(string name, Input <string> id, ServiceState?state = null, CustomResourceOptions?options = null)
     : base("gcp:servicedirectory/service:Service", name, state, MakeResourceOptions(options, id))
 {
 }
Пример #10
0
        //Builder (Hereda el constructor base)
        public ServiceMonitor(string monitorName,string target, string remoteMachine, string username, string password, string domain,
            ServiceState? state, ServiceStatus? status, ServiceStartMode? startMode, bool critic)
            : base(monitorName, target, remoteMachine, username, password, domain)
        {
            this.wantedState = state;
            this.wantedStatus = status;
            this.wantedStartMode = startMode;

            this.actualState = null;
            this.actualStatus = null;
            this.actualStartMode = null;

            this.critic = critic;
            this.mode = Mode.service;
        }