mirror of
				https://github.com/9ParsonsB/Pulsar.git
				synced 2025-11-03 23:36:42 -05:00 
			
		
		
		
	Added notification window
This commit is contained in:
		@@ -11,8 +11,9 @@ namespace Observatory.UI.ViewModels
 | 
			
		||||
        public NotificationViewModel(string title, string detail)
 | 
			
		||||
        {
 | 
			
		||||
            Notification = new() { Title = title, Detail = detail };
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public Models.NotificationModel Notification;
 | 
			
		||||
        public Models.NotificationModel Notification { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,12 +2,28 @@
 | 
			
		||||
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
			
		||||
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 | 
			
		||||
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 | 
			
		||||
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
 | 
			
		||||
        mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="150"
 | 
			
		||||
        x:Class="Observatory.UI.Views.NotificationView"
 | 
			
		||||
        
 | 
			
		||||
        Title="Notification">
 | 
			
		||||
        ExtendClientAreaToDecorationsHint="True"
 | 
			
		||||
        Title="Notification"
 | 
			
		||||
        Width="400" Height="150"
 | 
			
		||||
        Topmost="True">
 | 
			
		||||
  <StackPanel DataContext="{Binding Notification}">
 | 
			
		||||
    <TextBlock Text="{Binding Title}" />
 | 
			
		||||
    <TextBlock Text="{Binding Detail}" />
 | 
			
		||||
    <TextBlock 
 | 
			
		||||
      Padding="10"
 | 
			
		||||
      FontWeight="Bold"
 | 
			
		||||
      FontSize="30"
 | 
			
		||||
      FontFamily="Ebrima"
 | 
			
		||||
      Text="{Binding Title}">
 | 
			
		||||
      Title
 | 
			
		||||
    </TextBlock>
 | 
			
		||||
    <TextBlock 
 | 
			
		||||
      Padding="20,0"
 | 
			
		||||
      FontWeight="Normal"
 | 
			
		||||
      FontSize="20"
 | 
			
		||||
      FontFamily="Ebrima"
 | 
			
		||||
      Text="{Binding Detail}">
 | 
			
		||||
      Detail
 | 
			
		||||
    </TextBlock>
 | 
			
		||||
  </StackPanel>
 | 
			
		||||
</Window>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,11 +9,26 @@ namespace Observatory.UI.Views
 | 
			
		||||
        public NotificationView()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
            SystemDecorations = SystemDecorations.None;
 | 
			
		||||
            var screenBounds = Screens.Primary.Bounds;
 | 
			
		||||
            Position = screenBounds.BottomRight - new PixelPoint((int)Width, (int)Height);
 | 
			
		||||
            var timer = new System.Timers.Timer();
 | 
			
		||||
            timer.Elapsed += CloseNotification;
 | 
			
		||||
            timer.Interval = 5000;
 | 
			
		||||
            timer.Start();
 | 
			
		||||
#if DEBUG
 | 
			
		||||
            this.AttachDevTools();
 | 
			
		||||
#endif
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void CloseNotification(object sender, System.Timers.ElapsedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() =>
 | 
			
		||||
            {
 | 
			
		||||
                Close();
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void InitializeComponent()
 | 
			
		||||
        {
 | 
			
		||||
            AvaloniaXamlLoader.Load(this);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user