Ejemplo n.º 1
0
 public MainWindow()
 {
     UiDispatcher.Initialize();
     InitializeComponent();
     RestorePosition();
     this.Loaded += OnMainWindowLoaded;
 }
Ejemplo n.º 2
0
        public ParserState()
        {
            UiDispatcher.Initialize();
            _state = new RubberduckParserState();

            _state.StateChanged += _state_StateChanged;
        }
Ejemplo n.º 3
0
        public App(VBE vbe, IMessageBox messageBox,
                   UI.Settings.Settings settings,
                   IRubberduckParser parser,
                   IGeneralConfigService configService,
                   IAppMenu appMenus,
                   RubberduckCommandBar stateBar,
                   IRubberduckHooks hooks)
        {
            _vbe           = vbe;
            _messageBox    = messageBox;
            _settings      = settings;
            _parser        = parser;
            _configService = configService;
            _autoSave      = new AutoSave.AutoSave(_vbe, _configService);
            _appMenus      = appMenus;
            _stateBar      = stateBar;
            _hooks         = hooks;

            _hooks.MessageReceived            += _hooks_MessageReceived;
            _configService.SettingsChanged    += _configService_SettingsChanged;
            _parser.State.StateChanged        += Parser_StateChanged;
            _parser.State.StatusMessageUpdate += State_StatusMessageUpdate;
            _stateBar.Refresh += _stateBar_Refresh;
            UiDispatcher.Initialize();
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();
            this.titlePattern = this.Title;

            UiDispatcher.Initialize();

            RestoreSettings();

            this.SizeChanged     += OnWindowSizeChanged;
            this.LocationChanged += OnWindowLocationChanged;
        }
Ejemplo n.º 5
0
        public App(VBE vbe, IMessageBox messageBox,
                   IRubberduckParser parser,
                   IGeneralConfigService configService,
                   IAppMenu appMenus,
                   RubberduckCommandBar stateBar,
                   IRubberduckHooks hooks,
                   SourceControlDockablePresenter sourceControlPresenter)
        {
            _vbe           = vbe;
            _messageBox    = messageBox;
            _parser        = parser;
            _configService = configService;
            _autoSave      = new AutoSave.AutoSave(_vbe, _configService);
            _appMenus      = appMenus;
            _stateBar      = stateBar;
            _hooks         = hooks;
            _logger        = LogManager.GetCurrentClassLogger();

            var sourceControlPanel = (SourceControlPanel)sourceControlPresenter.Window();

            _sourceControlPanelVM = (SourceControlViewViewModel)sourceControlPanel.ViewModel;
            _branchesVM           = (BranchesViewViewModel)_sourceControlPanelVM.TabItems.Single(t => t.ViewModel.Tab == SourceControlTab.Branches).ViewModel;

            _sourceControlPanelVM.OpenRepoStarted   += DisableSinkEventHandlers;
            _sourceControlPanelVM.OpenRepoCompleted += EnableSinkEventHandlersAndUpdateCache;

            _branchesVM.LoadingComponentsStarted   += DisableSinkEventHandlers;
            _branchesVM.LoadingComponentsCompleted += EnableSinkEventHandlersAndUpdateCache;

            _hooks.MessageReceived            += _hooks_MessageReceived;
            _configService.SettingsChanged    += _configService_SettingsChanged;
            _configService.LanguageChanged    += ConfigServiceLanguageChanged;
            _parser.State.StateChanged        += Parser_StateChanged;
            _parser.State.StatusMessageUpdate += State_StatusMessageUpdate;
            _stateBar.Refresh += _stateBar_Refresh;

            _sink = new VBProjectsEventsSink();
            var connectionPointContainer = (IConnectionPointContainer)_vbe.VBProjects;
            var interfaceId = typeof(_dispVBProjectsEvents).GUID;

            connectionPointContainer.FindConnectionPoint(ref interfaceId, out _projectsEventsConnectionPoint);

            _sink.ProjectAdded     += sink_ProjectAdded;
            _sink.ProjectRemoved   += sink_ProjectRemoved;
            _sink.ProjectActivated += sink_ProjectActivated;
            _sink.ProjectRenamed   += sink_ProjectRenamed;

            _projectsEventsConnectionPoint.Advise(_sink, out _projectsEventsCookie);
            UiDispatcher.Initialize();
        }
