A dialog that is shown when a long operation is executed or a Word instance restart/swich is required.
Exemple #1
0
        /// <summary>
        /// Edits a wiki page.
        /// The LoadingDialog is shown during the operation.
        /// <see cref="EditPage"/>
        /// </summary>
        /// <param name="pageFullName">The full name of the wiki page that is being opened for editing.</param>
        public void EditPage(String pageFullName)
        {
            if (IsOpened(pageFullName))
            {
                UserNotifier.Message("You are already editing this page.");
                return;
            }
            if (!this.Client.LoggedIn)
            {
                Client.Login(addin.username, addin.password);
            }
            if (IsProtectedPage(pageFullName, addin.ProtectedPages))
            {
                String message = "You cannot edit this page." + Environment.NewLine;
                message += "This page contains scrips that provide functionality to the wiki.";
                UserNotifier.StopHand(message);
                return;
            }
            LoadingDialog loadingDialog = new LoadingDialog("Opening page...");

            ThreadPool.QueueUserWorkItem(new WaitCallback(loadingDialog.ShowSyncDialog));

            GetPage(pageFullName);
            loadingDialog.CloseSyncDialog();
        }
Exemple #2
0
        /// <summary>
        /// Saves the currently edited page or document to the server.
        /// Displays the operation in progress dialog.
        /// </summary>
        public void SaveToServer()
        {
            if (addin.currentPageFullName == "" || addin.currentPageFullName == null)
            {
                UserNotifier.Exclamation("You are not currently editing a wiki page");
                return;
            }

            if (addin.CurrentPagePublished)
            {
                //Checks if a newer version exists. If yes, then the publishing is canceled redardless if
                //the user  merged the documents or not.
                if (MergeWithLatestVersion(addin.currentPageFullName))
                {
                    return;
                }
            }
            LoadingDialog loadingDialog = new LoadingDialog("Saving to wiki...");

            ThreadPool.QueueUserWorkItem(new WaitCallback(loadingDialog.ShowSyncDialog));
            SaveToXwiki();

            //TODO: Create an SaveCompleted event. Listen for the event and do an async version update
            //Update local history to the latest version
            pagesHistory[addin.currentPageFullName] = Client.GetPageHistory(addin.currentPageFullName);

            loadingDialog.CloseSyncDialog();
            //After a new page has been published to XWiki, refresh the tree view
            //so the user can see his/her page plus other pages that might have been
            //created while the user was working on the current one.
            if (!addin.CurrentPagePublished)
            {
                Globals.XWikiAddIn.XWikiTaskPane.RefreshWikiExplorer();
                addin.CurrentPagePublished = true;
            }
        }
        /// <summary>
        /// Saves the currently edited page or document to the server.
        /// Displays the operation in progress dialog.
        /// </summary>
        public void SaveToServer()
        {
            if (addin.currentPageFullName == "" || addin.currentPageFullName == null)
            {
                UserNotifier.Exclamation("You are not currently editing a wiki page");
                return;
            }

            if (addin.CurrentPagePublished)
            {
                //Checks if a newer version exists. If yes, then the publishing is canceled redardless if
                //the user  merged the documents or not.
                if (MergeWithLatestVersion(addin.currentPageFullName))
                {
                    return;
                }
            }
            LoadingDialog loadingDialog = new LoadingDialog("Saving to wiki...");
            ThreadPool.QueueUserWorkItem(new WaitCallback(loadingDialog.ShowSyncDialog));
            SaveToXwiki();

            //TODO: Create an SaveCompleted event. Listen for the event and do an async version update
            //Update local history to the latest version
            pagesHistory[addin.currentPageFullName] = Client.GetPageHistory(addin.currentPageFullName);

            loadingDialog.CloseSyncDialog();
            //After a new page has been published to XWiki, refresh the tree view
            //so the user can see his/her page plus other pages that might have been
            //created while the user was working on the current one.
            if (!addin.CurrentPagePublished)
            {
                Globals.XWikiAddIn.XWikiTaskPane.RefreshWikiExplorer();
                addin.CurrentPagePublished = true;
            }
        }
        /// <summary>
        /// Edits a wiki page.
        /// The LoadingDialog is shown during the operation.
        /// <see cref="EditPage"/>
        /// </summary>
        /// <param name="pageFullName">The full name of the wiki page that is being opened for editing.</param>
        public void EditPage(String pageFullName)
        {
            if (IsOpened(pageFullName))
            {
                UserNotifier.Message("You are already editing this page.");
                return;
            }
            if (!this.Client.LoggedIn)
            {
                Client.Login(addin.username, addin.password);
            }
            if (IsProtectedPage(pageFullName, addin.ProtectedPages))
            {
                String message = "You cannot edit this page." + Environment.NewLine;
                message += "This page contains scrips that provide functionality to the wiki.";
                UserNotifier.StopHand(message);
                return;
            }
            LoadingDialog loadingDialog = new LoadingDialog("Opening page...");
            ThreadPool.QueueUserWorkItem(new WaitCallback(loadingDialog.ShowSyncDialog));

            GetPage(pageFullName);
            loadingDialog.CloseSyncDialog();
        }