public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, IAuthenticationManager authenticationManager, IChefService chefService) { _userManager = userManager; _signInManager = signInManager; _authenticationManager = authenticationManager; _chefService = chefService; }
/// <summary> /// Method to channel factory for Chef Service /// </summary> private void InitializeChefChannel() { try { this.chefServiceAddress = new EndpointAddress(new Uri("net.tcp://localhost:4501/ChefService")); this.chefServiceFactory = new ChannelFactory<IChefService>( new NetTcpBinding(), this.chefServiceAddress); this.chefClient = this.chefServiceFactory.CreateChannel(); this.timer = new System.Windows.Forms.Timer(); this.timer.Interval = 15000; this.timer.Tick += new EventHandler(this.OrderStatus_TimerElapsed); this.timer.Start(); } catch (FaultException<RestaurantService.Contracts.ServiceFaultDetails> ex) { MessageBox.Show(ex.Message, "FaultException", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (CommunicationException ex) { ((IClientChannel)chefClient).Abort(); this.chefClient = null; MessageBox.Show(ex.Message, "Communication Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.chefServiceFactory.Abort(); System.Environment.Exit(1); } }
public ChefsController(IChefService chefService) { _chefService = chefService; }
/// <summary> /// Method to Clean up. /// </summary> private void CleanUp() { try { this.timer.Stop(); ((IClientChannel)chefClient).Close(); chefClient = null; chefServiceFactory.Close(); chefServiceFactory = null; } catch (CommunicationException commProblem) { Console.WriteLine(commProblem.Message); if (chefServiceFactory != null) { chefServiceFactory.Abort(); } Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); if (chefServiceFactory != null) { chefServiceFactory.Abort(); } Console.ReadLine(); } finally { if (chefClient != null) { ((IClientChannel)chefClient).Close(); } if (chefServiceFactory != null) { chefServiceFactory.Abort(); } } }