Ejemplo n.º 6
0
        private async void App_Startup(object sender, StartupEventArgs e)
        {
            MainWindow = _splashScreen = new SplashScreen();

            _splashScreen.Show();

            UiDispatcher.Initialize();
            GeneralExceptionHandler.Instance = new UserFriendlyExceptionHandler();

#if DEBUG
            Tracer.RegisterListener(new ConsoleOutputEventListener());
#endif
            Tracer.RegisterListener(new FileLogEventListener(Path.Combine(ApplicationPaths.StoragePath, "debug.log")));

            _eventRegistry = new ApplicationEventRegistry();
            _container     = new Container();

            _mainWindow         = new MainWindow();
            _mainWindow.Loaded += OnMainWindowLoaded;

            await Task.WhenAll(RegisterServicesAsync());

            await Task.WhenAll(CheckForUpdatesAsync());

            await Task.WhenAll(UpdateDefinitionFilesAsync());

            _mainWindow.DataContext = _container.Resolve <MainWindowViewModel>();

            await Task.WhenAll(InitializePluginsAsync());

            await Task.WhenAll(FinalizeAppStartupAsync());

            await CheckFirstUseAsync();

            _splashScreen.Close();

            var settingsService = _container.Resolve <ILauncherSettingsService>();

            if (!settingsService.GetValue(LauncherCategories.Launcher, LauncherSettingKeys.AcknowledgedDisclaimer, false))
            {
                MessageBoxEx.Show($"DCS Alternative Launcher modifies files that exist in the DCS World game installation folder as well as your Saved Games folder.{Environment.NewLine}Please make sure you have backed up your data before using this software.{Environment.NewLine}{Environment.NewLine}You've been warned :).", "DISCLAIMER");
                settingsService.SetValue(LauncherCategories.Launcher, LauncherSettingKeys.AcknowledgedDisclaimer, true);
            }

            (MainWindow = _mainWindow).Show();

            await _eventRegistry.InvokeApplicationStartupCompleteAsync(this, DeferredEventArgs.CreateEmpty());

            Tracer.Info("Startup Complete.");
        }
Ejemplo n.º 7
0
        public MainWindow()
        {
            InitializeComponent();

            UiDispatcher.Initialize();

            RestoreSettings();

            this.SizeChanged     += OnWindowSizeChanged;
            this.LocationChanged += OnWindowLocationChanged;

            Settings.Instance.PropertyChanged += OnSettingsPropertyChanged;
            Settings.Instance.Model.Items.CollectionChanged         += OnModelItemsChanged;
            Settings.Instance.Targets.TargetPaths.CollectionChanged += OnTargetItemsChanged;
            foreach (SourceFolder f in Settings.Instance.Model.Items)
            {
                f.PropertyChanged += OnSourceFolderPropertyChanged;
            }

            string filename = Settings.LogFile;

            if (File.Exists(filename))
            {
                LoadLogFile(filename);
            }

            System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.CatchException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(OnUnhandledException);
            App.Current.DispatcherUnhandledException   += new DispatcherUnhandledExceptionEventHandler(OnDispatcherUnhandledException);
            TaskScheduler.UnobservedTaskException      += TaskScheduler_UnobservedTaskException;

            this._log = new FlowDocumentLog(ConsoleTextBox);

            backup.AvailableBackupDrives.CollectionChanged += AvailableBackupDrives_CollectionChanged;
            this.monitorDrivesCanellation = new CancellationTokenSource();
            Task.Run(new Action(() =>
            {
                backup.MonitorBackupDrives(this.monitorDrivesCanellation.Token);
            }));

            if (Settings.Instance.Migrated)
            {
                this.DelayedSaveSettings();
            }
        }
Ejemplo n.º 8
0
        public App(IVBE vbe,
                   IMessageBox messageBox,
                   IGeneralConfigService configService,
                   IAppMenu appMenus,
                   IRubberduckHooks hooks,
                   IVersionCheck version,
                   CommandBase checkVersionCommand)
        {
            _messageBox          = messageBox;
            _configService       = configService;
            _appMenus            = appMenus;
            _hooks               = hooks;
            _version             = version;
            _checkVersionCommand = checkVersionCommand;

            _configService.SettingsChanged += _configService_SettingsChanged;

            UiDispatcher.Initialize();
        }
