Exemple #1
0
 public HorizontalShellViewModel(PipeWrapper pipe, PipeShellWrapper pipeShell)
 {
     Pipe      = pipe;
     PipeShell = pipeShell;
 }
Exemple #2
0
 public ExclusiveShellViewModel(PipeWrapper pipe, PipeShellWrapper pipeShell)
 {
     Pipe      = pipe;
     PipeShell = pipeShell;
 }
Exemple #3
0
 public EconomUmbrellaViewModel(PipeWrapper pipe, PipeUmbrellaWrapper pipeUmbrella)
 {
     Pipe         = pipe;
     PipeUmbrella = pipeUmbrella;
 }
Exemple #4
0
 public VerticalShellViewModel(PipeWrapper pipe, PipeShellWrapper pipeShell)
 {
     Pipe      = pipe;
     PipeShell = pipeShell;
 }
Exemple #5
0
 private void InitializePipe(Pipe pipe)
 {
     Pipe = new PipeWrapper(pipe);
 }
Exemple #6
0
        public static int Run(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            AdHocHost.Log("Starting");
            AdHocHost.ParseArguments(args);

            AdHocHost.Log("Querying activation context");
            try
            {
                FabricRuntime.GetActivationContext();
                AdHocHost.isActivationContextAvailable = true;
                AdHocHost.Log("ActivationContext get success");
            }
            catch (InvalidOperationException)
            {
                AdHocHost.Log("ActivationContext get failed. InvalidOp");
            }

            FabricRuntime runtime       = null;
            Action        exitedHandler = () =>
            {
                AdHocHost.Log("Fabric Exited");
                AdHocHost.hasFabricDied = true;

                // try creating the fabric runtime on a background thread
                // this should not av
                if (AdHocHost.recreateRuntimeOnCrash)
                {
                    Task.Factory.StartNew(() =>
                    {
                        while (true)
                        {
                            try
                            {
                                AdHocHost.Log("Creating again");
                                runtime = FabricRuntime.Create();
                                AdHocHost.Log("Recreated");
                                break;
                            }
                            catch (AccessViolationException)
                            {
                                AdHocHost.Log("AV");
                                throw;
                            }
                            catch (Exception ex)
                            {
                                AdHocHost.Log("Error {0} when re-creating", ex);
                            }
                        }
                    });
                }
            };

            AdHocHost.Log("Creating FabricRuntime");
            var runtimeTask = FabricRuntime.CreateAsync(exitedHandler, TimeSpan.FromSeconds(5), CancellationToken.None);

            runtimeTask.Wait();

            runtime = runtimeTask.Result;


            AdHocHost.Log("Registering factories");
            foreach (var item in AdHocHost.serviceTypes)
            {
                AdHocHost.Log("Registering: {0}", item.Name);

                var factory = new MyServiceFactory {
                    ServiceImplementationType = item
                };

                Task registerTask = null;
                if (factory.IsStateful)
                {
                    registerTask = runtime.RegisterStatefulServiceFactoryAsync(item.Name, factory, TimeSpan.FromSeconds(5), CancellationToken.None);
                }
                else
                {
                    registerTask = runtime.RegisterStatelessServiceFactoryAsync(item.Name, factory, TimeSpan.FromSeconds(5), CancellationToken.None);
                }

                registerTask.Wait();
            }

            AdHocHost.Log("Connecting to pipe");
            var pipeWrapper = new PipeWrapper(AdHocHost.pipeServerAddress);

            AdHocHost.Log("Waiting for quit...");
            shouldQuitNowEvent.WaitOne();

            return(0);
        }
Exemple #7
0
 public PremiumUmbrellaViewModel(PipeWrapper pipe, PipeUmbrellaWrapper pipeUmbrella)
 {
     Pipe         = pipe;
     PipeUmbrella = pipeUmbrella;
 }
Exemple #8
0
 public StandartUmbrellaViewModel(PipeWrapper pipe, PipeUmbrellaWrapper pipeUmbrella)
 {
     Pipe         = pipe;
     PipeUmbrella = pipeUmbrella;
 }