Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            CreateConnection();

            DirectoryGuard.DirectoriesSanityCheck();

            InitializeChatView();
            InitializeStatistics();

            _glowFadeOutAnimation = new ColorAnimation(Colors.WindowActiveGlow, Colors.WindowInactiveGlow, new Duration(new TimeSpan(0, 0, 0, 0, 150)));
            _glowFadeInAnimation  = new ColorAnimation(Colors.WindowInactiveGlow, Colors.WindowActiveGlow, new Duration(new TimeSpan(0, 0, 0, 0, 150)));

            var borderActivateAnimation   = new ColorAnimation(Colors.WindowInactiveBorder, Colors.WindowActiveBorder, new Duration(new TimeSpan(0, 0, 0, 0, 150)));
            var borderDeactivateAnimation = new ColorAnimation(Colors.WindowActiveBorder, Colors.WindowInactiveBorder, new Duration(new TimeSpan(0, 0, 0, 0, 150)));

            _borderActivateStoryboard   = new Storyboard();
            _borderDeactivateStoryboard = new Storyboard();

            Storyboard.SetTarget(borderActivateAnimation, WindowBorder);
            Storyboard.SetTargetProperty(borderActivateAnimation, new PropertyPath("(Border.BorderBrush).(SolidColorBrush.Color)"));
            _borderActivateStoryboard.Children.Add(borderActivateAnimation);

            Storyboard.SetTarget(borderDeactivateAnimation, WindowBorder);
            Storyboard.SetTargetProperty(borderDeactivateAnimation, new PropertyPath("(Border.BorderBrush).(SolidColorBrush.Color)"));
            _borderDeactivateStoryboard.Children.Add(borderDeactivateAnimation);

            SettingsSelector.SettingsChanged += SettingsSelector_SettingsChanged;

            _debuggingWindow = new DebugWindow(App.Connection);
            _settingsWindow  = new SettingsWindow();
            _aboutWindow     = new AboutWindow();
            _archiveWindow   = new ArchiveWindow();

            _escTimer          = new Timer(800);
            _escTimer.Elapsed += escTimer_Elapsed;

            SettingsSelector.SetConfigurationValue("Voivodeship", SettingsSelector.GetConfigurationValue <string>("Voivodeship"));
        }
Example #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var systemVersion = Environment.OSVersion.Version;

            if (systemVersion.Major < 6)
            {
                MessageBox.Show("Incompatible system version, must be at least Windows Vista", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            DirectoryGuard.DirectoriesSanityCheck();
            if (!HasWriteAccessToFolder(AppDomain.CurrentDomain.BaseDirectory))
            {
                AlertWindow.Show(LocaleSelector.GetLocaleString("AlertWindow_NoWriteAccess"));
                CanWriteToCurrentFolder = false;
            }
            else
            {
                CanWriteToCurrentFolder = true;
            }
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            WindowFlashHelper = new WindowFlashHelper(this);

            Connection = new Connection
            {
                SendUserAgent = SettingsSelector.GetConfigurationValue <bool>("Behavior_SendUserAgent")
            };
            StatsManager   = new StatsManager(Connection);
            ArchiveManager = new ArchiveManager();

            LocaleSelector.SetLocaleIdentifier(
                SettingsSelector.GetConfigurationValue <string>("Language")
                );

            ColorSchemeLoader = new ColorSchemeLoader();

            ColorSchemeLoader.LoadColorSchemes();
            ColorSchemeLoader.ApplyColors();

            base.OnStartup(e);
        }