예제 #1
0
 private void DoubleAnimation_Completed(object sender, EventArgs e)
 {
     loaded = true;
     if (Sidebar.SidebarWindow.sett.enableGlass)
     {
         DwmManager.EnableBlurBehindWindow(ref handle);
     }
 }
예제 #2
0
        private void LoadAnimation_Completed(object sender, EventArgs e)
        {
            if (DwmManager.IsBlurAvailable && sett.enableGlass)
            {
                DwmManager.EnableBlurBehindWindow(ref Handle);
            }

            shadow.Height = this.Height;
            shadow.Top    = this.Top;

            if (sett.enableShadow)
            {
                shadow.Show();
                shadow.Owner = this;
            }

            if (sett.enableUpdates)
            {
                foreach (string file in Directory.GetFiles(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.old", SearchOption.TopDirectoryOnly))
                {
                    File.Delete(file);
                }

                foreach (string file in Directory.GetFiles(sett.path, "*.old", SearchOption.AllDirectories))
                {
                    File.Delete(file);
                }

                ThreadStart threadStarter = delegate
                {
                    UpdateInfo updateInfo = UpdateManager.CheckForUpdates();
                    if (updateInfo.Version != null && updateInfo.Description != null)
                    {
                        TaskDialogs.UpdateDialog.ShowDialog(updateInfo.Version, updateInfo.Description);
                    }
                };
                Thread thread = new Thread(threadStarter);
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
        }
예제 #3
0
        private void ApplySettings()
        {
            if (SidebarWindow.sett.overlapTaskbar && !(bool)OverlapCheckBox.IsChecked)
            {
                AppBar.RestoreTaskbar();
            }

            SidebarWindow.sett.startup        = (bool)AutostartCheckBox.IsChecked;
            SidebarWindow.sett.topMost        = (bool)TopMostCheckBox.IsChecked;
            SidebarWindow.sett.locked         = (bool)LockedCheckBox.IsChecked;
            SidebarWindow.sett.overlapTaskbar = (bool)OverlapCheckBox.IsChecked;
            SidebarWindow.sett.enableGlass    = (bool)AeroGlassCheckBox.IsChecked;
            SidebarWindow.sett.enableShadow   = (bool)ShadowCheckBox.IsChecked;
            SidebarWindow.sett.locale         = LangComboBox.Text;
            SidebarWindow.sett.theme          = ThemesComboBox.Text;
            SidebarWindow.sett.enableUpdates  = (bool)UpdatesCheckBox.IsChecked;

            if (ScreenComboBox.SelectedIndex == 0)
            {
                SidebarWindow.sett.screen = "Primary";
            }
            else
            {
                SidebarWindow.sett.screen = Utils.GetScreenFromFriendlyName(ScreenComboBox.Text).DeviceName;
            }

            if ((bool)AutostartCheckBox.IsChecked)
            {
                try
                {
                    using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", RegistryKeyPermissionCheck.ReadWriteSubTree).OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("Run", true))
                    {
                        key.SetValue("LongBar", "" + Assembly.GetExecutingAssembly().Location + "", RegistryValueKind.String);
                        key.Close();
                    }
                }
                catch { }
            }
            else
            {
                try
                {
                    using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", RegistryKeyPermissionCheck.ReadWriteSubTree).OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("Run", true))
                    {
                        key.DeleteValue("LongBar", false);
                        key.Close();
                    }
                }
                catch { }
            }

            if (LocationComboBox.SelectedIndex == 0)
            {
                SidebarWindow.sett.side = AppBarSide.Left;
            }
            else
            {
                SidebarWindow.sett.side = AppBarSide.Right;
            }

            if (DwmManager.IsBlurAvailable && SidebarWindow.sett.enableGlass)
            {
                DwmManager.EnableBlurBehindWindow(ref SidebarHandle);
            }
            else
            {
                DwmManager.DisableBlurBehindWindow(ref SidebarHandle);
            }

            if (ShadowCheckBox.IsChecked == true)
            {
                SidebarWindow.shadow.Show();
            }
            else
            {
                SidebarWindow.shadow.Hide();
            }

            AppBar.AppbarRemove();
            SidebarWindow.SetSide(SidebarWindow.sett.side);

            SidebarWindow.SetTheme(ThemesComboBox.Text);
            SidebarWindow.SetLocale(LangComboBox.Text);
        }