public MainWindow(AppViewModel viewModel, IPluginRepository pluginRepository, IAccountSettingsProvider accountSettingsProvider, IColumnsSettingsProvider columnsSettingsProvider, IApplicationSettingsProvider applicationSettingsProvider, IEventAggregator eventAggregator) { InitializeComponent(); _pluginRepository = pluginRepository; _accountSettings = accountSettingsProvider; _columnsSettings = columnsSettingsProvider; _applicationSettingsProvider = applicationSettingsProvider; _eventAggregator = eventAggregator; var mainViewModel = viewModel.Model; var resourceViewModel = viewModel.Resources; txtUpdate.SetHeight((Double) FindResource("DefaultCompositionBoxHeight")); var c = (CompositionTextBox) txtUpdate.FindName("txtUpdateBox"); if (c != null) c.IsInlineReply = false; Model = mainViewModel; ResourcesViewModel = resourceViewModel; mainViewModel.View = this; DataContext = mainViewModel; GlobalWindows.MainWindow = this; try { if (TaskbarManager.IsPlatformSupported) TaskbarManager = TaskbarManager.Instance; } catch (Exception ex) { CompositionManager.Get<IExceptionReporter>().ReportHandledException(ex); } if (resourceViewModel.Views == null) return; //Import the XAML foreach (var r in resourceViewModel.Views) { Resources.MergedDictionaries.Add(r); } var ibShowSetup = new InputBinding(ShowSetup, new KeyGesture(Key.S, ModifierKeys.Control)); var ibShowScriptingConsole = new InputBinding(ShowScriptConsoleCommand, new KeyGesture(Key.S, ModifierKeys.Alt)); InputBindings.Add(ibShowSetup); InputBindings.Add(ibShowScriptingConsole); var cbShowSetup = new CommandBinding(ShowSetup); cbShowSetup.Executed += CbShowSetupExecuted; CommandBindings.Add(cbShowSetup); var scriptConsole = new CommandBinding(ShowScriptConsoleCommand); scriptConsole.Executed += ScriptConsoleVisible; CommandBindings.Add(scriptConsole); if (!DesignerProperties.GetIsInDesignMode(this)) { MahTweets.Configuration.WindowSettings.SetSave(this, true); } }
private void StartApplication() { _shell = CompositionManager.Get<IShell>(); ViewModel = CompositionManager.Get<AppViewModel>(); var accounts = CompositionManager.Get<IAccountSettingsProvider>(); var columns = CompositionManager.Get<IColumnsSettingsProvider>(); var applicationSettings = CompositionManager.Get<IApplicationSettingsProvider>(); var scriptingManager = CompositionManager.Get<IScriptingManager>(); scriptingManager.Start(); try { if (applicationSettings.StyleFontSize > 0) ChangeSize("DefaultFontSize", applicationSettings.StyleFontSize); } catch (Exception ex) { CompositionManager.Get<IExceptionReporter>().ReportHandledException(ex); } if (accounts.MicroblogCredentials.Any()) { ViewModel.LoadMicroblogs(); ViewModel.LoadStreams(); ViewModel.LoadSavedSearches(); ViewModel.LoadUrlshorteners(); ViewModel.LoadStatusHandlers(); } else { ViewModel.ShowSetupWindow(); ViewModel.LoadDefaultStream(); } _shell.Start(); OnLoadCompleted(null); }