Пример #1
0
        public LogPage(AblyService ably)
        {
            _ably = ably;
            InitializeComponent();
            var logObserver = new LogObserver(message => LogList.Text = LogList.Text + $"[{message.Level}] " + message.Message + "\n");

            _ably.Subscribe(logObserver);
        }
Пример #2
0
        public MainPage(AblyService ably)
        {
            InitializeComponent();
            var connectionStateObserver = new ConnectionStatusObserver(x => viewModel.ConnectionStatus = x);

            ably.Subscribe(connectionStateObserver);

            BindingContext = viewModel = new MainViewModel(ably);
        }
Пример #3
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = AndroidSample.Resource.Layout.Tabbar;
            ToolbarResource   = AndroidSample.Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            ablyService = new AblyService();
            ablyService.Init();
            LoadApplication(new App(ablyService));
        }
Пример #4
0
        public MainViewModel(AblyService ably)
        {
            _ably = ably;
            SendMessageCommand = new Command(() =>
            {
                _ably.SendMessage("test", "test", "Martin");
            });
            StartCommand = new Command(() =>
            {
                _ably.Connect();
            });
            var messageObserver = Observer.Create <Message>(m => Info = m.ToString());

            ably.SubsrcibeToChannel("test").Subscribe(messageObserver);
        }
Пример #5
0
        public App(AblyService ably)
        {
            _ably = ably;
            InitializeComponent();

            Current.MainPage = new TabbedPage
            {
                Children =
                {
                    new NavigationPage(new MainPage(_ably))
                    {
                        Title = "Main",
                    },
                    new NavigationPage(new LogPage(_ably))
                    {
                        Title = "Log",
                    },
                }
            };
        }