Exemplo n.º 1
0
 public NSFW(Random random, GfycatManager gfyManager, MediaHelper mediaHelper, HelpService helpService)
 {
     Random      = random;
     GfyManager  = gfyManager;
     MediaHelper = mediaHelper;
     HelpService = helpService;
 }
        public GeneralOptionsViewModel(
            ApplicationSettingsRepository settingsRepository,
            IAppProtocolRegistry protocolRegistry,
            HelpService helpService)
        {
            this.settingsRepository = settingsRepository;
            this.protocolRegistry   = protocolRegistry;
            this.helpService        = helpService;

            //
            // Read current settings.
            //
            // NB. Do not hold on to the settings object because other tabs
            // might apply changes to other application settings.
            //

            var settings = this.settingsRepository.GetSettings();

            this.isUpdateCheckEnabled = settings.IsUpdateCheckEnabled.BoolValue;
            this.isDcaEnabled         = settings.IsDeviceCertificateAuthenticationEnabled.BoolValue;
            this.lastUpdateCheck      = settings.LastUpdateCheck.IsDefault
                ? "never"
                : DateTime.FromBinary(settings.LastUpdateCheck.LongValue).ToString();

            this.isBrowserIntegrationEnabled = this.protocolRegistry.IsRegistered(
                IapRdpUrl.Scheme,
                ExecutableLocation);
        }
Exemplo n.º 3
0
 public Game(GameService gameService, HelpService helpService, Random random, HttpClient client)
 {
     GameService = gameService;
     HelpService = helpService;
     Random      = random;
     HttpClient  = client;
 }
Exemplo n.º 4
0
        private async Task <DialogTurnResult> FirstStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var activity = stepContext.Context.Activity;

            if (!activity.Text.Contains("We are Hungry") && !activity.Text.Contains("ccc"))
            {
                await stepContext.Context.SendActivityAsync(MessageFactory.Text("Please input \"We are Hungry\""), cancellationToken);

                var help    = new HelpService();
                var command = help.Command();
                await stepContext.Context.SendActivityAsync(MessageFactory.Text("You can give command"), cancellationToken);

                await stepContext.Context.SendActivityAsync(MessageFactory.Attachment(command), cancellationToken);

                if (string.IsNullOrWhiteSpace(activity.Text) && activity.Value != null)
                {
                    activity.Text = JsonConvert.SerializeObject(activity.Value);
                }

                return(await stepContext.EndDialogAsync());
            }
            else
            {
                return(await stepContext.NextAsync());
            }
        }
Exemplo n.º 5
0
        public void ObtainSpecificVersionWithoutFallback()
        {
            // Given
            HashProvider   hp     = new HashProvider();
            IConfiguration config = new TestConfiguration();

            config.Settings.HelpDirectory = "Help";
            HelpBuilderService buildService = new HelpBuilderService(config, hp);
            HelpService        helpService  = new HelpService(buildService);

            string myFakePluginId = Guid.NewGuid().ToString("B");

            CreateFakeHelp(buildService, myFakePluginId, new Version[] { new Version("1.0.0"), new Version("2.0.0") }, new string[] { "fr-FR", "fr", "en" });
            buildService.CreateOrUpdateBuilds();

            // When
            using (Stream helpPackage = helpService.GetHelpPackage(myFakePluginId, new Version("1.0.0"), "fr-FR"))
            {
                // Then
                Assert.That(helpPackage, Is.Not.Null);
                Assert.That(helpPackage.CanRead, Is.True);

                CheckHelpPackage(helpPackage, (m) =>
                {
                    Assert.That(m.Culture, Is.EqualTo("fr-FR"));
                    Assert.That(m.PluginId, Is.EqualTo(myFakePluginId));
                    Assert.That(m.Version, Is.EqualTo("1.0.0"));
                });
            }
        }
Exemplo n.º 6
0
        private HelpService CreateHelpService()
        {
            var userID  = Guid.Parse(User.Identity.GetUserId());
            var service = new HelpService(userID);

            return(service);
        }
