protected override void Initialize(IViewContext context)
        {
            SettingsService = new SettingsService(new PathInfo());

            Model = new MainViewModel(SettingsService, this);
            Model.PropertyChanged += Model_PropertyChanged;
            Model.SelectedTabIndex = 0;

            _explorerControl   = new TmAnonymizerExplorerControl(Model);
            _logViewController = new SDLTMAnonymizerLogViewPart(Model);

            if (SettingsService.GetSettings().Accepted)
            {
                Model.LogViewModel.IsEnabled = true;
                _control = new TmAnonymizerViewControl(Model);

                var pathInfo          = new RwsAppStore.UsefulTipsService.Model.PathInfo(PluginResources.Plugin_Name, "16");
                var tipsProvider      = new TipsProvider(pathInfo);
                var usefulTipsService = new UsefulTipsService(tipsProvider, SettingsService.PathInfo);

                var tipLanguages = usefulTipsService.GetPluginUsefulTips();


                var tipsInstalled = TipsInstalled(tipLanguages, "SDLTMAnonymizerView");
                if (tipsInstalled == 0)
                {
                    var importTips = new ImportTips {
                        TipLanguages = tipLanguages
                    };
                    var countInstalled = usefulTipsService.AddUsefulTips(importTips, true);

                    Trace.WriteLine(string.Format("Installed {0}", countInstalled));
                }

                AlignLanguageTipIds(tipLanguages, tipsProvider, usefulTipsService);

                //var tipReferences = new List<TipReference>();
                //foreach (var tipLanguage in tipLanguages)
                //{
                //	tipReferences.Add(new TipReference
                //	{
                //		LanguageId = tipLanguage.LanguageId,
                //		Resources = tipLanguage.Resources.Select(a => a.RelativePath).ToList(),
                //		TipIds = tipLanguage.Tips.Where(a => !string.IsNullOrEmpty(a.Id)).Select(a => a.Id).ToList()
                //	});
                //}

                //var removeTips = new RemoveTips { TipReferences = tipReferences };

                //var countRemoved = usefulTipsService.RemoveUsefulTips(removeTips);
                //Trace.WriteLine(string.Format("Removed {0}", countRemoved));

                // Debug
                //var count = usefulTipsService.RemoveUsefulTips(usefulTips, StringResources.SDLTM_Anonymizer_Name);
            }
            else
            {
                Model.LogViewModel.IsEnabled = false;
            }
        }
예제 #2
0
        protected override void Initialize(IViewContext context)
        {
            SettingsService = new SettingsService(new PathInfo());

            Model = new MainViewModel(SettingsService, this);
            Model.PropertyChanged += Model_PropertyChanged;
            Model.SelectedTabIndex = 0;

            _explorerControl   = new TmAnonymizerExplorerControl(Model);
            _logViewController = new SDLTMAnonymizerLogViewPart(Model);

            if (SettingsService.GetSettings().Accepted)
            {
                Model.LogViewModel.IsEnabled = true;
                _control = new TmAnonymizerViewControl(Model);

                var usefulTipsService = new Services.UsefulTipsService(SettingsService);
                usefulTipsService.AddUsefulTips();
            }
            else
            {
                Model.LogViewModel.IsEnabled = false;
            }
        }