Provides implementations for the common addin actions. This class should contain most VSTO specific code.
Example #1
0
        /// <summary>
        /// Makes the login to the server, using the ConnectionSettingsForm
        /// or the last stored credentials.
        /// Adds the taskpanes.
        /// </summary>
        public void InitializeAddin()
        {
            //Set encoding to ISO-8859-1(Western)
            Application.Options.DefaultTextEncoding   = Microsoft.Office.Core.MsoEncoding.msoEncodingWestern;
            Application.Options.UseNormalStyleForList = true;
            this.SaveFormat = Word.WdSaveFormat.wdFormatHTML;

            timer = new System.Timers.Timer(TIMER_INTERVAL);
            //Repositories and temporary files settings
            if (XOfficeCommonSettingsHandler.HasSettings())
            {
                addinSettings = XOfficeCommonSettingsHandler.GetSettings();
                if (addinSettings.MetaDataFolderSuffix == "")
                {
                    SetFolderSuffix(addinSettings);
                }
            }
            else
            {
                this.AddinSettings = new XOfficeCommonSettings();
            }
            timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            timer.Start();

            InitializeEventsHandlers();
            bool connected      = false;
            bool hasCredentials = LoadCredentials();

            if (hasCredentials && AddinSettings.AutoLogin)
            {
                Client    = XWikiClientFactory.CreateXWikiClient(AddinSettings.ClientType, serverURL, username, password);
                connected = Client.LoggedIn;
            }
            else if (!hasCredentials)
            {
                //if the user wants to login at startup, and enter the credentials
                if (AddinSettings.AutoLogin)
                {
                    if (ShowConnectToServerUI())
                    {
                        connected = Client.LoggedIn;
                        this.AddinStatus.Syntax = this.DefaultSyntax;
                    }
                }
            }
            if (!connected)
            {
                Globals.Ribbons.XWikiRibbon.SwitchToOfflineMode();
            }
            else if (Client.LoggedIn)
            {
                Globals.Ribbons.XWikiRibbon.SwitchToOnlineMode();
            }

            this.AnnotationMaintainer = new AnnotationMaintainer();

            addinActions = new AddinActions(this);
            Log.Success("XWord started");
        }
Example #2
0
        /// <summary>
        /// Makes the login to the server, using the ConnectionSettingsForm
        /// or the last stored credentials.
        /// Adds the taskpanes.
        /// </summary>
        public void InitializeAddin()
        {
            //Set encoding to ISO-8859-1(Western)
            Application.Options.DefaultTextEncoding = Microsoft.Office.Core.MsoEncoding.msoEncodingWestern;
            Application.Options.UseNormalStyleForList = true;
            this.SaveFormat = Word.WdSaveFormat.wdFormatHTML;

            timer = new System.Timers.Timer(TIMER_INTERVAL);
            //Repositories and temporary files settings
            if (XOfficeCommonSettingsHandler.HasSettings())
            {
                addinSettings = XOfficeCommonSettingsHandler.GetSettings();
                if (addinSettings.MetaDataFolderSuffix == "")
                {
                    SetFolderSuffix(addinSettings);
                }
            }
            else
            {
                this.AddinSettings = new XOfficeCommonSettings();
            }
            timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            timer.Start();

            InitializeEventsHandlers();
            bool connected = false;
            bool hasCredentials = LoadCredentials();
            if (hasCredentials && AddinSettings.AutoLogin)
            {
                Client = XWikiClientFactory.CreateXWikiClient(AddinSettings.ClientType, serverURL, username, password);
                connected = Client.LoggedIn;
            }
            else if (!hasCredentials)
            {
                //if the user wants to login at startup, and enter the credentials
                if (AddinSettings.AutoLogin)
                {
                    if (ShowConnectToServerUI())
                    {
                        connected = Client.LoggedIn;
                        this.AddinStatus.Syntax = this.DefaultSyntax;
                    }
                }
            }
            if (!connected)
            {
                Globals.Ribbons.XWikiRibbon.SwitchToOfflineMode();
            }
            else if (Client.LoggedIn)
            {
                Globals.Ribbons.XWikiRibbon.SwitchToOnlineMode();
            }

            this.AnnotationMaintainer = new AnnotationMaintainer();

            addinActions = new AddinActions(this);
            Log.Success("XWord started");
        }