Exemplo n.º 7
0
        /// <include file='doc\VsWindowPane.uex' path='docs/doc[@for="VsWindowPane.ClosePane"]/*' />
        /// <devdoc>
        ///     Called by Visual Studio when it wants to close this pane.  The pane may be
        ///     later re-opened by another call to CreatePaneWindow.
        /// </devdoc>
        public virtual int ClosePane()
        {
            OnWindowPaneClose();

            if (menuService != null)
            {
                menuService.Dispose();
                menuService = null;
            }

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

            if (vsBroadcastEventCookie != 0 && vsShell != null)
            {
                vsShell.UnadviseBroadcastMessages(vsBroadcastEventCookie);
                vsShell = null;
                vsBroadcastEventCookie = 0;
            }

            toolboxService = null;
            host           = null;
            hostChecked    = false;
            return(NativeMethods.S_OK);
        }
Exemplo n.º 8
0
        /// <include file='doc\VsWindowPane.uex' path='docs/doc[@for="VsWindowPane.GetService"]/*' />
        /// <devdoc>
        ///     This can be used to retrieve a service from Visual Studio.
        /// </devdoc>
        public override object GetService(Type serviceClass)
        {
            // We implement IMenuCommandService, so we will
            // demand create it.  MenuCommandService also
            // implements NativeMethods.IOleCommandTarget, but unless
            // someone requested IMenuCommandService no commands
            // will exist, so we don't demand create for
            // NativeMethods.IOleCommandTarget
            //
            if (serviceClass == (typeof(IMenuCommandService)))
            {
                if (menuService == null)
                {
                    menuService = new MenuCommandService(this);
                }
                return(menuService);
            }
            else if (serviceClass == (typeof(NativeMethods.IOleCommandTarget)))
            {
                return(menuService);
            }
            else if (serviceClass == (typeof(IHelpService)))
            {
                if (helpService == null)
                {
                    helpService = new HelpService(this);
                }
                return(helpService);
            }

            return(base.GetService(serviceClass));
        }
Exemplo n.º 9
0
        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            if (PlatformService.IsUnix)
            {
                HelpService.AsyncInitialize();
            }

            pipelines.BeforeRequest.AddItemToStartOfPipeline(ctx =>
            {
                var stopwatch          = new Stopwatch();
                ctx.Items["stopwatch"] = stopwatch;
                stopwatch.Start();
                return(null);
            });

            pipelines.AfterRequest.AddItemToEndOfPipeline(ctx =>
            {
                var stopwatch = (Stopwatch)ctx.Items["stopwatch"];
                stopwatch.Stop();
                Console.WriteLine(ctx.Request.Path + " " + stopwatch.ElapsedMilliseconds + "ms");
            });

            pipelines.OnError.AddItemToEndOfPipeline((ctx, ex) =>
            {
                Console.WriteLine(ex);
                return(null);
            });
        }
Exemplo n.º 10
0
        public VerboseErrorsService(DbService db, CommandHandler ch, HelpService hs)
        {
            _db = db;
            _hs = hs;

            ch.CommandErrored += LogVerboseError;
        }
