async Task OnShown() { PageButton = CreateButton("Page.png").On(x => x.Tapped, async() => { await AddPageContainer(); }).Background(color: SELECTED); DeviceButton = CreateButton("Device.png").On(x => x.Tapped, async() => { await AddDeviceContainer(); }).Background(color: "#444"); await HeaderBar.Add(PageButton); await HeaderBar.Add(DeviceButton); await HeaderBar.Add(new Canvas().Id("Push to right").Height(100.Percent())); PageTabs.AddRange(new List <View> { CreateButton("Refresh.png") .On(x => x.Tapped, () => { Nav.DisposeCache(); return(Nav.Reload()); }).Absolute().X(350), new TextView("CSS platform: ") { AutoSizeWidth = true }.Margin(left: 320) .TextColor("#999") .TextAlignment(Alignment.Middle) .Height(100.Percent()), await CreateDevicePicker() }); var geoLocationButton = CreateButton("Earth.png").Id("Earth").Background(color: "#444"); geoLocationButton.On(x => x.Tapped, () => { DevicePanel?.CreateGeoLocationForm(WIDTH - 300, 1); geoLocationButton.Background(color: DevicePanel?.GeoLocationForm == null ? "#444" : SELECTED); }); DeviceTabs.AddRange(new List <View> { CreateButton("Back.png").On(x => x.Tapped, Nav.OnHardwareBack), CreateShakeButton(), CreateRotationButton(), CreateMemoryWarningButton(), new TextView().Width(8).Height(100.Percent()).Border(color: "#777", left: 1), geoLocationButton }); await HeaderBar.AddRange(PageTabs); await HeaderBar.AddRange(DeviceTabs); await HeaderBar.Add(CloseButton = new Button { Id = "Close", Text = "X", AutoSizeWidth = true } .Padding(horizontal : 8).Height(100.Percent()).TextAlignment(Alignment.Middle) .On(x => x.Tapped, Inspector.Current.Collapse)); CloseButton.X(570); DeviceTabs.ForEach(view => view.Visible = false); }
static async Task OnReceivedMessage(NotificationMessage message) { Log.Message("Push notification data received! " + message.Data); if (!App.IsActive || Nav.CurrentPage == null) { // The app is not active and ready. Log.Warning("UI is not open and ready, so the notification was ignored!"); } else { await ProcessAlertNotification(message.Data); await ProcessToastNotification(message.Data); await ProcessBadgeUpdate(message.Data); // Page data may be changed: Nav.DisposeCache(); } }
public static async Task <bool> Logout() { var successful = await Post <bool>("api/v1/auth/logout", new { SessionToken = BaseApi.GetSessionToken(), InstallationToken = UIRuntime.GetInstallationToken() // To disable sending push notifications to this device. }); if (successful) { IO.File("SessionToken.txt").Delete(); User.Current = null; Nav.DisposeCache(); await Api.DisposeCache(); } return(successful); }
partial void DisposeCache() => Nav.DisposeCache();