Beispiel #1
0
        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
            ColorizerSerializer.Serialize(directoryPath + @"\default.xml", colorizer);
            WordFormatterSerializer.Serialize(directoryPath + @"\basicformat.xml", formatter);

            codecleaner.ResetOriginalSettings();
        }
Beispiel #2
0
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            if (Directory.Exists(directoryPath))
            {
                colorizer = ColorizerSerializer.Deserialize(directoryPath + @"\default.xml");
                formatter = WordFormatterSerializer.Deserialize(directoryPath + @"\basicformat.xml");
                formatter.Initialize(colorizer, this.Application);
            }
            else // if it's the first starting of this version of the Add-In with this user
            {
                Directory.CreateDirectory(directoryPath);

                colorizer = new Colorizer();
                colorizer.LoadPredefinedLanguages();
                colorizer.Initialize();

                formatter = new WordFormatter();
                formatter.Initialize(colorizer, this.Application);
                formatter.SetToDefault();
            }

            indentFixer = new WordIndentFixer(this.Application);
            codecleaner = new CodeCleaner(this.Application);

            Globals.Ribbons.WordCodeEditorToolsRibbon.InitializeAddIn(this);
        }