Beispiel #1
0
        public static void AppInitialize()
        {
            //// we create a new instance of our own VirtualPathProvider.
            //MyVirtualPathProvider providerInstance = new MyVirtualPathProvider();
            //// any settings about your VirtualPathProvider may go here.
            //
            //// we get the current instance of HostingEnvironment class. We can't create a new one
            //// because it is not allowed to do so. An AppDomain can only have one HostingEnvironment
            //// instance.
            //HostingEnvironment hostingEnvironmentInstance = (HostingEnvironment)typeof(HostingEnvironment).InvokeMember("_theHostingEnvironment", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null);
            //if (hostingEnvironmentInstance == null)
            //    return;
            //
            //// we get the MethodInfo for RegisterVirtualPathProviderInternal method which is internal
            //// and also static.
            //MethodInfo mi = typeof(HostingEnvironment).GetMethod("RegisterVirtualPathProviderInternal", BindingFlags.NonPublic | BindingFlags.Static);
            //if (mi == null)
            //    return;
            //
            //// finally we invoke RegisterVirtualPathProviderInternal method with one argument which
            //// is the instance of our own VirtualPathProvider.
            //mi.Invoke(hostingEnvironmentInstance, new object[] { (VirtualPathProvider)providerInstance });

            // Start Incoming e-mail listeners if any
            IncomingEmailListener.Refresh();

            // Start TCP socket listeners if any
            TCPSocketListenerService.Refresh();

            // Start RabbitMQ listeners if any
            RabbitMQListenerService.Refresh();
        }
Beispiel #2
0
        public ActionResult Save(TCPSocketListener model, int?id)
        {
            DBEntities e = COREobject.i.Context;

            if (ModelState.IsValid)
            {
                // Záznam ji. existuje - pouze upravujeme
                if (!model.Id.Equals(null))
                {
                    TCPSocketListener row = e.TCPListeners.Single(m => m.Id == model.Id);
                    row.ApplicationId = model.ApplicationId;
                    row.BlockName     = model.BlockName;
                    row.WorkflowName  = model.WorkflowName;
                    row.Name          = model.Name;
                    row.Port          = model.Port;
                    row.BufferSize    = model.BufferSize;

                    e.SaveChanges();
                }
                else
                {
                    e.TCPListeners.Add(model);
                    e.SaveChanges();
                }

                TCPSocketListenerService.AddListener(model);

                return(RedirectToRoute("Nexus", new { @action = "Index" }));
            }
            else
            {
                return(View("~/Views/Nexus/TCPSocket/Form.cshtml", model));
            }
        }