Ejemplo n.º 9
0
        public App(VBE vbe, IMessageBox messageBox,
                   IRubberduckParser parser,
                   IGeneralConfigService configService,
                   IAppMenu appMenus,
                   RubberduckCommandBar stateBar,
                   IIndenter indenter,
                   IRubberduckHooks hooks)
        {
            _vbe           = vbe;
            _messageBox    = messageBox;
            _parser        = parser;
            _configService = configService;
            _autoSave      = new AutoSave.AutoSave(_vbe, _configService);
            _appMenus      = appMenus;
            _stateBar      = stateBar;
            _indenter      = indenter;
            _hooks         = hooks;
            _logger        = LogManager.GetCurrentClassLogger();

            _hooks.MessageReceived            += _hooks_MessageReceived;
            _configService.SettingsChanged    += _configService_SettingsChanged;
            _configService.LanguageChanged    += ConfigServiceLanguageChanged;
            _parser.State.StateChanged        += Parser_StateChanged;
            _parser.State.StatusMessageUpdate += State_StatusMessageUpdate;
            _stateBar.Refresh += _stateBar_Refresh;

            var sink = new VBProjectsEventsSink();
            var connectionPointContainer = (IConnectionPointContainer)_vbe.VBProjects;
            var interfaceId = typeof(_dispVBProjectsEvents).GUID;

            connectionPointContainer.FindConnectionPoint(ref interfaceId, out _projectsEventsConnectionPoint);

            sink.ProjectAdded     += sink_ProjectAdded;
            sink.ProjectRemoved   += sink_ProjectRemoved;
            sink.ProjectActivated += sink_ProjectActivated;
            sink.ProjectRenamed   += sink_ProjectRenamed;

            _projectsEventsConnectionPoint.Advise(sink, out _projectsEventsCookie);

            UiDispatcher.Initialize();
        }
Ejemplo n.º 10
0
        public MainWindow()
        {
            InitializeComponent();

            UiDispatcher.Initialize();

            this.progress         = new ProgressUtility(MyProgress);
            MyProgress.Visibility = Visibility.Collapsed;
            UpdateButtons();
            FlightView.ItemsSource             = allFlights;
            ConnectionPanel.DownloadCompleted += OnLogDownloadComplete;
            ConnectionPanel.Connected         += OnChannelConnected;
            ConnectionPanel.Disconnected      += OnChannelDisconnected;
            this.Visibility = Visibility.Hidden;
            RestoreSettings();
            this.SizeChanged        += OnWindowSizeChanged;
            this.LocationChanged    += OnWindowLocationChanged;
            ChartStack.Visibility    = Visibility.Collapsed;
            initialAttitude          = ModelViewer.ModelAttitude;
            CameraPanel.Visibility   = Visibility.Collapsed;
            SystemConsole.Visibility = Visibility.Collapsed;
        }
Ejemplo n.º 11
0
        private async void App_Startup(object sender, StartupEventArgs e)
        {
            _splashScreen = new SplashScreen();
            MainWindow    = _splashScreen;
            _splashScreen.Show();

            UiDispatcher.Initialize();
            GeneralExceptionHandler.Instance = new UserFriendlyExceptionHandler();

#if DEBUG
            Tracer.RegisterListener(new ConsoleOutputEventListener());
#endif
            Tracer.RegisterListener(new FileLogEventListener(Path.Combine(ApplicationPaths.StoragePath, "debug.log")));

            _container  = new Container();
            _mainWindow = new MainWindow();

            await Task.WhenAll(UpdateDefinitionFilesAsync());

            await Task.WhenAll(RegisterServicesAsync(), Task.Delay(1000));

            await Task.WhenAll(CheckSettingsExistAsync(), Task.Delay(1000));

            CheckFirstUse();

            _mainWindow.DataContext = new MainWindowViewModel(_container);
            _mainWindow.Loaded     += _mainWindow_Loaded;

            await Task.WhenAll(InitializePluginsAsync(), Task.Delay(1000));

            _splashScreen.Close();
            MainWindow = _mainWindow;
            _mainWindow.Show();

            Tracer.Info("Startup Complete.");
            Tracker.Instance.SendEvent(AnalyticsCategories.AppLifecycle, AnalyticsEvents.StartupComplete, Version.ToString());
        }
Ejemplo n.º 12
0
 public ParserState()
 {
     UiDispatcher.Initialize();
 }