SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
SeciSplashscreen.xaml.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows;
6 using System.Windows.Controls;
7 using System.Windows.Data;
8 using System.Windows.Documents;
9 using System.Windows.Input;
10 using System.Windows.Media;
11 using System.Windows.Media.Imaging;
12 using System.Windows.Shapes;
13 using System.Runtime.InteropServices;
14 using System.Windows.Interop;
15 
16 namespace SeciUserInterface.Forms
17 {
21  public partial class SeciSplashscreen : Window
22  {
23  private const int GWL_STYLE = -16;
24  private const int WS_SYSMENU = 0x80000;
25  [DllImport("user32.dll", SetLastError = true)]
26  private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
27  [DllImport("user32.dll")]
28  private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
29 
30  public SeciSplashscreen(String message, Window owner)
31  {
32  InitializeComponent();
33  txtMessage.Text = message;
34  try
35  {
36  Owner = owner;
37  WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
38  }
39  catch
40  {
41  WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
42  }
43  }
44 
45  private void Window_Loaded(object sender, RoutedEventArgs e)
46  {
47  var hwnd = new WindowInteropHelper(this).Handle;
48  SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
49  }
50  }
51 }
void Window_Loaded(object sender, RoutedEventArgs e)
SeciSplashscreen(String message, Window owner)
Interaction logic for SeciLoadingSplashscreen.xaml