SplashScreen
This commit is contained in:
+36
-18
@@ -4,6 +4,8 @@ using System.Windows;
|
||||
using System.Security.Principal;
|
||||
using Serilog;
|
||||
using Serilog.Sinks.Graylog;
|
||||
using DevExpress.Mvvm;
|
||||
using DevExpress.Xpf.Core;
|
||||
|
||||
namespace wpf_ax_utility
|
||||
{
|
||||
@@ -15,24 +17,7 @@ namespace wpf_ax_utility
|
||||
public static string userName { get { return WindowsIdentity.GetCurrent().Name.Replace("PAL\\", ""); } }
|
||||
public App()
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration().WriteTo.Graylog(new GraylogSinkOptions
|
||||
{
|
||||
HostnameOrAddress = "palgraylog01.pal.it",
|
||||
Port = 12202,
|
||||
MinimumLogEventLevel = Serilog.Events.LogEventLevel.Verbose,
|
||||
Facility = "(WPF) AX Utility"
|
||||
}).CreateLogger();
|
||||
|
||||
var userGroups = GetGroups(userName);
|
||||
|
||||
var uriString = "/wpf_ax_utility;component/UserWindow.xaml";
|
||||
|
||||
if (userGroups.Contains("PAL\\BRAIN FORCE - AX DEV ADMINS") || userGroups.Contains("PAL\\PAL GG IT"))
|
||||
{
|
||||
uriString = "/wpf_ax_utility;component/MainWindow.xaml";
|
||||
}
|
||||
|
||||
this.StartupUri = new Uri(uriString, UriKind.Relative);
|
||||
BeforeStart();
|
||||
}
|
||||
|
||||
private List<string> GetGroups(string userName)
|
||||
@@ -54,5 +39,38 @@ namespace wpf_ax_utility
|
||||
result.Sort();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void BeforeStart()
|
||||
{
|
||||
//SplashScreen
|
||||
var splashScreenViewModel = new DXSplashScreenViewModel() {
|
||||
Title = "PAL Ax Utility",
|
||||
Copyright = "",
|
||||
Logo = new Uri("res/pallogo.png", UriKind.Relative),
|
||||
|
||||
};
|
||||
SplashScreenManager.Create(() => new AxUtilitySplashScreen(), splashScreenViewModel).ShowOnStartup();
|
||||
|
||||
//Log Endpoint
|
||||
Log.Logger = new LoggerConfiguration().WriteTo.Graylog(new GraylogSinkOptions
|
||||
{
|
||||
HostnameOrAddress = "palgraylog01.pal.it",
|
||||
Port = 12202,
|
||||
MinimumLogEventLevel = Serilog.Events.LogEventLevel.Verbose,
|
||||
Facility = "(WPF) AX Utility"
|
||||
}).CreateLogger();
|
||||
|
||||
//View selection with group filter
|
||||
var userGroups = GetGroups(userName);
|
||||
|
||||
var uriString = "/wpf_ax_utility;component/AppUserWindow.xaml";
|
||||
|
||||
if (userGroups.Contains("PAL\\BRAIN FORCE - AX DEV ADMINS") || userGroups.Contains("PAL\\PAL GG IT"))
|
||||
{
|
||||
uriString = "/wpf_ax_utility;component/AppMainWindow.xaml";
|
||||
}
|
||||
|
||||
this.StartupUri = new Uri(uriString, UriKind.Relative);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<dx:SplashScreenWindow x:Class="wpf_ax_utility.AxUtilitySplashScreen"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
|
||||
xmlns:dxt="http://schemas.devexpress.com/winfx/2008/xaml/core/themekeys"
|
||||
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
|
||||
MinWidth="600"
|
||||
MinHeight="400"
|
||||
AllowAcrylic="True"
|
||||
dx:DXDesignTimeHelper.Background="#02188f"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{x:Static dxmvvm:DXSplashScreenViewModel.DesignTimeData}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="2*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<dx:DXImage x:Name="PART_Logo" Height="35" Width="82" Source="res/pallogo.png" Style="{DynamicResource ResourceKey={dxt:FluentSplashScreenThemeKey ResourceKey=LogoImageStyle}}" Stretch="Fill"/>
|
||||
<TextBlock x:Name="PART_Title" Grid.Row="1" Text="PAL Ax Utility" Style="{DynamicResource ResourceKey={dxt:FluentSplashScreenThemeKey ResourceKey=TitleTextBoxStyle}}"/>
|
||||
<StackPanel Orientation="Vertical" Grid.Row="2" VerticalAlignment="Top">
|
||||
<!--<TextBlock x:Name="PART_SubTitle" Text="{Binding Subtitle}" Style="{DynamicResource ResourceKey={dxt:FluentSplashScreenThemeKey ResourceKey=SubTitleTextBoxStyle}}"/>-->
|
||||
<ProgressBar IsIndeterminate="{Binding IsIndeterminate}" Value="{Binding Progress}" Grid.Row="2" Style="{DynamicResource ResourceKey={dxt:FluentSplashScreenThemeKey ResourceKey=ProgressBarStyle}}"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock x:Name="PART_Copyright" Text='Copyright © 2023 PAL s.r.l. All rights reserved.' Grid.Row="2" Style="{DynamicResource ResourceKey={dxt:FluentSplashScreenThemeKey ResourceKey=CopyrightTextBoxStyle}}"/>
|
||||
<TextBlock x:Name="PART_Status" Text="{Binding Status}" Grid.Row="2" Style="{DynamicResource ResourceKey={dxt:FluentSplashScreenThemeKey ResourceKey=StatusTextBoxStyle}}"/>
|
||||
</Grid>
|
||||
</dx:SplashScreenWindow>
|
||||
@@ -0,0 +1,27 @@
|
||||
using DevExpress.Xpf.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace wpf_ax_utility
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AxUtilitySplashScreen.xaml
|
||||
/// </summary>
|
||||
public partial class AxUtilitySplashScreen : SplashScreenWindow
|
||||
{
|
||||
public AxUtilitySplashScreen()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user