Ejemplo n.º 1
0
        protected override void OnClicked(IOfficeApplication application)
        {
            var applicationState = application.ApplicationReadyState();

            if (applicationState == OfficeApplicationReadyState.Success)
            {
                PdfUiHelper.ShowPdfPublishForm(application, false);
            }
            else Utils.ShowErrorMessage(applicationState);
        }
Ejemplo n.º 2
0
        protected override void OnClicked(IOfficeApplication application)
        {
            var applicationState = application.ApplicationReadyState();

            if (applicationState == OfficeApplicationReadyState.Success)
            {
                var helper = new PlatformHelper();
                helper.SaveOnline(application);
            }
            else Utils.ShowErrorMessage(applicationState);

        }
Ejemplo n.º 3
0
        protected override void OnClicked(IOfficeApplication application)
        {
			try
			{
	            var applicationState = application.ApplicationReadyState();

	            if (applicationState == OfficeApplicationReadyState.Success)
	            {
	                NativeMethods.ShowDiscoveryDialogEx(application.ActiveDocument.Instance, Process.GetCurrentProcess().MainWindowHandle);
	            }
	            else Utils.ShowErrorMessage(applicationState);
  			}
            catch (Exception e)
            {
                Logger.LogError(e);
            }
        }
Ejemplo n.º 4
0
        protected override void OnClicked(IOfficeApplication application)
        {
			 try
            {
	            var applicationState = application.ApplicationReadyState();

	            if (applicationState == OfficeApplicationReadyState.Success)
	            {
	                Utils.LaunchPdfCombine(application);
	            }
	            else Utils.ShowErrorMessage(applicationState);
 			}
            catch (Exception e)
            {
                Logger.LogError(e);
            }
        }
Ejemplo n.º 5
0
        public void ShareOnline(IOfficeApplication application)
        {
            try
            {
                var applicationState = application.ApplicationReadyState();

                if (applicationState == OfficeApplicationReadyState.Success)
                {
                    var context = SynchronizationContext.Current ?? new WindowsFormsSynchronizationContext();
                    var user = WorkshareOnline.Instance.Security.Authenticate(context);

                    using (var activeDocument = application.ActiveDocument)
                    {
                        using (GroupsServiceLocator.Instance)
                        {
                            GroupsServiceLocator.Instance.Initialize(activeDocument.SaveSnapShot(), user);

                            var window = new ShareWindow();
                            new System.Windows.Interop.WindowInteropHelper(window).Owner =
                                Process.GetCurrentProcess().MainWindowHandle;
                            window.Error += OnShareError;
                            window.Error += new System.EventHandler<ExceptionEventArgs>((object sender, ExceptionEventArgs e) =>
                            {
                                Events.Events.Stream.GetEvent<DocumentSavedOnlineEvent>()
                                    .Publish(new SaveDocumentEventArgs()
                                    {
                                        Document = activeDocument.Instance,
                                        Exception = e.Exception.Flatten().InnerException
                                    });
                            });

                            window.StartSharing += new System.EventHandler((object sender, EventArgs e) =>
                            {
                                Events.Events.Stream.GetEvent<DocumentSharingOnlineEvent>()
                                    .Publish(new SaveDocumentEventArgs()
                                    {
                                        Document = activeDocument.Instance
                                    });
                            });
                            
                            window.EndSharing += new System.EventHandler((object sender, EventArgs e) =>
                            {
                                Events.Events.Stream.GetEvent<DocumentSharedOnlineEvent>()
                                    .Publish(new SaveDocumentEventArgs()
                                    {
                                        Document = activeDocument.Instance,
                                        VersionId = ((FileInfoArgs)e).File.VersionId
                                    });
                            });

                            if (window.ShowDialog().GetValueOrDefault(false))
                            {
                                if (!string.IsNullOrEmpty(window.GroupUuid))
                                {
                                    activeDocument.SetCustomProperty("WorkshareGroupUuid", window.GroupUuid);
                                    activeDocument.SetCustomProperty("WorkshareFileId", window.FileId);
                                    activeDocument.Instance.Save();
                                }
                            }
                        }
                    }
                }
                else Utils.ShowErrorMessage(applicationState);
            }
            catch (Exception e)
            {
                Logger.LogError(e);

                Workshare.Interop.Messaging.WsMessage.ShowMessage(IntPtr.Zero,
                    e.Message, Workshare.Interop.Messaging.MessageButtons.WsOK,
                    Workshare.Interop.Messaging.MessageBranding.WsDefault,
                    Workshare.Interop.Messaging.MessageType.WsErrorIcon, "",
                    0);

                Events.Events.Stream.GetEvent<DocumentSavedOnlineEvent>()
                    .Publish(new SaveDocumentEventArgs()
                    {
                        Exception = e
                    });
            }
        }