Exemplo n.º 11
0
        protected override async Task OnMessageActivityAsync(ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken)
        {
            if (turnContext.Activity.Text.Contains("Library"))
            {
                var libraryCard = await GetLibraryCard(turnContext);

                await turnContext.SendActivityAsync(MessageFactory.Attachment(libraryCard), cancellationToken);
            }
            else if (turnContext.Activity.Text.Contains("Pay"))
            {
                var memberId = turnContext.Activity.From.Id;
                var payCard  = _paymentService.CreatePayAdaptiveAttachment(memberId);
                await turnContext.SendActivityAsync(MessageFactory.Attachment(payCard), cancellationToken);
            }
            else if (turnContext.Activity.Text.Contains("payment"))
            {
                var memberId = turnContext.Activity.From.Id;
                var url      = JObject.FromObject(turnContext.Activity.Value).GetValue("payment").ToString();
                _paymentService.UpdatePayment(memberId, url);
                var payCard  = _paymentService.CreatePayAdaptiveAttachment(memberId);
                var activity = MessageFactory.Attachment(payCard);
                activity.Id = turnContext.Activity.ReplyToId;
                await turnContext.UpdateActivityAsync(activity, cancellationToken);

                await turnContext.SendActivityAsync(MessageFactory.Text("You update your payment link: " + url), cancellationToken);
            }
            else if (turnContext.Activity.Text.Contains("Customized Menu"))
            {
                var CustomMenucard = _customMenuService.CallCustomeCard();

                var NewID = turnContext.SendActivityAsync(MessageFactory.Attachment(CustomMenucard), cancellationToken).Result.Id;

                var UpdateActivity = MessageFactory.Attachment(_customMenuService.CallCustomeCard(NewID));
                UpdateActivity.Id = NewID; //指定要更新的activity
                await turnContext.UpdateActivityAsync(UpdateActivity, cancellationToken);
            }
            else if (turnContext.Activity.Text.Contains("Help"))
            {
                var help    = new HelpService();
                var card    = help.IntroductionCard();
                var command = help.Command();
                await turnContext.SendActivityAsync(MessageFactory.Attachment(card), cancellationToken);

                await turnContext.SendActivityAsync(MessageFactory.Text("You can give command"), cancellationToken);

                await turnContext.SendActivityAsync(MessageFactory.Attachment(command), cancellationToken);
            }
            //ting 要移動到訂單完成那邊 回覆pay
            else if (turnContext.Activity.Text.Contains("aaa"))
            {
                var memberId = turnContext.Activity.From.Id;
                var card     = new CreateCardService2().ReplyPayment(_paymentService, turnContext);
                await turnContext.SendActivityAsync(MessageFactory.Attachment(card), cancellationToken);
            }
            else
            {
                await Dialog.RunAsync(turnContext, ConversationState.CreateProperty <DialogState>(nameof(DialogState)), cancellationToken);
            }
        }
Exemplo n.º 12
0
 public GamePage()
 {
     this.InitializeComponent();
     gameService = new GameService();
     helpService = new HelpService();
     GameField   = gameService.initializeGameField();
     InitializeTextFieldArray();
 }
Exemplo n.º 13
0
 public HelpController(MessagesServiceFactory messagesServiceFactory, HelpMessageGeneratorService messageGeneratorService,
                       ResponsesService responsesService, HelpService helpService)
 {
     this._messagesServiceFactory = messagesServiceFactory;
     this._helpMessageGenerator   = messageGeneratorService;
     this._responsesService       = responsesService;
     this._helpService            = helpService;
 }
Exemplo n.º 14
0
 public ItemController(CatalogService catalogService,
                       UserManager <ApplicationUser> userManager,
                       HelpService helpService)
 {
     _catalogService = catalogService;
     _userManager    = userManager;
     _helpService    = helpService;
 }
Exemplo n.º 15
0
        public ActionResult Index()
        {
            var userID  = Guid.Parse(User.Identity.GetUserId());
            var service = new HelpService(userID);
            var model   = service.GetHelps();

            return(View(model));
        }
Exemplo n.º 16
0
 public CrapsModule(
     GamblingService gamblingService,
     CrapsService crapsService,
     HelpService helpService)
 {
     _gamblingService = gamblingService;
     _crapsService    = crapsService;
     _helpService     = helpService;
 }
Exemplo n.º 17
0
 public CharacterModule(
     CharacterService charService,
     ExperienceService expService,
     HelpService helpService)
 {
     _charService = charService;
     _expService  = expService;
     _helpService = helpService;
 }
Exemplo n.º 18
0
 public Audio(VictoriaService vic, LogHandler logger, HelpService helpService, LocalManagementService local)
 {
     Vic             = vic;
     Logger          = logger;
     HelpService     = helpService;
     Local           = local;
     RestClient      = vic.RestClient;
     LavaShardClient = vic.Client;
 }
