Exemplo n.º 1
0
 internal RetryImpl(Action retry, IExceptionBehavior behavior, IWaitHandler waitHandler)
     : this(() =>
 {
     retry();
     return(true);
 }, behavior, waitHandler)
 { }
Exemplo n.º 2
0
        protected Application()
        {
#if (NO_NATIVE_BOOTSTRAPPER)
            Assembly assembly = null;
#else
            var assembly = Assembly.GetEntryAssembly() ?? GetType().GetTypeInfo().Assembly;
#endif

            Log         = new NullLogWriter();
            CommandLine = new CommandLineKeyValueStore(Environment.GetCommandLineArgs().Skip(1).ToArray());
            Metadata    = new AssemblyMetadata(assembly);
            Context     = new ApplicationExecutionContext();

            mCommandLine = new CommandLineProcessor(GetType());

            var productKey = Metadata.FileName.NormalizeNull().TryTransform(Path.GetFileNameWithoutExtension);

#if (NO_NATIVE_BOOTSTRAPPER)
            var assemblyDir = Directory.GetCurrentDirectory();
#else
            var assemblyDir = (assembly.Location.TryTransform(Path.GetDirectoryName) ?? Directory.GetCurrentDirectory()).AsKey();
#endif

            var userDir    = Context.GetUserDataDirectoryName("Local", Metadata.CompanyName.NormalizeNull() ?? "XW", productKey ?? ".Default");
            var machineDir = Context.GetMachineDataDirectoryName(Metadata.CompanyName.NormalizeNull() ?? "XW", productKey ?? ".Default");

            WorkingDirectory     = new FileSystemStore(assemblyDir);
            UserDataDirectory    = new FileSystemStore(userDir);
            MachineDataDirectory = new FileSystemStore(machineDir);

            mCurrent     = this;
            mResult      = Result.Success;
            mWaitHandler = new RuntimeWaitHandler();
        }
Exemplo n.º 3
0
    private void Start()
    {
        nameHandler = new CharaNameHandler(nameBox, nameText);
        waitHandler = new WaitHandler(waitSymbol);

        krController = new KrController(dialogBubble, waitSymbol, nameBox, nameText);

        krController.AddDialogStr("[name=\"老鬼\"]meta-programming,[size=50]有人翻做”超程式”還什麼的,不[waitclick]果不管翻什麼,[size=20]要真[name=\"重慶\"]的表達清楚是很不容易,這是在C++ template相關的書上看到的,meta-programming的[name=\"\"]意思就是[waitclick]");
        krController.Begin();
    }
Exemplo n.º 4
0
        public static void Delay([NotNull] this IWaitHandler waitHandler, TimeSpan delay, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (waitHandler == null)
            {
                throw new ArgumentNullException(nameof(waitHandler));
            }

            var clock = new Clock();
            var scope = new Scope().Enter();

            clock.TickInterval = delay;
            clock.TickAction   = () =>
            {
                scope.Leave();
                clock.IsEnabled = false;
            };

            clock.IsEnabled = true;
            waitHandler.Wait(() => !scope.IsInScope, cancellationToken);
        }
Exemplo n.º 5
0
 public WaitClick(IWaitHandler ctrl)
 {
     this.ctrl = ctrl;
 }
Exemplo n.º 6
0
 internal RetryImpl(Func <bool> retry, IExceptionBehavior behavior, IWaitHandler waitHandler)
 {
     toRetry          = retry;
     this.behavior    = behavior;
     this.waitHandler = waitHandler;
 }
Exemplo n.º 7
0
 internal RetryImpl(Action retry, Func <bool> isDonePredicate, IExceptionBehavior behavior, IWaitHandler waitHandler)
     : this(() =>
 {
     retry();
     return(isDonePredicate());
 }, behavior, waitHandler)
 { }
Exemplo n.º 8
0
 public WaitClickFactory(IWaitHandler controller)
 {
     this._waitClick = new WaitClick(controller);
 }
Exemplo n.º 9
0
 protected Operation()
 {
     Scope        = new ReadonlyScope(mScope = new Scope());
     mWaitHandler = new OperationWaitHandler();
 }
Exemplo n.º 10
0
 public static void Delay([NotNull] this IWaitHandler waitHandler, int milliseconds, CancellationToken cancellationToken = default(CancellationToken))
 {
     Delay(waitHandler, TimeSpan.FromMilliseconds(milliseconds), cancellationToken);
 }