Пример #1
0
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;

            // Language Meta
            LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(LocalizationManager.Culture.IetfLanguageTag)));

            // Load appearance
            AppearanceManager.Load();

            // Transparency
            if (SettingsManager.Current.Appearance_EnableTransparency)
            {
                AllowsTransparency = true;
                Opacity            = SettingsManager.Current.Appearance_Opacity;

                ConfigurationManager.Current.IsTransparencyEnabled = true;
            }

            // NotifyIcon for Autostart
            if (CommandLineManager.Current.Autostart && SettingsManager.Current.Autostart_StartMinimizedInTray || SettingsManager.Current.TrayIcon_AlwaysShowIcon)
            {
                InitNotifyIcon();
            }

            // Set windows title if admin
            if (ConfigurationManager.Current.IsAdmin)
            {
                Title = string.Format("[{0}] {1}", LocalizationManager.GetStringByKey("String_Administrator"), Title);
            }

            // Set the version text
            Version = string.Format("{0} {1}", LocalizationManager.GetStringByKey("String_Version"), AssemblyManager.Current.Version);

            // Load Profiles
            ProfileManager.Load();

            // Load application list, filter, sort
            LoadApplicationList();

            // Load settings
            ApplicationView_Expand = SettingsManager.Current.ApplicationView_Expand;

            // Register some events
            SettingsManager.Current.PropertyChanged += SettingsManager_PropertyChanged;
            EventSystem.RedirectToApplicationEvent  += EventSystem_RedirectToApplicationEvent;
            EventSystem.RedirectToSettingsEvent     += EventSystem_RedirectToSettingsEvent;

            _isLoading = false;
        }
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;

            Version = AssemblyManager.Current.AssemblyVersion.ToString();

            LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(LocalizationManager.Culture.IetfLanguageTag)));

            // Load appearance
            AppearanceManager.Load();

            if (SettingsManager.Current.Appearance_EnableTransparency)
            {
                AllowsTransparency = true;
                Opacity            = SettingsManager.Current.Appearance_Opacity;
            }

            // Autostart & Window start
            if (CommandLineManager.Current.Autostart && SettingsManager.Current.Autostart_StartMinimizedInTray || SettingsManager.Current.TrayIcon_AlwaysShowIcon)
            {
                InitNotifyIcon();
            }

            if (CommandLineManager.Current.Autostart && SettingsManager.Current.Autostart_StartMinimizedInTray)
            {
                HideWindowToTray();
            }

            // Set windows title if admin
            if (ConfigurationManager.Current.IsAdmin)
            {
                Title = string.Format("[{0}] {1}", System.Windows.Application.Current.Resources["String_Administrator"] as string, Title);
            }

            // Load application list, filter, sort
            LoadApplicationList();

            // Load settings
            ApplicationView_Expand = SettingsManager.Current.ApplicationView_Expand;

            _isLoading = false;
        }