Exemplo n.º 19
0
 public bool CanShowHelp(ResolveResult result)
 {
     try {
         return(CanShowHelp(HelpService.GetMonoDocHelpUrl(result)));
     } catch (Exception e) {
         LoggingService.LogError("Error while trying to get monodoc help.", e);
         return(false);
     }
 }
Exemplo n.º 20
0
 public CharacterSkillsModule(
     CharacterService charService,
     SkillsService skillsService,
     HelpService helpService)
 {
     _charService   = charService;
     _skillsService = skillsService;
     _helpService   = helpService;
 }
Exemplo n.º 21
0
 public Info(HttpClient httpClient, CommandService commandService, HelpService helpService, GameService gameService, PermissionService permissionService, PremiumService premium)
 {
     HttpClient        = httpClient;
     CommandService    = commandService;
     HelpService       = helpService;
     GameService       = gameService;
     PermissionService = permissionService;
     Premium           = premium;
 }
        public void SetUp()
        {
            _helpRepoMock = new Mock <IHelpRepository>();
            _mapperMock   = new Mock <IMapper>();

            _helpService = new HelpService(
                _helpRepoMock.Object,
                _mapperMock.Object);
        }
Exemplo n.º 23
0
        // --------------------------------------------------------------------------------------------
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources
        /// </summary>
        /// <param name="disposing">
        /// <c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only
        /// unmanaged resources.
        /// </param>
        // --------------------------------------------------------------------------------------------
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_VsShell != null)
                {
                    try
                    {
                        // --- Don't check for return code because here we can't do anything in case of failure.
                        _VsShell.UnadviseBroadcastMessages(_BroadcastEventCookie);
                    }
                    catch (SystemException)
                    {
                        // --- This exception is intentionally caught
                    }
                    _VsShell = null;
                    _BroadcastEventCookie = 0;
                }
                IWin32Window window = Window;
                if (window is IDisposable)
                {
                    try
                    {
                        ((IDisposable)window).Dispose();
                    }
                    catch (Exception)
                    {
                        VsDebug.Fail("Failed to dispose window");
                    }
                }
                if (_CommandService != null && _CommandService is IDisposable)
                {
                    try
                    {
                        ((IDisposable)_CommandService).Dispose();
                    }
                    catch (Exception)
                    {
                        VsDebug.Fail("Failed to dispose command service");
                    }
                }
                _CommandService = null;

                if (_ParentServiceProvider != null)
                {
                    _ParentServiceProvider = null;
                }

                if (_HelpService != null)
                {
                    _HelpService = null;
                }

                // --- Do not clear _ServiceProvider. SetSite will do it for us.
                _Zombied = true;
            }
        }
Exemplo n.º 24
0
 protected Engine()
 {
     ProcessorCompiler       = new ProcessorCompiler(this);
     EventManager            = new EventManager(this);
     SearchService           = new SearchService(this);
     HelpService             = new HelpService(this);
     NamespaceResolver       = new NamespaceResolverService(this);
     StaticNamespaceResolver = NamespaceResolver; // We need one static instance for resolving at Deserialization Time
 }
        public VerboseErrorsService(IEnumerable <GuildConfig> gcs, DbService db, CommandHandler ch, HelpService hs)
        {
            _db = db;
            _ch = ch;
            _hs = hs;

            ch.CommandErrored += LogVerboseError;

            guildsEnabled = new ConcurrentHashSet <ulong>(gcs.Where(x => x.VerboseErrors).Select(x => x.GuildId));
        }
Exemplo n.º 26
0
 public AdminModule(CharacterService charService,
                    SkillsService skillsService,
                    SpecialService specialService,
                    HelpService helpService)
 {
     _charService    = charService;
     _skillsService  = skillsService;
     _specialService = specialService;
     _helpService    = helpService;
 }
Exemplo n.º 27
0
 public HelpModule(DiscordBotServiceContainer services,
                   ReactionService reactions,
                   HelpService help,
                   ConfigParserService configParser)
     : base(services)
 {
     this.reactions    = reactions;
     this.help         = help;
     this.configParser = configParser;
 }
