public LogPage(AblyService ably) { _ably = ably; InitializeComponent(); var logObserver = new LogObserver(message => LogList.Text = LogList.Text + $"[{message.Level}] " + message.Message + "\n"); _ably.Subscribe(logObserver); }
public MainPage(AblyService ably) { InitializeComponent(); var connectionStateObserver = new ConnectionStatusObserver(x => viewModel.ConnectionStatus = x); ably.Subscribe(connectionStateObserver); BindingContext = viewModel = new MainViewModel(ably); }
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)); }
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); }
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", }, } }; }