private async void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e) { if (!e.IsAvailable) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => InAppNotification.Show("No network access", 2000)); } }
private async void getNotifications() { List <Model.Notifikacija> notifikacije = await _apiNotifikacija.Get <List <Model.Notifikacija> >(null); if (notifikacije != null) { foreach (var item in notifikacije) { var x = new InAppNotification(); x.NotifikacijaObj.ClanImage = item.ClanImage; x.NotifikacijaObj.Clan = item.Clan; x.NotifikacijaObj.Datum = item.Datum; x.Nova = true; x.NotifikacijaObj.Opis = item.Opis; x.NotifikacijaObj.NotifikacijaId = item.NotifikacijaId; Notifikacije.Add(x); if ((bool)item.Datum?.ToString("dd.MM.yyyy").Equals(DateTime.Now.ToString("dd.MM.yyyy"))) { NumberOfNotifications++; } } if (NumberOfNotifications == 0) { NumberOfNotifications = null; } myNavigation.Change(NumberOfNotificationsOnIcon); } }
private async void ShellPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { if (!NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => InAppNotification.Show("No network access", 2000)); } }
private void OnCopy(object sender, RoutedEventArgs e) { var dataPackage = new DataPackage(); dataPackage.SetText(_colorText); Clipboard.SetContent(dataPackage); InAppNotification.Show(2000); }
public void NotifyMessage(string message) { if (LastNotifiedMessage != message) { LastNotifiedMessage = message; InAppNotification.Show(message); } }
private void InAppNotificationShow(InAppNotification inAppNotification, ListViewSelectionMode mode = ListViewSelectionMode.Multiple)//Notification:通知展示 { inAppNotification.Show(); AdaptiveGridViewControl.IsItemClickEnabled = false; //不可点击 AdaptiveGridViewControl.SelectionMode = mode; //多选状态 PhotoFileList.Remove(AddPhotoFile); //空白添加:移除 }
private void InAppNotificationDismiss(InAppNotification inAppNotification)//Notification:通知驳回 { inAppNotification.Dismiss(); AdaptiveGridViewControl.IsItemClickEnabled = true; //可点击 AdaptiveGridViewControl.SelectionMode = ListViewSelectionMode.None; //无选状态 PhotoFileList.Add(AddPhotoFile); //空白添加:添加 }
private void Load() { SampleController.Current.RegisterNewCommand("Global Eyedropper", async(sender, args) => { var eyedropper = new Eyedropper(); var color = await eyedropper.Open(); InAppNotification.Show($"You get {color}.", 3000); }); }
public void ShowNotification() { this.BottomAppBar.IsOpen = true; InAppNotification note = this.BottomAppBar.Content as InAppNotification; if (note != null) { note.Show(); } }
public void OnXamlRendered(FrameworkElement control) { NotificationDuration = 0; _exampleInAppNotification = control.FindChildByName("ExampleInAppNotification") as InAppNotification; _defaultInAppNotificationControlTemplate = _exampleInAppNotification?.Template; _exampleVSCodeInAppNotification = control.FindChildByName("ExampleVSCodeInAppNotification") as InAppNotification; _resources = control.Resources; var notificationDurationTextBox = control.FindChildByName("NotificationDurationTextBox") as TextBox; if (notificationDurationTextBox != null) { notificationDurationTextBox.TextChanged += NotificationDurationTextBox_TextChanged; } }
// DOWNLOAD public async Task Download(InAppNotification ExampleInAppNotification) { var savePicker = new Windows.Storage.Pickers.FileSavePicker(); savePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary; savePicker.FileTypeChoices.Add("Archive", new List <string>() { ".zip" }); savePicker.SuggestedFileName = Name; StorageFile savefile = await savePicker.PickSaveFileAsync(); if (savefile == null) { return; } string folder_name = "buffer_folder_" + DateTime.Now.ToString("yyyyMMddhhmmss"); StorageFolder folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(folder_name); ObservableCollection <Page> pages = await PagesLoad(); if (pages == null) { ExampleInAppNotification.Show("Can't loading :(", 4000); return; } int index = 1; foreach (Page page in pages) { await page.Download(folder); ExampleInAppNotification.Show(index + "/" + pages.Count(), 2000); index++; } await Helpers.ZipArchiveManager.ZipFolder(folder, savefile); //ZipFile.CreateFromDirectory(folder.Path, savefile.Path); var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView(); ExampleInAppNotification.Show(resourceLoader.GetString("download_complit"), 4000); }
public override Task <object> ShowToastAsync(ToastParameters toastParameters) { if (InAppNotification != null) { int hiddenMS = 0; if (toastParameters.MillisecondsUntilHidden.HasValue) { hiddenMS = toastParameters.MillisecondsUntilHidden.Value; } InAppNotification.Show(toastParameters.Caption?.ToString(), hiddenMS > 0 ? hiddenMS : (int)ToastHideMS); return(Task.FromResult(new object())); } return(base.ShowToastAsync(toastParameters)); }
public static void Initialize(InAppNotification inAppNotification) { _inAppNotification = inAppNotification; _inAppNotification.ShowDismissButton = false; }
public MainWindowViewModel() { FullName = APIService.Session.ImePrezime; NumberOfNotifications = 0; navlist = new ObservableCollection <NavbarItem>(); Notifikacije = new ObservableCollection <InAppNotification>(); if (APIService.Session.Role.Contains(Stringovi.SuperAdmin)) { navlist.Add(new NavbarItem() { Name = Stringovi.Home, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.Libraries, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddLibrary, TextStyle = "Regular" }); } else if (APIService.Session.Role.Contains(Stringovi.Admin)) { navlist.Add(new NavbarItem() { Name = Stringovi.Publishers, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddPublisher, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.Authors, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddAuthor, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.Books, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddBook, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.Reservations, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddGenre, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.Members, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddMember, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.Employees, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddEmployee, TextStyle = "Regular" }); } else if (APIService.Session.Role.Contains(Stringovi.Uposlenik)) { navlist.Add(new NavbarItem() { Name = Stringovi.Authors, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddAuthor, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.Books, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddBook, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.Reservations, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddGenre, TextStyle = "Regular" }); navlist.Add(new NavbarItem() { Name = Stringovi.Members, TextStyle = "Bold" }); navlist.Add(new NavbarItem() { Name = Stringovi.AddMember, TextStyle = "Regular" }); } getNotifications(); //hubConnection = new HubConnectionBuilder() // .WithUrl("http://localhost:57049/notifications", options => // { // options.AccessTokenProvider = () => Task.FromResult(APIService.Session.JWT); // }) // .WithAutomaticReconnect() // .Build(); hubConnection = new HubConnectionBuilder() .WithUrl("https://ebibliotekawebapi2-prod.us-west-2.elasticbeanstalk.com/notifications", options => { options.AccessTokenProvider = () => Task.FromResult(APIService.Session.JWT); }) .WithAutomaticReconnect() .Build(); hubConnection.On <Model.Notifikacija>("SendNotification", (item) => { if (item != null) { if (NumberOfNotifications == null) { NumberOfNotifications = 0; } var x = new InAppNotification(); x.NotifikacijaObj.ClanImage = item.ClanImage; x.NotifikacijaObj.Clan = item.Clan; x.NotifikacijaObj.Datum = item.Datum; x.Nova = true; x.NotifikacijaObj.Opis = item.Opis; x.NotifikacijaObj.NotifikacijaId = item.NotifikacijaId; Notifikacije.Insert(0, x); NumberOfNotifications++; } myNavigation.Change(NumberOfNotificationsOnIcon); ToastNotifikacija.Noti(item.Clan, item.Opis, "", "Rezervacija", item.ClanImage); }); connect(); }
public ChaosControl(int largeSize, int tinySize, SolidColorBrush foregroundColor, SolidColorBrush backgroundColor, string title = "", string xLabel = "", string yLabel = "") { // -------- Parameters -------- InstanceNumber = NumberOfControls; NumberOfControls++; // -------- UI Elements -------- ChaosForegroundColor = foregroundColor; ChaosBackgroundColor = backgroundColor; ChaosCanvas = new Canvas(); ChaosCanvas.Width = largeSize; ChaosCanvas.Height = largeSize; ChaosCanvas.Visibility = Visibility.Collapsed; ChaosBorder = new Border(); ChaosBorder.Width = largeSize; ChaosBorder.Height = largeSize; ChaosBorder.Background = backgroundColor; ChaosBorder.CornerRadius = new CornerRadius(15); ChaosShadow = new DropShadowPanel(); ChaosShadow.Color = Windows.UI.Colors.Black; ChaosShadow.BlurRadius = 7; ChaosShadow.ShadowOpacity = 1; ChaosShadow.OffsetX = 0; ChaosShadow.OffsetY = 0; ChaosEllipse = new Ellipse(); ChaosEllipse.Fill = foregroundColor; ChaosEllipse.Height = 30; ChaosEllipse.Width = 30; ChaosEllipse.Stroke = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); ChaosEllipse.StrokeThickness = 4; TargetEllipse = new Ellipse(); TargetEllipse.Fill = new SolidColorBrush(Colors.Transparent); TargetEllipse.Height = 30; TargetEllipse.Width = 30; TargetEllipse.Stroke = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); TargetEllipse.StrokeThickness = 4; TargetEllipse.Opacity = 0; InnerNotifier = new TextBlock(); InnerNotifier.Margin = new Thickness(0, TargetEllipse.Height, 0, 0); InnerNotifier.Text = "recording"; InnerNotifier.Foreground = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); InnerNotifier.Style = (Style)Application.Current.Resources["SubtitleTextBlockStyle"]; InnerNotifier.Opacity = 0; ChaosButton = new Button(); ChaosButton.Width = largeSize; ChaosButton.Height = largeSize; ChaosButton.Background = new SolidColorBrush(Windows.UI.Colors.Transparent); XLabel = new TextBlock(); Canvas.SetTop(XLabel, ChaosCanvas.Height); XLabel.Text = xLabel; XLabel.Style = (Style)Application.Current.Resources["SubheaderTextBlockStyle"]; YLabel = new TextBlock(); Canvas.SetTop(YLabel, ChaosCanvas.Height); YLabel.Text = yLabel; YLabel.Style = (Style)Application.Current.Resources["SubheaderTextBlockStyle"]; Canvas.SetLeft(YLabel, -50); YLabel.Rotate(-90, 0, 0, 0).Start(); ChaosCanvas.Children.Add(ChaosBorder); ChaosCanvas.Children.Add(XLabel); ChaosCanvas.Children.Add(YLabel); ChaosCanvas.Children.Add(TargetEllipse); ChaosCanvas.Children.Add(InnerNotifier); ChaosCanvas.Children.Add(ChaosShadow); ChaosShadow.Content = ChaosEllipse; ChaosCanvas.Children.Add(ChaosButton); // -------- The Ghosts -------- GhostCanvas = new Canvas(); GhostCanvas.Width = ChaosCanvas.Width; GhostCanvas.Height = ChaosCanvas.Height; GhostCanvas.Background = new SolidColorBrush(Windows.UI.Colors.Transparent); GhostCanvas.Visibility = Visibility.Visible; GhostShadow = new DropShadowPanel(); GhostShadow.Color = foregroundColor.Color; GhostShadow.BlurRadius = ChaosShadow.BlurRadius; GhostShadow.ShadowOpacity = ChaosShadow.ShadowOpacity; GhostShadow.OffsetX = ChaosShadow.OffsetX; GhostShadow.OffsetY = ChaosShadow.OffsetY; GhostEllipse = new Ellipse(); GhostEllipse.Fill = ChaosEllipse.Fill; GhostEllipse.Height = ChaosEllipse.Height; GhostEllipse.Width = ChaosEllipse.Width; GhostEllipse.Stroke = ChaosEllipse.Stroke; GhostEllipse.StrokeThickness = ChaosEllipse.StrokeThickness; GhostEllipse.Fade((float)0.6, 0).Start(); GhostShadow.Content = GhostEllipse; GhostCanvas.Children.Add(GhostShadow); // -------- Now the Tiny stuff -------- ChaosButtonsNoLabel = new StackPanel(); ChaosButtonsNoLabel.Orientation = Orientation.Horizontal; ChaosButtons = new StackPanel(); ChaosButtons.Margin = new Thickness(10); ChaosTitle = new TextBlock(); ChaosTitle.Style = (Style)Application.Current.Resources["SubtitleTextBlockStyle"]; ChaosTitle.Margin = new Thickness(10, 0, 10, 0); ChaosTitle.Text = title; TinyCanvas = new Canvas(); TinyCanvas.Width = tinySize; TinyCanvas.Height = tinySize; TinyCanvas.Margin = new Thickness(10); TinyBorder = new Border(); TinyBorder.Width = tinySize; TinyBorder.Height = tinySize; TinyBorder.Background = backgroundColor; TinyBorder.CornerRadius = new CornerRadius(10); TinyEllipse = new Ellipse(); TinyEllipse.Fill = foregroundColor; TinyEllipse.Height = 15; TinyEllipse.Width = 15; TinyEllipse.Stroke = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); TinyEllipse.StrokeThickness = 2; TinyButton = new Button(); TinyButton.Width = tinySize; TinyButton.Height = tinySize; TinyButton.Background = new SolidColorBrush(Windows.UI.Colors.Transparent); TinyCanvas.Children.Add(TinyBorder); TinyCanvas.Children.Add(TinyEllipse); TinyCanvas.Children.Add(TinyButton); SnapshotButton = new ToggleButton(); SnapshotButton.Width = tinySize; SnapshotButton.Height = tinySize; SnapshotButton.Margin = new Thickness(10); SnapshotButton.FontFamily = new FontFamily("Segoe MDL2 Assets"); SnapshotButton.Content = "\uEA3A"; SnapshotButton.FontWeight = FontWeights.Medium; ChaosNotifier = new InAppNotification(); ChaosNotifier.Background = foregroundColor; ChaosNotifier.Foreground = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); ChaosNotifier.ShowDismissButton = false; ChaosNotifier.HorizontalAlignment = HorizontalAlignment.Left; ChaosNotifier.VerticalOffset = 0; ChaosNotifier.HorizontalOffset = -200; ChaosNotifier.FontFamily = new FontFamily("Segoe MDL2 Assets"); ChaosNotifier.HorizontalContentAlignment = HorizontalAlignment.Center; ChaosNotifier.FontSize = 32; ChaosNotifier.Margin = new Thickness(0, 0, 25, 25); ChaosButtonsNoLabel.Children.Add(SnapshotButton); ChaosButtonsNoLabel.Children.Add(TinyCanvas); ChaosButtons.Children.Add(ChaosButtonsNoLabel); ChaosButtons.Children.Add(ChaosTitle); TinyCanvas.Children.Add(ChaosNotifier); // -------- Now the events -------- TinyButton.Click += TinyButton_Click; GazeElement chaosButtonControl = new GazeElement(); GazeInput.SetGazeElement(ChaosButton, chaosButtonControl); chaosButtonControl.DwellProgressFeedback += GazeElement_DwellProgressFeedback; chaosButtonControl.StateChanged += ChaosButtonControl_StateChanged; GazeElement snapshotButtonControl = new GazeElement(); GazeInput.SetGazeElement(SnapshotButton, snapshotButtonControl); snapshotButtonControl.StateChanged += SnapshotButtonControl_StateChanged; SnapshotButton.Click += SnapshotButton_Click; // All automation is hardcoded at one second now // Faster times make it harder to move off the grid and accidentally trigger the ellipse // However, possibly in the future we will want to change this timing and/or sync it to the beat SnapshotPlayer = new DispatcherTimer(); SnapshotPlayer.Tick += MoveEllipse; SnapshotPlayer.Interval = new TimeSpan(0, 0, 1); // -------- Finally add to our list -------- AllControls.Add(this); }
public InAppMessenger() { _inAppNotification = MainPage.Messenger; }
private async void Page_Loaded(object sender, RoutedEventArgs e) { await UserWorkation._loadSessionDelay(); tbMax = tbMaxNumber; tbNumber = tbNumberOfunFollower; btnUnf = btnProcess; cbMet = cbMethoud; lv = lvList; notifers = Notinfer; pr = prLoadData; if (HistoryModel.UnFirst) { tbNumberOfunFollower.Text = HistoryModel.Max; btnProcess.IsEnabled = true; tbNumberOfunFollower.IsEnabled = false; btnProcess.Content = "Stop"; switch (HistoryModel.Method) { case 0: { cbMethoud.SelectedIndex = 0; tbMaxNumber.Text = FollowerAnalyser.Diffrent.Count().ToString(); tbNumberOfunFollower.PlaceholderText = FollowerAnalyser.Diffrent.Count().ToString(); lvList.ItemsSource = FollowerAnalyser.Diffrent; } break; case 1: { cbMethoud.SelectedIndex = 1; tbMaxNumber.Text = FollowerAnalyser.Equals.Count().ToString(); tbNumberOfunFollower.PlaceholderText = FollowerAnalyser.Equals.Count().ToString(); lvList.ItemsSource = FollowerAnalyser.Equals; } break; case 2: { cbMethoud.SelectedIndex = 2; tbMaxNumber.Text = FollowerAnalyser.Followers.Count().ToString(); tbNumberOfunFollower.PlaceholderText = FollowerAnalyser.Followers.Count().ToString(); lvList.ItemsSource = FollowerAnalyser.Followers; } break; case 3: { cbMethoud.SelectedIndex = 3; tbMaxNumber.Text = FollowerAnalyser.Diffrent.Count().ToString(); tbNumberOfunFollower.PlaceholderText = FollowerAnalyser.Diffrent.Count().ToString(); lvList.ItemsSource = FollowerAnalyser.Diffrent; } break; } HomePage.par.IsActive = true; } else { if (!FollowerAnalyser.Diffrents) { pr.IsActive = true; } HistoryModel.IsStopUn = true; while (!FollowerAnalyser.Diffrents) { await Task.Delay(100); } cbMethoud.IsEnabled = true; btnProcess.IsEnabled = true; tbMaxNumber.Text = FollowerAnalyser.Diffrent.Count + ""; tbNumberOfunFollower.PlaceholderText = FollowerAnalyser.Diffrent.Count().ToString(); lvList.ItemsSource = FollowerAnalyser.Diffrent; } }
public static MainViewModel GetViewModel(Frame frame, InAppNotification messagePump) { return(container.Resolve <MainViewModel>(new TypedParameter(typeof(Frame), frame), new TypedParameter(typeof(InAppNotification), messagePump))); }
public UwpNotificationService(InAppNotification notification) { this.notification = notification; }
internal void RegisterStripModule(InAppNotification stripModule) { StripModule = stripModule; }
protected override void OnApplyTemplate() { appbar = GetTemplateChild("appbar") as AppBar; note = GetTemplateChild("note") as InAppNotification; }