private void DisplayWindow_Loaded(object sender, RoutedEventArgs e)
        {
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_STYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_STYLE) | WindowLong.WS_CAPTION));
            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE) | WindowLong.WS_EX_TOOLWINDOW));
        }
Esempio n. 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Enable the minimize animation
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_STYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_STYLE) | WindowLong.WS_CAPTION));

            LoadConfig();
        }
        public void Lock(bool value)
        {
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            if (value && !IsLocked)
            {
                WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE) | WindowLong.WS_EX_TRANSPARENT));
                IsLocked = true;
            }
            else if (!value && IsLocked)
            {
                WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE) & ~WindowLong.WS_EX_TRANSPARENT));
                IsLocked = false;
            }
        }
Esempio n. 4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Enable the minimize animation
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_STYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_STYLE) | WindowLong.WS_CAPTION));

            NotificationManager.Activated += ToastHandler.HandleToast;
            NotificationManager.Install();

            LoadConfig();

            UpdateUtil.NewVersionFound += UpdateUtil_NewVersionFound;
            UpdateUtil.StartCheckVersion();
        }
Esempio n. 5
0
        // About startup

        private void Main_Loaded(object sender, RoutedEventArgs e)
        {
            IntPtr windowHandle = new WindowInteropHelper(this).Handle;

            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_STYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_STYLE) | WindowLong.WS_CAPTION));
            WindowLong.SetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE, (WindowLong.GetWindowLong(windowHandle, WindowLong.GWL_EXSTYLE) | WindowLong.WS_EX_TOOLWINDOW));


            DanmakuBox.Items.Clear();
            GiftBox.Items.Clear();
            ConnectBtn.Content   = Application.Current.Resources["Loading"].ToString();
            ConnectBtn.IsEnabled = false;
            RoomIdBox.IsEnabled  = false;

            ((Storyboard)Resources["ShowWindow"]).Completed += delegate
            {
                new Thread(delegate()
                {
                    ConfigManager.LoadStatus();
                    ApplyStatue(ConfigManager.CurrentStatus);

                    Dispatcher.Invoke(new Action(() =>
                    {
                        RoomIdBox.Focus();
                        RoomIdBox.Select(RoomIdBox.Text.Length, 0);
                    }));

                    proformanceMonitor = new PerformanceMonitor();
                    proformanceMonitor.CpuProformanceRecieved += ProformanceMonitor_CpuProformanceRecieved;
                    proformanceMonitor.GpuProformanceRecieved += ProformanceMonitor_GpuProformanceRecieved;
                    bool[] availability = proformanceMonitor.StartMonitoring();
                    Dispatcher.Invoke(new Action(() =>
                    {
                        if (!availability[0])
                        {
                            CpuUsage.Visibility = Visibility.Hidden;
                        }
                        if (!availability[1])
                        {
                            GpuUsage.Visibility = Visibility.Hidden;
                        }
                    }));
                }).Start();
            };
            ((Storyboard)Resources["ShowWindow"]).Begin();
        }