예제 #1
0
        public MainWindow()
        {
            WindowBlur.SetIsEnabled(this, true);
            InitializeComponent();

            Helper = new FlashWindowHelper(System.Windows.Application.Current);

            Settings = SettingsClass.Create();
            if (Settings.AutoRun)
            {
                if (!IsStartupItem())
                {
                    SetAutorunValue(true, Environment.CurrentDirectory + "\\Updater.exe");
                }
            }
            else
            {
                if (IsStartupItem())
                {
                    SetAutorunValue(false, Environment.CurrentDirectory + "\\Updater.exe");
                }
            }

            if (Environment.GetCommandLineArgs().Length == 1)
            {
                Close();
            }

            Connection = new ConnectionClass(Settings);
            Connection.AcceptMessage += Connection_AcceptMessage;
        }
예제 #2
0
 private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (d is Window window)
     {
         if (true.Equals(e.OldValue))
         {
             GetWindowBlur(window)?.Detach();
             window.ClearValue(WindowBlurProperty);
         }
         if (true.Equals(e.NewValue))
         {
             var blur = new WindowBlur();
             blur.Attach(window);
             window.SetValue(WindowBlurProperty, blur);
         }
     }
 }
예제 #3
0
 public static void SetWindowBlur(DependencyObject element, WindowBlur value)
 {
     element.SetValue(WindowBlurProperty, value);
 }