Exemplo n.º 28
0
        public ActionResult Help(int page = 1)
        {
            int pageSize = 100;
            var list     = HelpService.GetList(page, pageSize);

            ViewBag.Total      = list.TotalItem;
            ViewBag.PageIndex  = page;
            ViewBag.TotalPages = Math.Ceiling(list.TotalItem * 1.0 / pageSize);
            return(View(list.Data));
        }
Exemplo n.º 29
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (win32Wrapper != null)
                {
                    win32Wrapper.Dispose();
                }
                win32Wrapper = null;

                IDisposable disposableWindow = null;
                if (Content != null)
                {
                    disposableWindow = Content as IDisposable;
                }
                else
                {
                    disposableWindow = Window as IDisposable;
                }

                if (disposableWindow != null)
                {
                    try {
                        disposableWindow.Dispose();
                    } catch (Exception) {
                        Debug.Fail("Failed to dispose window");
                    }
                }
                disposableWindow = null;

                if (_commandService != null && _commandService is IDisposable)
                {
                    try {
                        ((IDisposable)_commandService).Dispose();
                    } catch (Exception) {
                        Debug.Fail("Failed to dispose command service");
                    }
                }
                _commandService = null;

                if (_parentProvider != null)
                {
                    _parentProvider = null;
                }

                if (_helpService != null)
                {
                    _helpService = null;
                }

                // Do not clear _provider.  SetSite will do it for us.

                _zombie = true;
            }
        }
Exemplo n.º 30
0
        /// <include file='doc\WindowPane.uex' path='docs/doc[@for="WindowPane.GetService"]' />
        /// <devdoc>
        ///     Maps to IServiceProvider for service routing.
        /// </devdoc>
        protected virtual object GetService(Type serviceType)
        {
            if (_zombie)
            {
                Debug.Fail("GetService called after WindowPane was zombied");
                return(null);
            }

            if (serviceType == null)
            {
                throw new ArgumentNullException("serviceType");
            }

            // We provide IMenuCommandService, so we will
            // demand create it.  MenuCommandService also
            // implements IOleCommandTarget, but unless
            // someone requested IMenuCommandService no commands
            // will exist, so we don't demand create for
            // IOleCommandTarget
            //
            if (serviceType == typeof(IMenuCommandService))
            {
                EnsureCommandService();
                return(_commandService);
            }
            else if (serviceType == typeof(IOleCommandTarget))
            {
                return(_commandService);
            }
            else if (serviceType == typeof(IHelpService))
            {
                if (_helpService == null)
                {
                    _helpService = new HelpService(this);
                }
                return(_helpService);
            }

            if (_provider != null)
            {
                object service = _provider.GetService(serviceType);
                if (service != null)
                {
                    return(service);
                }
            }

            if (_parentProvider != null)
            {
                return(_parentProvider.GetService(serviceType));
            }

            return(null);
        }
Exemplo n.º 31
0
        /// <include file='doc\WindowPane.uex' path='docs/doc[@for="WindowPane.GetService"]' />
        /// <devdoc>
        ///     Maps to IServiceProvider for service routing.
        /// </devdoc>
        protected virtual object GetService(Type serviceType)
        {
            if (_zombie)
            {
                Debug.Fail("GetService called after WindowPane was zombied");
                return null;
            }

            if (serviceType == null) {
                throw new ArgumentNullException("serviceType");
            }

            // We provide IMenuCommandService, so we will
            // demand create it.  MenuCommandService also
            // implements IOleCommandTarget, but unless
            // someone requested IMenuCommandService no commands
            // will exist, so we don't demand create for
            // IOleCommandTarget
            //
            if (serviceType.IsEquivalentTo(typeof(IMenuCommandService))) {
                EnsureCommandService();
                return _commandService;
            }
            else if (serviceType.IsEquivalentTo(typeof(IOleCommandTarget))) {
                return _commandService;
            }
            else if (serviceType.IsEquivalentTo(typeof(IHelpService))) {
                if (_helpService == null) {
                    _helpService = new HelpService(this);
                }
                return _helpService;
            }

            if (_provider != null) {
                object service = _provider.GetService(serviceType);
                if (service != null) {
                    return service;
                }
            }

            // We should never attempt to resite the parent
            // if _provider is not null it will have already succeeded above.
            if (serviceType.IsEquivalentTo(typeof(IObjectWithSite)))
                return null;

            if (_parentProvider != null) {
                return _parentProvider.GetService(serviceType);
            }

            return null;
        }
