/// <summary>
 /// Method will be called when the view is attached to the window
 /// </summary>
 /// <param name="bindable">SampleView type parameter as bindable</param>
 protected override void OnAttachedTo(SampleView bindable)
 {
     this.sfChat    = bindable.FindByName <SfChat>("sfChat");
     this.viewModel = bindable.FindByName <FlightBookingViewModel>("viewModel");
     this.viewModel.Messages.CollectionChanged += OnMessagesCollectionChanged;
     base.OnAttachedTo(bindable);
 }
        /// <summary>
        /// Method will be called when the view is detached from window
        /// </summary>
        /// <param name="bindable">SampleView type of bindAble parameter</param>
        protected override void OnDetachingFrom(SampleView bindable)
        {
            this.viewModel.Messages.CollectionChanged -= OnMessagesCollectionChanged;
            Connectivity.ConnectivityChanged          -= this.viewModel.BotService.OnConnectivityChanged;
            this.viewModel.Bot = null;
            if (this.sfChat != null)
            {
                this.sfChat.Dispose();
                this.sfChat = null;
            }
            if (this.viewModel != null)
            {
                this.viewModel = null;
            }

            base.OnDetachingFrom(bindable);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of <see cref="BotService"/> class.
 /// </summary>
 /// <param name="viewModel">view model as paramter.</param>
 public BotService(FlightBookingViewModel viewModel)
 {
     this.ViewModel = viewModel;
     InitializeHttpConnection();
 }