Пример #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, PedramDbContext dbContext, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                dbContext.Database.Migrate(); //this will generate the db if it does not exist
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });


            var listener = new TCPListener(9990, serviceProvider.GetService <PedramDbContext>());

            listener.AcceptSocket();

            var nths = new Thread(CheckMessages);

            nths.Start(serviceProvider);
        }
Пример #2
0
 public TCPListener(int portnumber, PedramDbContext context)
 {
     if (_listener == null)
     {
         _listener = new TcpListener(IPAddress.Any, portnumber);
     }
     else
     {
         _listener.Server.Bind(new IPEndPoint(IPAddress.Any, portnumber));
     }
     _context = context;
     if (Allclients == null)
     {
         Allclients = new List <ClientSocket>();
     }
     ListenToPort();
 }
 public UserMessagesService(PedramDbContext context)
 {
     _context        = context;
     _userMessageRep = new UserMessageRep(_context);
 }
Пример #4
0
 public SendingMessagesHandle(PedramDbContext context)
 {
     _context        = context;
     _userMessageRep = new UserMessageRep(_context);
 }
 public ApplicationUserRep(PedramDbContext context)
 {
     _context = context;
 }
Пример #6
0
 public UserMessageRep(PedramDbContext context)
 {
     _context            = context;
     _applicationUserRep = new ApplicationUserRep(_context);
 }