Exemplo n.º 32
0
        /// <include file='doc\WindowPane.uex' path='docs/doc[@for="WindowPane.GetService"]' />
        /// <devdoc>
        ///     Maps to IServiceProvider for service routing.
        /// </devdoc>
        protected virtual object GetService(Type serviceType) {

            if (_zombie)
            {
                Debug.Fail("GetService called after WindowPane was zombied");
                return null;
            }

            if (serviceType == null) {
                throw new ArgumentNullException("serviceType");
            }

            // We provide IMenuCommandService, so we will
            // demand create it.  MenuCommandService also
            // implements IOleCommandTarget, but unless
            // someone requested IMenuCommandService no commands
            // will exist, so we don't demand create for
            // IOleCommandTarget
            //
            if (serviceType == typeof(IMenuCommandService)) {
                EnsureCommandService();
                return _commandService;
            }
            else if (serviceType == typeof(IOleCommandTarget)) {
                return _commandService;
            }
            else if (serviceType == typeof(IHelpService)) {
                if (_helpService == null) {
                    _helpService = new HelpService(this);
                }
                return _helpService;
            }

            if (_provider != null) {
                object service = _provider.GetService(serviceType);
                if (service != null) {
                    return service;
                }
            }

            if (_parentProvider != null) {
                return _parentProvider.GetService(serviceType);
            }

            return null;
        }
Exemplo n.º 33
0
        /// <include file='doc\WindowPane.uex' path='docs/doc[@for="WindowPane.Dispose1"]' />
        /// <devdoc>
        ///     Called when this window pane is being disposed.
        /// </devdoc>
        protected virtual void Dispose(bool disposing) {

            if (disposing) {

                if (_vsShell != null) {
                    try {
                        // Don't check for return code because here we can't do anything in case of failure.
                        _vsShell.UnadviseBroadcastMessages(_broadcastEventCookie);
                    } catch (COMException) { /* do nothing */ }
                    _vsShell = null;
                    _broadcastEventCookie = 0;
                }

                IWin32Window window = Window;
                if (window is IDisposable) {
                    try {
                    ((IDisposable)window).Dispose();
                    } catch (Exception) {
                        Debug.Fail("Failed to dispose window");
                    }
                }
                window = null;

                if (_commandService != null && _commandService is IDisposable) {
                    try {
                    ((IDisposable)_commandService).Dispose();
                    } catch (Exception) {
                        Debug.Fail("Failed to dispose command service");
                    }
                }
                _commandService = null;

                if (_parentProvider != null)
                    _parentProvider = null;

                if (_helpService != null)
                    _helpService = null;

                // Do not clear _provider.  SetSite will do it for us.

                _zombie = true;
            }
        }
Exemplo n.º 34
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing) {

                if (win32Wrapper != null)
                    win32Wrapper.Dispose();
                win32Wrapper = null;

                IDisposable disposableWindow = null;
                if (Content != null)
                {
                    disposableWindow = Content as IDisposable;
                }
                else
                {
                    disposableWindow = Window as IDisposable;
                }

                if (disposableWindow != null)
                {
                    try {
                        disposableWindow.Dispose();
                    } catch (Exception) {
                        Debug.Fail("Failed to dispose window");
                    }
                }
                disposableWindow = null;

                if (_commandService != null && _commandService is IDisposable) {
                    try {
                        ((IDisposable)_commandService).Dispose();
                    } catch (Exception) {
                        Debug.Fail("Failed to dispose command service");
                    }
                }
                _commandService = null;

                if (_parentProvider != null)
                    _parentProvider = null;

                if (_helpService != null)
                    _helpService = null;

                // Do not clear _provider.  SetSite will do it for us.

                _zombie = true;

            }
        }