Ejemplo n.º 1
0
 private void ImportSettings()
 {
     using (var dialog = new OpenFileDialog
     {
         Filter = RubberduckUI.DialogMask_XmlFilesOnly,
         Title = RubberduckUI.DialogCaption_LoadGeneralSettings
     })
     {
         dialog.ShowDialog();
         if (string.IsNullOrEmpty(dialog.FileName))
         {
             return;
         }
         var service = new XmlPersistanceService <Rubberduck.Settings.GeneralSettings> {
             FilePath = dialog.FileName
         };
         var general   = service.Load(new Rubberduck.Settings.GeneralSettings());
         var hkService = new XmlPersistanceService <HotkeySettings> {
             FilePath = dialog.FileName
         };
         var hotkey = hkService.Load(new HotkeySettings());
         //Always assume Smart Indenter registry import has been prompted if importing.
         general.SmartIndenterPrompted = true;
         TransferSettingsToView(general, hotkey);
     }
 }
 private void ImportSettings()
 {
     using (var dialog = new OpenFileDialog
     {
         Filter = RubberduckUI.DialogMask_XmlFilesOnly,
         Title = RubberduckUI.DialogCaption_LoadInspectionSettings
     })
     {
         dialog.ShowDialog();
         if (string.IsNullOrEmpty(dialog.FileName))
         {
             return;
         }
         var service = new XmlPersistanceService <CodeInspectionSettings> {
             FilePath = dialog.FileName
         };
         var loaded = service.Load(new CodeInspectionSettings());
         TransferSettingsToView(loaded);
     }
 }
Ejemplo n.º 3
0
 private void ImportSettings()
 {
     using (var dialog = new OpenFileDialog
     {
         Filter = RubberduckUI.DialogMask_XmlFilesOnly,
         Title = RubberduckUI.DialogCaption_LoadToDoSettings
     })
     {
         dialog.ShowDialog();
         if (string.IsNullOrEmpty(dialog.FileName))
         {
             return;
         }
         var service = new XmlPersistanceService <ToDoListSettings> {
             FilePath = dialog.FileName
         };
         var loaded = service.Load(new ToDoListSettings());
         TodoSettings = new ObservableCollection <ToDoMarker>(loaded.ToDoMarkers);
     }
 }
Ejemplo n.º 4
0
        // ReSharper disable InconsistentNaming
        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            _kernel = new StandardKernel(new NinjectSettings {
                LoadExtensions = true
            }, new FuncModule(), new DynamicProxyModule());

            try
            {
                var currentDomain = AppDomain.CurrentDomain;
                currentDomain.AssemblyResolve += LoadFromSameFolder;

                var config = new XmlPersistanceService <GeneralSettings>
                {
                    FilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Rubberduck",
                                            "rubberduck.config")
                };

                var settings = config.Load(null);
                if (settings != null)
                {
                    try
                    {
                        var cultureInfo = CultureInfo.GetCultureInfo(settings.Language.Code);
                        Dispatcher.CurrentDispatcher.Thread.CurrentUICulture = cultureInfo;
                    }
                    catch (CultureNotFoundException) { }
                }

                _kernel.Load(new RubberduckModule((VBE)Application, (AddIn)AddInInst));
                _app = _kernel.Get <App>();
                _app.Startup();
            }
            catch (Exception exception)
            {
                _logger.Fatal(exception);
                System.Windows.Forms.MessageBox.Show(exception.ToString(), RubberduckUI.RubberduckLoadFailure, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }